This commit is contained in:
ct
2025-06-21 09:13:23 +08:00
parent db10fc3f1c
commit 8e58f85860
39 changed files with 684 additions and 181 deletions

View File

@@ -12,7 +12,7 @@ public static function getMemeKeywords(string $name, string $description)
$response = Http::withHeaders([
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $apiKey,
'Authorization' => 'Bearer '.$apiKey,
])->post('https://api.openai.com/v1/responses', [
'model' => 'gpt-4.1-nano',
'input' => [
@@ -64,7 +64,7 @@ public static function getSingleMemeGenerator($user_prompt)
$response = Http::withHeaders([
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . env('OPENAI_API_KEY'),
'Authorization' => 'Bearer '.env('OPENAI_API_KEY'),
])
->post('https://api.openai.com/v1/responses', [
'model' => 'gpt-4.1-nano',
@@ -102,7 +102,7 @@ public static function getSingleMemeGenerator($user_prompt)
],
'primary_keyword_type' => [
'type' => 'string',
'description' => "Primary keyword type, choose only between: (action|emotion|misc)",
'description' => 'Primary keyword type, choose only between: (action|emotion|misc)',
],
'action_keywords' => [
'type' => 'array',
@@ -168,7 +168,7 @@ public static function getSingleMemeGenerator($user_prompt)
return $data;
} else {
// Handle error
throw new \Exception('API request failed: ' . $response->body());
throw new \Exception('API request failed: '.$response->body());
}
}