Commit Graph

1912 Commits

Author SHA1 Message Date
CalciumIon
58fac129d6 feat: Enhance GeminiChatHandler to include RelayInfo
- Updated the GeminiChatHandler function to accept an additional parameter, RelayInfo, allowing for better context handling during chat operations.
- Modified the DoResponse method in the Adaptor to pass RelayInfo to GeminiChatHandler, ensuring consistent usage of upstream model information.
- Enhanced the GeminiChatStreamHandler to utilize the upstream model name from RelayInfo, improving response accuracy and data representation in Gemini requests.
2024-12-23 00:02:15 +08:00
CalciumIon
241c9389ef refactor: Remove unused context and logging in CovertGemini2OpenAI function
- Eliminated the unused `context` import and the logging of `geminiRequest` in the `CovertGemini2OpenAI` function, improving code cleanliness and reducing unnecessary overhead.
- This change enhances the maintainability of the code by removing redundant elements that do not contribute to functionality.
2024-12-22 23:54:11 +08:00
CalciumIon
1d0ef89ce9 feat: Add FunctionResponse type and enhance GeminiPart structure
- Introduced a new `FunctionResponse` type to encapsulate function call responses, improving the clarity of data handling.
- Updated the `GeminiPart` struct to include the new `FunctionResponse` field, allowing for better representation of function call results in Gemini requests.
- Modified the `CovertGemini2OpenAI` function to handle tool calls more effectively by setting the message role and appending function responses to the Gemini parts, enhancing the integration with OpenAI and Gemini systems.
2024-12-22 23:53:25 +08:00
CalciumIon
a7e1d17c3e feat: Introduce settings package and refactor constants
- Added a new `setting` package to replace the `constant` package for configuration management, improving code organization and clarity.
- Moved various configuration variables such as `ServerAddress`, `PayAddress`, and `SensitiveWords` to the new `setting` package.
- Updated references throughout the codebase to use the new `setting` package, ensuring consistent access to configuration values.
- Introduced new files for managing chat settings and midjourney settings, enhancing modularity and maintainability of the code.
2024-12-22 17:24:29 +08:00
CalciumIon
c4e256e69b refactor: Update Message methods to use pointer receivers
- Refactored ParseToolCalls, SetToolCalls, IsStringContent, and ParseContent methods in the Message struct to use pointer receivers, improving efficiency and consistency in handling mutable state.
- Enhanced code readability and maintainability by ensuring all relevant methods operate on the pointer receiver, aligning with Go best practices.
2024-12-22 16:30:18 +08:00
CalciumIon
87a5e40daf refactor: Update SetToolCalls method to use pointer receiver
- Changed the SetToolCalls method to use a pointer receiver for the Message struct, allowing for modifications to the original instance.
- This change improves the method's efficiency and aligns with Go best practices for mutating struct methods.
2024-12-22 16:22:55 +08:00
CalciumIon
0c326556aa refactor: Update OpenAI request and message handling
- Changed the type of ToolCalls in the Message struct from `any` to `json.RawMessage` for better type safety and clarity.
- Introduced ParseToolCalls and SetToolCalls methods to handle ToolCalls more effectively, improving code readability and maintainability.
- Updated the ParseContent method to work with the new MediaContent type instead of MediaMessage, enhancing the structure of content parsing.
- Refactored Gemini relay functions to utilize the new ToolCalls handling methods, streamlining the integration with OpenAI and Gemini systems.
2024-12-22 16:20:30 +08:00
Calcium-Ion
794f6a6e34 Merge pull request #648 from palboss/main
解决  #534 用户管理-管理用户-查询报错 (SQLSTATE 42601)-postgresql
2024-12-22 14:37:34 +08:00
CalciumIon
656e809202 refactor: Simplify Gemini function parameter handling
- Removed redundant checks for non-empty properties in function parameters.
- Set function parameters to nil when no properties are needed, streamlining the logic for handling Gemini requests.
- Improved code clarity and maintainability by eliminating unnecessary complexity.
2024-12-22 14:35:21 +08:00
CalciumIon
53ab2aaee4 feat: Enhance Gemini function parameter handling
- Added logic to ensure that function parameters have non-empty properties.
- Implemented checks to add a default empty property if no parameters are needed.
- Updated the required field to match existing properties, improving the robustness of the Gemini function integration.
2024-12-22 14:29:14 +08:00
borland
a02bc3342f Update user.go 2024-12-22 00:03:00 +08:00
borland
f54d0cb3b0 Update user.go 2024-12-22 00:02:28 +08:00
CalciumIon
a5c48c2772 feat: Enhance LogsTable to render group information
- Added `renderGroup` function to improve the display of log data by rendering the 'group' information in the LogsTable component.
- Updated the rendering logic to utilize the new function, enhancing the UI's clarity and usability for grouped logs.
2024-12-21 20:28:26 +08:00
CalciumIon
cffaf0d636 feat: Add log information generation and enhance LogsTable component
- Introduced `log_info_generate.go` to implement functions for generating various log information, including text, WebSocket, and audio details.
- Enhanced `LogsTable` component to display the 'group' information from the log data, improving the visibility of grouped logs in the UI.
2024-12-21 20:24:22 +08:00
CalciumIon
865b98a454 Merge branch 'feat/o1'
# Conflicts:
#	dto/openai_request.go
2024-12-21 16:45:45 +08:00
Calcium-Ion
5bdbf3a673 Merge pull request #645 from MartialBE/gemini_res_format
支持gemini结构化输出
2024-12-21 16:40:51 +08:00
MartialBE
43a7b59b68 feat: support for Gemini structured output. 2024-12-21 16:01:17 +08:00
HynoR
eac3463401 Merge remote-tracking branch 'origin/feat/o1' into feat/o1 2024-12-20 23:14:20 +08:00
HynoR
1fa478af20 feat: 适配o1模型 2024-12-20 23:14:10 +08:00
TAKO
3b58b4989d Merge branch 'Calcium-Ion:main' into feat/o1 2024-12-20 22:12:26 +08:00
HynoR
0b1ba2eeb9 feat: 适配o1模型 2024-12-20 22:09:02 +08:00
HynoR
35277f2b4a feat: 适配o1模型 2024-12-20 22:07:53 +08:00
CalciumIon
03256dbdad refactor: Enhance error handling in Gemini request conversion
- Updated `CovertGemini2OpenAI` function to return an error alongside the GeminiChatRequest, improving error reporting for image processing.
- Modified `ConvertRequest` methods in both `adaptor.go` files to handle potential errors from the Gemini conversion, ensuring robust request handling.
- Improved clarity and maintainability of the code by explicitly managing error cases during request conversion.
2024-12-20 21:50:58 +08:00
CalciumIon
f9a7f6085e feat: Add GEMINI_VISION_MAX_IMAGE_NUM configuration
- Introduced `GEMINI_VISION_MAX_IMAGE_NUM` to README files for better user guidance.
- Updated `env.go` to retrieve the maximum image number from environment variables, defaulting to 16.
- Modified image handling logic in `relay-gemini.go` to respect the new configuration, allowing disabling of the limit by setting it to -1.
- Removed hardcoded constant for maximum image number in `constant.go` to streamline configuration management.
2024-12-20 21:36:23 +08:00
Calcium-Ion
c289694fe8 Merge pull request #636 from HynoR/fix/smfix
fix: 修复添加模型切换模式时,初始化空值导致的判断问题
2024-12-20 20:33:01 +08:00
Calcium-Ion
c37319cb4c Merge pull request #641 from HynoR/main
chore: 更新遗漏的gemini模型
2024-12-20 20:32:47 +08:00
Calcium-Ion
57f036747b Merge pull request #642 from MartialBE/fix_gemini_thinking
fix: 修复gemini thinking在stream下会内容丢失
2024-12-20 20:32:23 +08:00
MartialBE
158edab974 fix: Fix the issue where Gemini loses content when converting OpenAI format in the stream. 2024-12-20 20:24:49 +08:00
HynoR
f3a7119745 chore: 更新gemini模型 2024-12-20 19:17:56 +08:00
HynoR
3fa1d93b9c chore: 更新gemini模型 2024-12-20 19:14:53 +08:00
TAKO
5e3ba45748 Merge branch 'Calcium-Ion:main' into fix/smfix 2024-12-20 19:11:32 +08:00
CalciumIon
cab30014ad feat: Add new experimental Gemini versions to ModelList
- Included additional versions: "gemini-2.0-flash-thinking-exp" and "gemini-2.0-flash-thinking-exp-1219".
- Added comments to categorize versions as old, experimental, and flash experimental for better clarity.
2024-12-20 13:26:51 +08:00
CalciumIon
9a54b345c5 feat: support gemini-2.0-flash-thinking #639 #637 2024-12-20 13:20:07 +08:00
HynoR
e3a0162206 fix: 修复添加模型切换模式时,初始化空值导致的判断问题 2024-12-19 19:08:04 +08:00
CalciumIon
2d865eb735 refactor: Improve channel status update logic and clean up code
- Simplified conditional checks in UpdateChannelStatusById function in channel.go to enhance readability.
- Commented out unused image number check in relay-gemini.go for clarity.
- Updated JSON field in en.json for currency consistency, changing "元" from "RMB/CNY" to "CNY" and added a space in "实付金额:" for formatting.
2024-12-17 15:33:16 +08:00
Calcium-Ion
70e7860838 Merge pull request #631 from xqx333/main
fix
2024-12-17 14:39:39 +08:00
xqx333
1f4fc2d590 Update channel.go 2024-12-17 14:30:31 +08:00
Calcium-Ion
c76021e9a1 Merge pull request #630 from xqx333/main
修复自动禁用会对数据库进行多次更新的问题
2024-12-17 12:22:27 +08:00
xqx333
173c9bc669 Update channel.go 2024-12-17 12:11:24 +08:00
xqx333
739c0cc334 Update cache.go 2024-12-17 12:10:05 +08:00
CalciumIon
4163713714 refactor: Update SystemInstructions type in GeminiChatRequest and adjust handling in CovertGemini2OpenAI
- Changed SystemInstructions from *GeminiPart to *GeminiChatContent in GeminiChatRequest for improved structure.
- Updated CovertGemini2OpenAI function to accommodate the new SystemInstructions type, ensuring proper handling of message content.
2024-12-16 22:41:23 +08:00
CalciumIon
76acfdc9e2 fix: Correct JSON field name for SystemInstructions in GeminiChatRequest
- Updated the JSON field name from "system_instructions" to "system_instruction" to ensure consistency and accuracy in the data structure.
2024-12-16 22:12:56 +08:00
CalciumIon
fe6f3d7978 feat: Enhance Home component to support language messaging
- Added language messaging functionality to the iframe in the Home component.
- This update ensures that the iframe receives the current language setting, improving localization support.
2024-12-16 21:10:46 +08:00
Calcium-Ion
1f70904fc5 Merge pull request #628 from Calcium-Ion/pr482-merge
merge 428
2024-12-16 21:05:58 +08:00
CalciumIon
fd86de19b5 feat: Enhance HeaderBar to support language change messaging
- Added functionality to post a message to the iframe when the language is changed.
- This update improves localization support by ensuring that the iframe content updates according to the selected language.
2024-12-16 21:05:02 +08:00
CalciumIon
c8f437c13a Merge remote-tracking branch 'guoruqiang/main' into pr482-merge
# Conflicts:
#	README.md
#	web/src/components/HeaderBar.js
#	web/src/components/SiderBar.js
2024-12-16 20:56:53 +08:00
CalciumIon
e6c6bbdef9 feat: support gemini SystemInstructions #408 2024-12-16 20:19:29 +08:00
CalciumIon
aab3887d2c Update README.md 2024-12-16 18:12:17 +08:00
Calcium-Ion
25ab1d400f Merge pull request #625 from QAbot-zh/fix/bindwechat
fix bindWeChat tips
2024-12-15 20:59:47 +08:00
Q.A.zh
6c995d4bd9 fix bindWeChat tips 2024-12-15 12:53:16 +00:00