Commit Graph

70 Commits

Author SHA1 Message Date
Yuzhong Zhang
cdbca7ec62 优化dockerfile,增加docker-compose,async openai 2025-03-03 13:55:09 +08:00
Yuzhong Zhang
48d58ef2e8 异步生成完成 2025-03-03 13:41:06 +08:00
Toddy
8d48db026c chore: add system instruction to enhance compliance with function call 2025-02-27 10:35:25 +00:00
Toddy
18a5fe6109 fix: adapt gemini format 2025-02-27 07:35:12 +00:00
Toddy
348cbbdf2a feat: support function call 2025-02-27 05:36:39 +00:00
yinpeng
d566c28fa2 feat(gemini): 添加 API 密钥验证功能
- 在 gemini_routes.py 中添加 verify_key 路由,用于验证 API 密钥的有效性
- 在 keys_status 页面中添加验证按钮和相关逻辑
- 优化 keys_status 页面的样式,增加密钥验证相关 CSS 类
- 在 config.py 中添加 TEST_MODEL 设置,用于密钥验证测试
2025-02-15 01:00:47 +08:00
yinpeng
7b433aab91 refactor(static): 将 CSS 和 JS 代码分离到单独的文件中
- 将 auth.html 中的 CSS 代码提取到 auth.css 文件中
- 将 auth.html 中的 JS 代码提取到 auth.js 文件中
- 更新 auth.html,引入外部的 CSS 和 JS 文件
- 新增 keys_status.css 和 keys_status.js 文件,用于 keys_status 页面
2025-02-14 00:21:28 +08:00
yinpeng
fc7280bb18 feat: 优化滚动按钮显示逻辑,监听容器高度变化自动切换 2025-02-13 01:05:30 +08:00
yinpeng
8d9c99bda2 feat: 优化密钥状态页面滚动体验,添加容器滚动和渐变按钮样式 2025-02-13 00:49:44 +08:00
yinpeng
c3e0d4b64f feat: 添加页面底部版权信息和作者链接 2025-02-12 23:34:18 +08:00
yinpeng
5b7f4de63c feat: 优化密钥状态页面交互体验,添加分组折叠和刷新功能 2025-02-12 18:55:44 +08:00
yinpeng
ede27a5d70 refactor: 移除 retry_handler 中未使用的 KeyManager 导入 2025-02-12 17:48:09 +08:00
yinpeng
5a4619444b fix: 修复 Gemini 多段文本响应内容拼接问题 2025-02-12 17:47:03 +08:00
yinpeng
b3851441f1 refactor: 优化 RetryHandler 装饰器以支持动态 KeyManager 注入 2025-02-12 17:10:02 +08:00
yinpeng
44f956e4e4 feat: Add PWA support with manifest and ServiceWorker integration
- Mounted static files directory to serve PWA assets like manifest.json and ServiceWorker scripts.
- Updated `auth.html` and `keys_status.html` templates:
  - Added `<link>` for manifest and icons to support Progressive Web App (PWA) features.
  - Added meta tags for theme color and Apple web app capabilities.
  - Integrated ServiceWorker registration script for offline capabilities.
2025-02-12 16:20:34 +08:00
yinpeng
3aa4384b9d feat: Add responsive styles for auth and keys status pages
- Implement media queries to improve layout and UI for smaller screen sizes on `auth.html` and `keys_status.html`.
- Adjust container widths, font sizes, padding, and other styles for screen widths below 768px and 480px.
- Enhance mobile usability by making elements stack vertically, resizing fonts, and optimizing spacing for better readability and interaction.
2025-02-12 15:46:37 +08:00
yinpeng
6db4b56186 Refactor keys_status.html for improved layout and scrolling behavior
- Removed duplicated padding and simplified CSS for `body`, ensuring proper spacing with 20px padding.
- Adjusted `.container` styles:
  - Removed custom scrollbar styles and overflow-related attributes.
  - Centered the element with `margin: 20px auto`.
- Updated scroll behavior:
  - Changed scroll functions to operate on `window` instead of `.container`.
  - Modified event listeners to use `window` for detecting scroll events.
- Cleaned up redundant or unused styles and improved readability.
2025-02-12 15:30:44 +08:00
yinpeng
8e77773d5a Enhance UI/UX for keys_status.html
- Added smooth scroll functionality with "Scroll to Top" and "Scroll to Bottom" buttons.
- Introduced a `scroll-buttons` section with styled buttons for scrolling.
- Improved `#copyStatus` styling for better visibility and alignment.
- Adjusted `.container` to support scrollable content with hidden scrollbars and a max-height.
- Ensured proper z-index for new elements to prevent overlapping issues.
- Enhanced hover and active states for scroll buttons to improve user experience.
- Added event listeners to dynamically show/hide scroll buttons based on user scroll position.
2025-02-12 15:16:22 +08:00
yinpeng
343f40476a feat: Improve UI/UX for API Key Status page and add enhancements
- Updated the overall design aesthetics of the authentication page.
  - Added `fadeIn`, `slideDown`, `slideUp`, and `shake` animations for better user interaction.
  - Improved error message styling with a subtle background, padding, and animation.

- Enhanced "API Key Status" page:
  - Implemented new theme with gradient backgrounds and glassmorphism effect.
  - Redesigned headings with underlines and improved hierarchy.
  - Added FontAwesome icons to improve the visual appeal and clarity (e.g., checkmarks, warnings, keys).
  - Applied better spacing, padding, and hover effects to list items and buttons.
  - Introduced animations for key lists to create fluid transitions on page load.
  - Differentiated valid and invalid keys using badges with appropriate colors and icons.

