Commit graph

2008 commits

Author SHA1 Message Date
Max
238347c834 Refactor message handling and enhance file reading capabilities in Neo API
- Updated the message handling logic to improve error reporting and content management, ensuring more robust communication with clients.
- Introduced a new ReadBase64 method in both Local and OpenAI assistant implementations to read files and return their base64 encoded content, enhancing file handling capabilities.
- Removed the deprecated JSON message handling code, streamlining the message processing structure.
- Refactored message struct to include new fields and methods for better data management and response handling.
- Improved the chat functionality to handle attachments and user messages more effectively, ensuring a smoother user experience.
2024-12-31 16:01:48 +08:00
Max
882277d974 Enhance assistant filtering and management in Neo API
- Added support for filtering assistants by keywords, connector, and mentionable status in the handleAssistantList function.
- Introduced a new parseBoolValue utility function to handle various boolean formats for filtering.
- Updated the AssistantFilter structure to include an AssistantID field and a Select field for specifying returned fields.
- Refactored process functions to replace 'add' with 'create' for consistency and clarity in assistant management.
- Implemented new processAssistantFind function to retrieve assistants by ID, improving data retrieval capabilities.
- Enhanced tests to cover new filtering options and ensure robust functionality across assistant management operations.
2024-12-29 17:30:33 +08:00
Max
94f3ddb158 Enhance assistant management and JSON field handling in Neo API
- Updated SaveAssistant and processAssistantAdd methods to return assistant IDs, improving response consistency.
- Implemented logic to handle JSON fields as both strings and native types, ensuring proper storage and retrieval of assistant attributes.
- Refactored tests to cover various JSON field formats, including string, native types, and nil values, enhancing test coverage and reliability.
- Improved the assistant management structure to support mixed JSON formats, ensuring robust functionality across different storage backends.
2024-12-29 17:14:01 +08:00
Max
af65a2d5fa Refactor assistant management and enhance API response structure
- Updated the assistant management functions to utilize a unified response structure, replacing the previous 'Items' field with 'Data' for consistency across the API.
- Refactored the handling of assistant mentions and details to streamline data processing, improving code readability and maintainability.
- Enhanced the AssistantResponse type to include pagination fields directly, facilitating better management of assistant data retrieval.
- Implemented new methods for adding, saving, deleting, and searching assistants, ensuring robust functionality across different storage backends.
- Updated tests to reflect changes in the assistant management logic and response structure, ensuring comprehensive coverage and reliability.
2024-12-29 12:57:17 +08:00
Max
de49788d52 Add utility endpoint for listing connectors in Neo API
- Introduced a new GET endpoint at `/utility/connectors` to list available connectors, enhancing the API's utility features.
- Implemented `handleConnectors` function to filter and format connector data, providing a structured response with labels and values for each connector.
- Updated documentation comments to include usage examples for the new endpoint, improving developer experience and usability.
2024-12-29 11:27:40 +08:00
Max
697facb23d Enhance Neo API with detailed endpoint examples and improved documentation
- Added comprehensive curl examples for all API endpoints, including chat management, assistant management, file handling, and generation functionalities.
- Improved comments throughout the code to clarify the purpose and usage of each endpoint, enhancing developer experience and usability.
- Organized endpoint descriptions into categories for better readability and understanding of the API structure.
2024-12-29 11:13:57 +08:00
Max
8fafdc5855 Enhance assistant management in Neo API and conversation module
- Added new endpoints for managing assistants: list, detail, save, and delete.
- Implemented filtering capabilities for assistants based on keywords, tags, mentionable status, and automation.
- Refactored the assistant structure to include new fields for better management and filtering.
- Removed obsolete test data file, streamlining the codebase.
- Updated tests to cover new assistant functionalities and filtering options, ensuring robust functionality.
2024-12-29 11:06:41 +08:00
Max
b17778afea Add assistant management functionality in conversation module
- Introduced SaveAssistant, DeleteAssistant, and GetAssistants methods across Mongo, Redis, and Weaviate implementations to manage assistant records.
- Enhanced the AssistantFilter and AssistantResponse types for improved pagination and filtering capabilities.
- Updated the conversation interface to include new assistant-related methods, ensuring consistent functionality across different storage backends.
- Added tests for assistant CRUD operations and pagination, ensuring robust functionality and reliability in managing assistants.
2024-12-29 10:03:38 +08:00
Max
8166503058 Refactor assistant table structure in Xun implementation
- Enhanced the assistant table by adding new fields: 'options', 'permissions', 'readonly', and 'automated', improving the management of assistant attributes.
- Updated the fields array to reflect the new structure, ensuring all fields are recognized as required attributes.
- Improved code readability by adding comments to clarify the purpose of each field.
2024-12-28 17:19:01 +08:00
Max
f022b79518 Add 'functions' field to assistant table in Xun implementation
- Introduced a new 'functions' field in the assistant table, enhancing the structure for better management of assistant capabilities.
- Updated the fields array to include 'functions', ensuring it is recognized as a required attribute in the assistant structure.
2024-12-20 16:24:00 +08:00
Max
6f6c0b3d6f Enhance assistant table structure by adding 'files' field
- Introduced a new 'files' field in the assistant table within the Xun implementation, allowing for better management of associated files.
- Updated the fields array to include the new 'files' field, ensuring it is recognized as a required attribute in the assistant structure.
2024-12-20 16:21:53 +08:00
Max
76e7156dac Refactor assistant structure and replace base assistant with local implementation
- Replaced the base assistant package with a local assistant implementation, enhancing modularity and maintainability.
- Updated the newAssistantByConnector function to utilize the local assistant, ensuring consistent error handling and improved functionality.
- Removed obsolete base assistant files, streamlining the codebase and reducing complexity.
- Added a new 'mentionable' field to the assistant table in the Xun implementation, allowing for better management of assistant visibility in mentions.
2024-12-20 15:48:28 +08:00
Max
af52dd35a1 Refactor conversation history handling and enhance Assistant structure
- Updated SaveHistory method across Mongo, Redis, and Weaviate to include a context parameter, improving flexibility in message storage.
- Modified the Assistant struct in types.go to add new fields: Type, Avatar, and Flows, enhancing the representation of assistant attributes.
- Adjusted the Xun implementation to support the new context handling in SaveHistory, ensuring messages can now include contextual information.
- Updated tests to reflect changes in message structure and ensure proper functionality with the new context parameter.
2024-12-20 12:30:31 +08:00
Max
33b28b50f4 Enhance SSE error handling in handleGenerateTitle method
- Added support for Server-Sent Events (SSE) in the handleGenerateTitle function to send error messages in the appropriate SSE format when invalid request bodies are encountered.
- Updated response headers for SSE requests to ensure correct content type and connection settings, improving the API's handling of real-time updates and error reporting.
2024-12-19 17:15:44 +08:00
Max
c1e95374f2 Update GenerateChatTitle method to include silent mode in chat handling
- Modified the handleChatUpdate function to pass an additional parameter for silent mode when generating chat titles, enhancing the flexibility of chat title generation.
- This change allows for improved handling of chat updates, ensuring that the API can better manage user expectations and interactions.
2024-12-19 16:52:43 +08:00
Max
a90d1d5a0a Enhance Neo API with new generation endpoints and improved SSE handling
- Added new GET and POST endpoints for generating custom content, chat titles, and prompts, expanding the API's capabilities.
- Implemented support for Server-Sent Events (SSE) in response handling, allowing for real-time updates and improved user experience.
- Refactored validation and error handling to differentiate between regular and SSE requests, ensuring appropriate responses based on the request type.
- Updated the GenerateWithAI method to support silent mode for regular HTTP requests, enhancing flexibility in content generation.
- Improved overall structure and maintainability of the API by consolidating request handling logic.
2024-12-19 16:27:51 +08:00
Max
fc1cbb2457 Add OPTIONS routes for new generation endpoints in Neo API
- Registered new OPTIONS routes for /generate, /generate/title, and /generate/prompts in the Neo API, enhancing CORS support for the recently introduced generation functionalities.
- This update ensures that the API can handle preflight requests for these endpoints, improving overall API usability and compliance with CORS standards.
2024-12-19 15:16:08 +08:00
Max
375ad96e9d Add generate endpoints and improve response handling in Neo API
- Introduced new API endpoints for generating custom content, chat titles, and prompts, enhancing the functionality of the Neo API.
- Implemented handleGenerateCustom, handleGenerateTitle, and handleGeneratePrompts methods to process generation requests with appropriate validation and error handling.
- Refactored the GenerateWithAI method to support different content types and system prompts, improving the flexibility of AI-generated responses.
- Updated the API router to include the new generation routes, ensuring seamless integration with existing middleware.
2024-12-19 15:13:38 +08:00
Max
ef6c39b87a
Merge pull request #811 from trheyi/main
Refactor Chat Assistant(50%)
2024-12-19 09:59:47 +08:00
Max
67c76fa933 Update go.mod and go.sum to upgrade golang.org/x/net to v0.33.0
- Updated the golang.org/x/net dependency from v0.27.0 to v0.33.0 in go.mod.
- Updated the corresponding checksums in go.sum to reflect the new version.
2024-12-19 09:56:43 +08:00
Max
35168845ae Enhance mentions handling in Neo API
- Convert keywords to lowercase for case-insensitive matching in handleMentions method.
- Introduce test data for mentions to improve testing and demonstration of functionality.
- Implement filtering of mentions based on keywords, allowing users to retrieve relevant mentions more effectively.
- Append test mentions to actual mentions before returning the response, enhancing the API's usability.
2024-12-17 18:45:16 +08:00
Max
13e17ae386 Enhance chat handling and API response in Neo
- Added time-based generation of chat IDs when not provided, improving chat session management.
- Updated context handling in handleChat to ensure valid chat IDs are used.
- Expanded allowed HTTP methods in CORS headers to include DELETE, enhancing API flexibility.
- Removed redundant chat history saving logic from GenerateChatTitle method, streamlining chat processing.
2024-12-17 17:04:22 +08:00
Max
9598d000cd Enhance chat retrieval in Xun by adding filtering and validation
- Updated GetChats method to filter out empty chat IDs, ensuring only valid chats are processed.
- Improved date handling by refining the logic for grouping chats into "This Week" and "Last Week" categories.
- Enhanced error handling for created_at field parsing, supporting multiple date formats for better robustness.
- Streamlined chat grouping logic for clearer organization of chat data in responses.
2024-12-17 11:18:00 +08:00
Max
fe8b3df163 Add chat deletion endpoints and handlers in Neo API
- Introduced new API endpoints for deleting individual chats and clearing all chats for a user, enhancing chat management capabilities.
- Implemented handleChatDelete and handleChatsDeleteAll methods to process deletion requests, including error handling for missing session and chat IDs.
- Updated API router to register new endpoints under the 'dangerous' path, ensuring clear separation of critical operations.
- Enhanced overall API structure and maintainability by adding robust feedback mechanisms for deletion operations.
2024-12-17 10:36:03 +08:00
Max
7f9307dbdd Add chat deletion functionality across conversation implementations
- Implemented DeleteChat and DeleteAllChats methods in Mongo, Redis, Weaviate, and Xun conversation handlers to allow users to delete specific chats and all chats associated with their account.
- Updated the Conversation interface in types.go to include the new deletion methods, ensuring consistent API across different storage backends.
- Added unit tests for DeleteChat and DeleteAllChats methods in xun_test.go to verify functionality and ensure proper deletion of chat histories.
- Enhanced error handling in deletion methods to provide robust feedback during chat removal operations.
2024-12-17 10:27:44 +08:00
Max
9db67a2456 Refactor chat retrieval in Neo API to support filtering and pagination
- Updated GetChats method across conversation implementations to accept a ChatFilter struct, enabling keyword filtering, pagination, and ordering.
- Enhanced handleChatList method in the Neo API to construct a filter from query parameters, improving the flexibility of chat retrieval.
- Introduced new types (ChatFilter, ChatGroup, ChatGroupResponse) to facilitate structured responses and better organization of chat data.
- Improved error handling and response structure for chat retrieval, ensuring robust feedback and clarity in API responses.
2024-12-17 10:18:37 +08:00
Max
f666070bb3 Add user field support in conversation settings and enhance user ID retrieval in Xun
- Introduced a new UserField in the Setting struct to allow customization of the user ID field name.
- Implemented getUserID method in Xun to retrieve user IDs based on the configured UserField, improving flexibility in user identification.
- Updated multiple methods (UpdateChatTitle, GetChats, GetHistory, SaveHistory, GetRequest, SaveRequest, GetChat) to utilize the new user ID retrieval logic, ensuring consistent handling of user sessions.
- Enhanced error handling for user ID retrieval, ensuring robust feedback in case of issues.
2024-12-17 09:54:57 +08:00
Max
b3bc843235 Enhance chat update functionality and introduce chat title generation in Neo API
- Updated handleChatUpdate method to include content field in the request body, allowing for dynamic chat title generation based on user input.
- Implemented GenerateChatTitle method to create a concise title for chats, improving user experience and interaction.
- Modified JSON response structure in handleChatDetail and handleChatUpdate methods for better clarity and consistency.
- Enhanced error handling for chat updates, ensuring robust validation and feedback for users.
2024-12-16 19:59:23 +08:00
Max
869ed3717a Add chat update functionality and enhance API endpoints in Neo API
- Introduced a new endpoint for updating chat details, allowing users to modify chat titles via the handleChatUpdate method.
- Implemented error handling for missing session IDs and chat IDs, ensuring robust validation of input parameters.
- Enhanced existing API structure by adding status, chat list, chat detail, history, file upload, download, and mentions endpoints, improving overall API usability.
- Improved code organization and maintainability by clearly defining new methods for handling chat updates and related functionalities.
2024-12-16 17:46:17 +08:00
Max
eadc550980 Add chat detail and mentions handling in Neo API
- Introduced new endpoints for retrieving chat details and mentions, enhancing the API's functionality.
- Implemented handleChatDetail method to fetch details of a specific chat by ID, including error handling for missing parameters.
- Added handleMentions method to retrieve mentions based on keywords, improving user interaction with chat content.
- Updated existing GetChats method to support keyword filtering, allowing for more refined chat list retrieval.
- Enhanced the DSL structure to include new methods for managing mentions and chat details, improving overall code organization and maintainability.
2024-12-16 17:36:02 +08:00
Max
2da7c30ac5 Refactor query handling in Xun conversation management
- Introduced a NewQuery method to streamline query creation, enhancing code readability and maintainability.
- Updated multiple methods (UpdateChatTitle, GetChats, GetHistory, SaveHistory, GetRequest, SaveRequest, clean) to utilize the new query method, reducing redundancy in query table references.
- Improved overall structure of the conversation management code by centralizing query logic.
2024-12-16 12:37:11 +08:00
Max
b34f97ac2a Add file download functionality to Neo API
- Introduced a new endpoint for downloading files, enhancing the API's capabilities.
- Implemented the handleDownload method to manage download requests, including validation for required parameters (sid and file_id).
- Updated the Download method in the assistant interface to retrieve files based on file_id, ensuring proper error handling and response structure.
- Enhanced file upload logic to include file extensions in generated IDs for better file management.
- Added necessary response headers for file downloads, improving user experience during file retrieval.
2024-12-16 11:07:22 +08:00
Max
3fbcd4a5e1 Add support for JSON file type in AllowedFileTypes across assistant modules 2024-12-15 09:54:18 +08:00
Max
773e050925 Implement file upload functionality in Neo API, adding new endpoint for file uploads and enhancing assistant management. Introduce handleUpload method to process file uploads, including size and type validation. Update context to include upload information and refactor assistant selection logic for improved clarity. Enhance error handling and response structure for file upload operations, ensuring robust communication of success and failure states. 2024-12-14 19:39:14 +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
c8643bbe45 Refactor HookCreate and assistant management in Neo API to improve response handling and streamline assistant creation. Update HookCreate to return structured CreateResponse with AssistantID and ChatID, enhancing error handling. Modify Load function to create the default assistant after querying the assistant list, ensuring proper initialization. Refactor newAssistant methods for better clarity and maintainability, and update types to include CreateResponse struct for improved response management. 2024-12-14 14:53:01 +08:00
Max
6c244d8788 Refactor Neo API to enhance CORS handling and streamline endpoint registration. Introduce OPTIONS handlers for all endpoints, improve CORS middleware logic, and reorganize assistant creation flow in load.go. Additionally, add a delay in the Answer method to ensure proper retrieval of assistant and chat IDs. 2024-12-14 13:03:05 +08:00
Max
79ee5b75f9 Refactor error handling in Neo API to streamline message creation. Replace map-based error responses with a more concise error method in the message struct, enhancing readability and maintainability. Update related functions to ensure consistent error messaging across chat handling and response writing. 2024-12-13 19:49:54 +08:00
Max
2ebc29d6f7 Enhance Neo API and conversation management by adding support for server-sent events (SSE) in chat handling, improving error messaging with structured responses, and refactoring assistant creation logic. Update conversation settings to utilize a new assistant model and implement context management improvements for better performance. Additionally, streamline the DSL structure and enhance test coverage for chat functionalities. 2024-12-13 17:51:13 +08:00
Max
1c078a5d2e Refactor Neo DSL tests and API structure by removing unused handlers, enhancing conversation management, and implementing new test cases for prompts, chat messages, and history saving. Introduce custom response recorder for improved testing and mock AI for simulating responses. 2024-12-13 11:17:00 +08:00
Max
d69247cdbe
Merge pull request #810 from trheyi/main
Update dependencies
2024-12-13 01:13:00 +08:00
Max
cd01149db1 Update dependencies in go.mod and go.sum; upgrade golang.org/x/crypto to v0.31.0, golang.org/x/text to v0.21.0, golang.org/x/sync to v0.10.0, and golang.org/x/sys to v0.28.0. Modify process initialization in cmd/run.go to use context for improved execution management. 2024-12-13 01:02:22 +08:00
Max
de7f5fc9b1 Enhance NewContext function to include ChatID parameter for improved context management 2024-12-12 20:21:02 +08:00
Max
153efc1a49 Refactor command handling and conversation management by removing the command package, updating conversation methods to support chat IDs, and enhancing API functionality for chat history and titles. This includes adjustments to the DSL context and conversation settings for improved data handling. 2024-12-12 16:37:59 +08:00
Max
b698846a35
Merge pull request #809 from trheyi/main
Remove outdated issue templates and update contact links in config.yml
2024-12-09 09:40:58 +08:00
Max
319faff110 Remove outdated issue templates and update contact links in config.yml 2024-12-09 09:40:30 +08:00
Max
149f161a33
Merge pull request #808 from trheyi/main
Update README.md
2024-12-04 18:23:58 +08:00
Max
001d23756f Improve README.md to clarify app creation methods and emphasize programming capabilities 2024-12-04 18:21:47 +08:00
Max
f05c1d3bf8 Revise README.md to enhance clarity and provide a concise overview of Yao's features and capabilities 2024-12-04 18:17:20 +08:00
Max
403d5ad0ba
Merge pull request #807 from trheyi/main
Fix code signing command and update .gitignore to exclude shell scripts
2024-12-04 11:39:22 +08:00