Commit graph

24 commits

Author SHA1 Message Date
Max
38ee806cff Refactor OpenAI message parsing for improved streaming support
- Completely restructure NewOpenAI method to handle different message types more robustly
- Add support for new ChatCompletionChunk type to parse streaming responses
- Improve error handling and message type detection
- Simplify message processing logic with more explicit type checking
- Remove commented-out legacy code and improve overall readability
2025-02-09 09:46:41 +08:00
Max
a278c4c63a Update OpenAI test and API configuration
- Replace deprecated model "text-davinci-003" with "gpt-3_5-turbo-instruct"
- Comment out deprecated Edits method in tests and implementation
- Enhance HTTP request headers with explicit Content-Type
- Add fallback for model configuration when not explicitly set
- Improve header handling for Azure and standard OpenAI authentication
2025-02-08 15:59:46 +08:00
Max
a7a05fbec8 Add Azure OpenAI support and improve message parsing
- Implement Azure OpenAI authentication with `azure` flag in OpenAI struct
- Update HTTP request headers to support Azure API key authentication
- Enhance message parsing to handle additional edge cases in OpenAI responses
- Add debug logging for OpenAI messages when debug environment is set
- Improve error and usage detection in stream message processing
2025-02-08 11:18:06 +08:00
Max
9c0ab4e0e1 Configure base URL for OpenAI API initialization
- Added default base URL "/v1" in NewMoapi method
- Supports flexible base URL configuration for OpenAI API client
- Complements previous work on API configuration and streaming improvements
2025-02-06 09:19:10 +08:00
Max
96f4b5e55a Add support for reasoning content and thinking state in OpenAI streaming
- Implemented handling of reasoning_content in OpenAI message parsing
- Added support for tracking thinking state with `<think>` tags
- Updated message generation to handle delta messages and thinking states
- Modified OpenAI API to support flexible base URL configuration
- Enhanced token scanning and message processing for reasoning content
2025-02-05 16:55:09 +08:00
Max
6ac0406ad4 Improve OpenAI message parsing and error handling
- Enhanced error handling in OpenAI message processing
- Added colored console output for JSON parsing errors
- Updated Error struct to support flexible code type
- Improved message type and done state setting for various error scenarios
- Added support for parsing different error message formats
2025-02-01 11:26:11 +08:00
Max
17c18e7d56 Refactor Neo API assistant to enhance vision support and message handling
- Updated the Assistant struct to include a vision capability flag and an init hook indicator, allowing for better management of vision-enabled functionalities.
- Refactored message handling throughout the assistant methods to utilize the chatMessage package, improving consistency and type safety.
- Enhanced the handleVision method to support dynamic vision processing options, including improved handling of image descriptions and uploads.
- Streamlined the requestMessages and withAttachments methods to better accommodate vision capabilities, ensuring proper integration with image handling.
- Improved the initialize method to check for vision support based on the model, enhancing the assistant's adaptability.

These changes improve the robustness and maintainability of the Neo API, paving the way for enhanced assistant functionalities and better integration of vision capabilities.
2025-01-17 15:16:26 +08:00
Max
e7185aad10 Enhance Neo API assistant with function support and improved message handling
- Introduced a new Function type to define assistant functions, enhancing the assistant's capabilities.
- Updated the Assistant struct to include a Functions field, allowing for dynamic function management.
- Refactored the streamChat method to handle tool calls, improving interaction with functions during chat streaming.
- Enhanced message handling in the NewOpenAI function to support tool call responses, ensuring proper message parsing.
- Implemented loading and saving of functions from a JSON file, streamlining function management within the assistant.

These changes improve the robustness and maintainability of the Neo API, paving the way for more flexible and powerful assistant functionalities.
2025-01-15 11:20:55 +08:00
Max
c98a402e54 Refactor Neo API chat handling to improve AI interaction and error management. Introduce background processing for chat with AI, enhancing responsiveness and client handling. Update assistant initialization logic to streamline the creation of OpenAI assistants and ensure proper error handling. Modify message struct to support structured error responses, improving clarity in communication. Additionally, clean up unused code and enhance overall maintainability of the assistant management system. 2024-12-14 17:45:40 +08:00
Max
13a343a7f4 Remove unused utils import and clean up ImagesGenerations function 2024-11-07 17:03:58 +08:00
Max
953d592669 feat: Integrate AIGC & OpenAI with Moapi service 2024-07-30 16:59:13 +08:00
Max
0a9c0167dd [add] chat.completions ( dev ) 2023-11-12 04:11:56 +08:00
Max
c19d4b0534 [add] moapi process and api 2023-11-10 01:37:09 +08:00
Max
4530aeab2f Improve neo error messages 2023-05-15 19:59:35 +08:00
Max
1d102f110b [add] openai process 2023-05-12 22:11:31 +08:00
Max
538c6c063a [add] openai.* process 2023-05-12 21:47:18 +08:00
Max
7ee7de96c9 [add] Neo (70%) 2023-04-30 14:21:45 +08:00
Max
60ef6c1e5c [add] neo (50%) 2023-04-29 16:48:37 +08:00
Max
894c574db4 [add] aigc widget done 2023-04-27 22:31:51 +08:00
Max
7e480633d4 [add] openai api done 2023-04-27 12:20:47 +08:00
Max
4ee38de7e7 [fix] tests 2023-04-26 19:39:15 +08:00
Max
4e37119714 [_] 2023-04-26 19:23:38 +08:00
Max
52a15bab2f [add] open ai api 2023-04-26 19:16:59 +08:00
Max
2a36edf891 [add] openai processes 2023-04-09 18:41:04 +08:00