- Copy Key Interaction:
  - Improved key copying functionality:
    - Added animations and hover effects to "Copy" buttons.
    - Updated the copied key selector logic to target `.key-text` for cleaner code.
    - Changed copy confirmation message for better clarity.
  - Styled the copy success message (`#copyStatus`) to appear fixed at the bottom with a blur effect.

- Key List Enhancements:
  - Added fail count badges for individual keys with red warning styles.
  - Styled buttons for batch copying to display icons alongside text, matching the overall design.

- Accessibility and Readability:
  - Refactored text sizes, weights, and alignments for smoother readability.
  - Enhanced color contrast and alignment for better accessibility.

Notes:
- New CSS animations have been smoothly integrated with no breaking changes.
- All changes prioritize maintaining current functionality while enhancing user experience.
2025-02-12 14:46:34 +08:00
yinpeng
17f1355099 feat: 增强应用日志记录并优化错误处理 2025-02-11 21:32:21 +08:00
yinpeng
e6bf45d778 refactor: 移除静态文件配置和相关依赖 2025-02-11 20:55:13 +08:00
yinpeng
8c9b802016 feat: 添加Web验证页面并优化密钥管理功能 2025-02-11 20:45:49 +08:00
yinpeng
d1f8a98ad0 feat: 支持在图片生成提示词中通过标记控制参数 2025-02-11 06:10:55 +08:00
yinpeng
30858937b5 feat: 支持图片生成响应格式切换并优化Markdown渲染 2025-02-11 05:13:36 +08:00
yinpeng
0aefd4c03a feat: 添加OpenAI消息转换器组件 2025-02-11 04:27:17 +08:00
yinpeng
97b9b99235 feat: 根据模型类型选择不同的API密钥处理聊天请求 2025-02-11 04:20:28 +08:00
yinpeng
34a98389f5 fix: 修复图片生成模型重复添加的问题 2025-02-11 02:55:39 +08:00
yinpeng
4a73592f0e chore: 设置默认图片生成模型为imagen-3.0-generate-002 2025-02-11 02:46:23 +08:00
yinpeng
a74ac03836 feat: 添加图片生成功能及相关配置
- 添加图片生成相关配置和环境变量
- 新增图片上传服务和模型定义
- 扩展模型服务以支持图片生成模型
- 添加图片生成响应处理器
- 更新README文档以反映新功能
- 添加GitHub Actions发布工作流
2025-02-11 01:59:16 +08: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
b60b063034 refactor: 修改安全设置逻辑以匹配特定模型 2025-02-06 00:33:11 +08:00
yinpeng
b465fd1598 refactor: 将MAX_FAILURES配置移至settings并更新KeyManager以使用该配置 2025-02-04 21:51:11 +08:00
yinpeng
97e601a176 refactor: 修改模型检查逻辑以提高代码可读性 2025-01-22 14:29:07 +08:00
yinpeng
6ee3b485a4 bugfix: 为安全设置添加HARM_CATEGORY_CIVIC_INTEGRITY类别 2025-01-20 17:41:10 +08:00
yinpeng
6e0c7c2799 feat: 调整安全设置以关闭公民诚信类别的阈值 2025-01-20 16:44:56 +08:00
yinpeng
87f1147fca feat: 调整安全设置以关闭公民诚信类别的阈值 2025-01-20 15:46:38 +08:00
yinpeng
0a9de39143 feat: 根据模型版本调整安全设置逻辑 2025-01-18 23:22:39 +08:00
yinpeng
9f9197f8c8 feat: 为v1beta API添加路由 2024-12-27 20:19:51 +08:00
yinpeng
870b1ecc17 feat: 添加重试机制和消息转换器,并支持Gemini v1beta API 2024-12-27 20:07:43 +08:00
yinpeng
6e90463251 fix: 修复异步请求读取错误内容的方法 2024-12-25 17:37:30 +08:00
yinpeng
a059c4d586 feat: 更新 Gemini 模型列表并优化思考过程展示 2024-12-25 16:04:09 +08:00
yinpeng
9578704cfd feat: 为API添加统一的鉴权token 2024-12-25 01:26:39 +08:00
yinpeng
9d5a99583d feat: 优化 Gemini 模型思考过程展示逻辑 2024-12-25 00:36:32 +08:00
yinpeng
5a1c3bdbe7 feat: 优化 Gemini 模型思考过程的展示 2024-12-24 23:27:20 +08:00
yinpeng
98ba46f779 feat: 将 Gemini API 连接超时时间统一调整为 300 秒 2024-12-21 23:16:47 +08:00
yinpeng
33a5f9d89f fix: 修复 OpenAI 和 Gemini API 调用重试逻辑及日志记录 2024-12-21 02:27:59 +08:00
yinpeng
80bcaf5cd4 feat: 优化 Gemini 模型配置和请求参数 2024-12-21 00:42:08 +08:00
yinpeng
c8124d5d32 fix: 修复 Gemini 模型工具和流式请求错误处理 2024-12-20 10:26:16 +08:00
yinpeng
8dfe617468 feat: 将 Gemini API 调用迁移至 ChatService 并支持 API Key 验证 2024-12-18 21:35:49 +08:00
yinpeng
914922624e fix: 将 Gemini API 连接超时时间统一调整为 60 秒 2024-12-18 20:10:03 +08:00