lh 3 dias atrás
pai
commit
404444d2a8
1 arquivos alterados com 4 adições e 11 exclusões
  1. 4 11
      app/Services/DeepSeek/DeepSeekService.php

+ 4 - 11
app/Services/DeepSeek/DeepSeekService.php

@@ -36,13 +36,8 @@ class DeepSeekService
             'Authorization' => 'Bearer '.$this->api_key,
             'Content-Type'  => 'application/json; charset=UTF-8'
         ];
-        // 火山引擎模型映射:模型名称 => endpoint_id
-        $this->valid_text_models = [
-            'doubao-seed-2-0-pro-260215' => env('VOLC_DOUBAO_PRO_ENDPOINT', 'doubao-seed-2-0-pro-260215'),
-            'doubao-seed-2-0-lite-260215' => env('VOLC_DOUBAO_LITE_ENDPOINT', 'doubao-seed-2-0-lite-260215'),
-            'doubao-seed-2-0-mini-260215' => env('VOLC_DOUBAO_MINI_ENDPOINT', 'doubao-seed-2-0-mini-260215'),
-            'deepseek-v3-2-251201' => env('VOLC_DEEPSEEK_V3_ENDPOINT', 'deepseek-v3-2-251201')
-        ];
+        // 火山引擎模型列表
+        $this->valid_text_models = DB::table('mp_text_models')->where('is_enabled', 1)->pluck('model')->toArray();
         $this->sys_message = [
                 'role'    => 'system',
                 'content' => "你是一个专业的文档分析助手及资深编剧,请根据用户提供的文档内容完成示例格式的内容输出(需通过以下几个板块进行回复: <故事梗概><剧本亮点><人物关系><核心矛盾><主体列表><美术风格><场景列表><分集剧本>,每个板块之间用###分隔;同时板块之间需满足以下要求:\n
@@ -265,10 +260,8 @@ class DeepSeekService
         if (in_array($model, ['deepseek-reasoner', 'deepseek-chat'])) {
             // DeepSeek 官方模型使用 DeepSeek API
             return $this->deepSeekStreamResponse($post_data);
-        } else if (array_key_exists($model, $this->valid_text_models)) {
+        } else if (in_array($model, $this->valid_text_models)) {
             // 火山引擎支持的模型使用火山引擎 API
-            // 将模型名称转换为 endpoint_id
-            $post_data['model'] = $this->valid_text_models[$model];
             return $this->volcEngineChatCompletion($post_data);
         } else {
             Utils::throwError('20003:不支持的模型: ' . $model);
@@ -4437,7 +4430,7 @@ class DeepSeekService
             'messages' => $params['messages'] ?? [],
         ];
 
-        if (!array_key_exists($requestData['model'], $this->valid_text_models)) {
+        if (!in_array($requestData['model'], $this->valid_text_models)) {
             Utils::throwError('20003:该模型不支持!');
         }