|
@@ -9,18 +9,25 @@ class DeepSeekService
|
|
{
|
|
{
|
|
public static function streamedResponseChat($message): void
|
|
public static function streamedResponseChat($message): void
|
|
{
|
|
{
|
|
|
|
+ $llmConfig = config('llm.deepseek');
|
|
$headers = [
|
|
$headers = [
|
|
- 'Authorization' => 'Bearer ' . config('llm.deepseek.key'),
|
|
|
|
|
|
+ 'Authorization' => 'Bearer ' . $llmConfig['key'],
|
|
'Content-Type' => 'application/json',
|
|
'Content-Type' => 'application/json',
|
|
];
|
|
];
|
|
$body = [
|
|
$body = [
|
|
- 'model' => 'deepseek-chat',
|
|
|
|
|
|
+ 'model' => $llmConfig['model'],
|
|
'messages' => $message,
|
|
'messages' => $message,
|
|
'stream' => true,
|
|
'stream' => true,
|
|
|
|
+ 'max_tokens' => 1024,
|
|
|
|
+ 'temperature' => 0.7,
|
|
|
|
+ 'top_p' => 1,
|
|
|
|
+ "top_k"=> 50,
|
|
|
|
+ "frequency_penalty" => 0.5,
|
|
|
|
+ "n" => 1
|
|
];
|
|
];
|
|
|
|
|
|
// 3. 调用DeepSeek流式API
|
|
// 3. 调用DeepSeek流式API
|
|
- $response = Http::withHeaders($headers)->timeout(300)->send('POST', 'https://api.deepseek.com/chat/completions', [
|
|
|
|
|
|
+ $response = Http::withHeaders($headers)->timeout(300)->send('POST', $llmConfig['base_url'] , [
|
|
'json' => $body
|
|
'json' => $body
|
|
]);
|
|
]);
|
|
|
|
|