|
@@ -261,11 +261,11 @@ class AgentService:
|
|
|
logger.warning(f"staff[{agent.staff_id}] user[{user_id}]: no response generated")
|
|
|
return None
|
|
|
|
|
|
- def _call_chat_api(self, chat_config: Dict) -> str:
|
|
|
+ def _call_chat_api(self, chat_config: Dict, chat_service_type: ChatServiceType) -> str:
|
|
|
if configs.get().get('debug_flags', {}).get('disable_llm_api_call', False):
|
|
|
return 'LLM模拟回复 {}'.format(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
|
|
- if self.chat_service_type == ChatServiceType.OPENAI_COMPATIBLE:
|
|
|
- if chat_config['use_multimodal_model']:
|
|
|
+ if chat_service_type == ChatServiceType.OPENAI_COMPATIBLE:
|
|
|
+ if chat_config.get('use_multimodal_model', False):
|
|
|
chat_completion = self.multimodal_model_client.chat.completions.create(
|
|
|
messages=chat_config['messages'],
|
|
|
model=self.multimodal_model_name,
|
|
@@ -273,10 +273,10 @@ class AgentService:
|
|
|
else:
|
|
|
chat_completion = self.text_model_client.chat.completions.create(
|
|
|
messages=chat_config['messages'],
|
|
|
- model=self.text_model_client,
|
|
|
+ model=self.text_model_name,
|
|
|
)
|
|
|
response = chat_completion.choices[0].message.content
|
|
|
- elif self.chat_service_type == ChatServiceType.COZE_CHAT:
|
|
|
+ elif chat_service_type == ChatServiceType.COZE_CHAT:
|
|
|
bot_user_id = 'qywx_{}'.format(chat_config['user_id'])
|
|
|
response = self.coze_client.create(
|
|
|
chat_config['bot_id'], bot_user_id, chat_config['messages'],
|