Commit Graph
10 Commits
Author SHA1 Message Date
snaily 985a12554d fix:修改OpenAI消息转换器中assistant消息处理逻辑,将特殊处理的目标从最后一条消息调整为倒数第二条消息。 2025-03-15 21:18:20 +08:00
snaily 37a7a140fc feat:改进消息转换器中的图像处理和消息分割逻辑
添加 _get_mime_type_and_data 函数从 base64 字符串中提取 MIME 类型和数据
修改 _convert_image 函数使用动态检测的 MIME 类型,而非硬编码
将 _process_text_with_image 中的 MIME 类型从 image/jpeg 改为 image/png
简化异常处理逻辑
优化 OpenAIMessageConverter 中的消息分割逻辑,仅对最后一个 assistant 消息进行分割处理
2025-03-15 21:11:10 +08:00
zhanghaoyu 28e67cc3fa 1. modify IMAGE_URL_PATTERN
2. modify import
2025-03-15 12:37:56 +08:00
zhanghaoyu7 d99a0bde93 feat: 新增图文上下文同步 2025-03-14 16:29:03 +08:00
Toddy 16c28bf1ba combine multiple system instructions into one 2025-03-14 02:55:29 +00:00
Toddy 7b5b6c7d4c if role is tool then set to user 2025-03-03 08:23:04 +00:00
Toddy 8d48db026c chore: add system instruction to enhance compliance with function call 2025-02-27 10:35:25 +00:00
Toddy 348cbbdf2a feat: support function call 2025-02-27 05:36:39 +00:00
yinpeng cd45f4b5ab refactor: 重构Gemini和OpenAI聊天服务以支持工具和安全设置
- 将 `_build_payload`、`_build_tools`、`_get_safety_settings` 和 `_has_image_parts` 函数从 `OpenAIChatService` 和 `GeminiChatService` 类中提取为独立的函数。
- 将 `_handle_stream_response` 和 `_handle_normal_response` 函数从 `GeminiResponseHandler` 和 `OpenAIResponseHandler` 类中提取为独立的函数。
- 将 `_extract_text` 函数从 `OpenAIResponseHandler` 类中提取为独立的函数, 并在 `GeminiResponseHandler` 中复用。
- 将 `_convert_image` 函数从 `OpenAIMessageConverter` 类中提取为独立的函数。
- 优化 `OpenAIChatService` 和 `GeminiChatService` 中的代码结构, 使其更清晰。
- 优化 `app/api/openai_routes.py` 和 `app/api/gemini_routes.py` 中的路由函数, 移除不必要的参数。
2025-02-06 21:35:19 +08:00
yinpeng 870b1ecc17 feat: 添加重试机制和消息转换器,并支持Gemini v1beta API 2024-12-27 20:07:43 +08:00