Commit graph

239 commits

Author SHA1 Message Date
Max
d8f267694d Refactor API handler functions for assistants in Neo package
- Updated the assistant-related API handler functions in neo/api.go to follow Go naming conventions by capitalizing the function names, making them exported for use in openapi/agent.
- This change enhances code readability and consistency across the API implementation.
- Added new LLM and MCP server management handlers in their respective packages, improving the overall structure and organization of the OpenAPI module.
- Removed the obsolete agent.go file, streamlining the codebase.
2025-10-25 16:02:01 +08:00
Max
54bf6c1ed2 Add OpenAPI OAuth handling in defaultGuard
- Implemented guardOpenapiOauth function for OAuth token validation and session ID management.
- Enhanced defaultGuard to check for OpenAPI OAuth requests and process them accordingly.
- Added utility functions for access token and session ID retrieval from requests.
2025-08-05 12:16:14 +08:00
Max
2f13dbbffb Enhance attachment model and add local uploader support
- Introduced a new `Groups` field in the `Attachment` struct to support categorization of attachments.
- Integrated `types.MetaInfo` into `ManagerOption` for improved metadata handling.
- Added a local uploader for attachments, enabling file uploads from a specified local path.
- Updated asset management functions to reflect changes in file metadata and structure.
2025-07-25 18:15:51 +08:00
Max
435b482c38 Refactor attachment handling and enhance upload options
- Updated the API to include new upload options for handling different storage types: chat, knowledge, and assets.
- Improved group building logic for attachment uploads based on user, chat, and assistant IDs.
- Removed deprecated attachment files and refactored related code to streamline the attachment management process.
- Enhanced error handling for required fields in upload options, ensuring better validation and user feedback.
2025-07-25 17:25:12 +08:00
Max
062f678e10 Add gzip option to ManagerOption struct and update app processing logic
- Introduced a new Gzip field in the ManagerOption struct to allow optional gzip compression for file uploads.
- Updated the processXgen function to include the gzip setting for chat, assets, and knowledge upload configurations, enhancing flexibility in file handling.
2025-06-27 20:03:09 +08:00
Max
cd145ba3e8 Refactor file download and upload methods in neo package for improved clarity and functionality
- Streamlined handleDownload and handleUpload methods to enhance code readability and maintainability.
- Improved error handling and validation checks during file operations to ensure robust functionality.
- Updated documentation to reflect changes in file handling processes and usage examples.
2025-06-01 18:40:29 +08:00
Max
445bcdd7ea Implement file download functionality and refactor existing methods in neo package
- Added handleDownload method to manage file download requests, including validation for session ID and file ID.
- Enhanced permission checks to ensure users can only download files they are authorized to access.
- Updated CORS headers to include Content-Disposition for better file handling in responses.
- Removed deprecated download logic from the neo package to streamline code and improve maintainability.
- Refactored existing methods to improve clarity and error handling during file operations.
2025-06-01 18:33:38 +08:00
Max
e6a0f37a66 Enhance file upload handling and deduplication features in neo package
- Updated UserOrGuestID method to return guest status alongside user ID.
- Introduced UploadOption struct to encapsulate additional upload parameters, including public visibility and collection ID.
- Enhanced handleUpload method to validate collection ID for knowledge storage and improved error handling.
- Updated GetHeader function to include file size in the header processing.
- Implemented content fingerprinting for file deduplication and added support for upload status tracking.
- Enhanced README documentation to reflect new features and usage examples for file uploads and deduplication.
2025-06-01 17:46:28 +08:00
Max
68e4e64e35 Add KnowledgeFilter struct and update database configuration in README
- Changed the database configuration example from 'app.yao' to 'neo.yml' for clarity.
- Introduced the KnowledgeFilter struct to facilitate filtering of knowledge collections by various criteria such as user ID, collection name, public status, and pagination.
- Added usage examples for retrieving system and readonly knowledge collections with specific fields.
2025-06-01 16:44:02 +08:00
Max
e1f2899723 Add attachment status management and filtering in neo package
- Introduced new status field in the attachment table to track processing states: uploading, uploaded, indexing, indexed, upload_failed, and index_failed.
- Added progress and error fields to provide detailed information during the attachment processing workflow.
- Implemented AttachmentFilter struct to support filtering attachments by status.
- Updated SaveAttachment and GetAttachments methods to handle new status and progress information.
- Enhanced tests to validate attachment status management and filtering functionality.
2025-06-01 16:26:39 +08:00
Max
49562b8be0 Add attachment and knowledge management features in neo package
- Implemented SaveAttachment, DeleteAttachment, GetAttachments, and GetAttachment methods for managing file attachments.
- Introduced SaveKnowledge, DeleteKnowledge, GetKnowledges, and GetKnowledge methods for handling knowledge collections.
- Enhanced the Store interface to include methods for attachment and knowledge management.
- Updated tests to cover new attachment and knowledge functionalities, ensuring robust validation and error handling.
2025-06-01 16:06:41 +08:00
Max
2222bbfcd7 Refactor file upload handling in neo package
- Simplified the file header conversion process by introducing GetHeader function to streamline header management during uploads.
- Updated handleUpload method to utilize the new GetHeader function, improving code clarity and reducing error handling complexity.
- Enhanced test cases to reflect changes in upload logic and ensure accurate content validation.
- Improved chunked upload handling by implementing a more robust mechanism for tracking upload progress and managing chunk data.
2025-06-01 12:00:45 +08:00
Max
5b99f3bf44 Enhance file upload functionality and authentication in neo package
- Updated the API to support dynamic storage paths for file uploads, allowing for differentiated handling of chat, knowledge, and asset uploads.
- Implemented comprehensive authentication checks to ensure only authorized users can upload files.
- Introduced new upload options to handle original filenames and improved error responses for better user feedback.
- Enhanced CORS headers to accommodate new upload requirements and improve API security.
- Initialized authentication settings in the Load function to streamline user management.
2025-05-31 16:36:02 +08:00
Max
43686be6e4 Enhance asset upload management in neo package
- Added support for custom asset upload settings in the Upload struct, allowing for more flexible file handling.
- Implemented logic in initUpload to register default or custom asset upload configurations based on user settings.
- Improved error handling during asset registration to ensure robust functionality.
2025-05-31 13:33:23 +08:00
Max
a9b6eed025 Add upload management to neo package for enhanced file handling
- Introduced initUpload function to initialize upload settings for chat and knowledge attachments.
- Updated Upload struct to include specific settings for chat and knowledge uploads.
- Implemented RegisterDefault and ReplaceEnv methods in the attachment manager for better configuration management.
- Enhanced error handling during the upload initialization process to ensure robust functionality.
2025-05-31 11:30:11 +08:00
Max
96d2f22e77 Update dependencies in go.mod and go.sum; refactor file handling in neo package
- Added the jsonrepair package to go.mod for enhanced JSON handling capabilities.
- Removed unused dependencies from go.mod and updated existing ones for better performance.
- Refactored file upload and download methods in the neo package to return nil values, indicating a temporary placeholder for future implementation.
- Updated the Message struct to use the new attachment package for better organization of file attachments.
2025-05-31 10:07:19 +08:00
Max
b97933e357 Refactor Assistant struct to replace Flows with Workflow and update cloning logic
- Replaced the Flows field in the Assistant struct with a Workflow field to better represent the assistant's functionality.
- Updated the Clone method to perform a deep copy of the Workflow instead of Flows.
- Adjusted related test cases to reflect the changes in the Assistant struct and ensure proper functionality.
2025-05-27 12:07:41 +08:00
Max
1058598be3 Enhance localization support in chat and assistant functionalities
- Added locale parameter to GetChats, GetChat, and GetAssistants methods across various store implementations for improved localization.
- Updated handleChatList, handleChatLatest, and handleChatDetail functions to utilize the new locale handling for better user experience.
- Refactored assistant methods to support localized names and descriptions based on user input.
- Introduced WithLocale function in context to manage locale settings effectively.
2025-05-27 11:49:19 +08:00
Max
4ab7a1056e Enhance localization support and refactor assistant functions for improved i18n handling
- Introduced locale parameter in GetAssistants and GetAssistant methods across various store implementations to support localized responses.
- Updated handleChatLatest, handleAssistantList, handleAssistantDetail, and handleAssistantTags functions to utilize the new locale handling for better user experience.
- Refactored GetPlaceholder method in the Assistant struct to accept a locale argument for dynamic placeholder translations.
- Removed redundant i18n code and centralized translation logic for cleaner implementation.
2025-05-26 11:58:48 +08:00
Max
b424f13ddc Update system time message format in API response
- Changed the system time message to include a name field and a more descriptive content format for clarity.
- Added a development log comment for the DUI platform to enhance code documentation.
2025-05-25 11:34:44 +08:00
Max
1b921cf7b0 Enhance i18n support and refactor API response handling in assistant functions
- Introduced global i18n initialization and connector setup in the Load function for better localization support.
- Refactored handleAssistantList, handleAssistantDetail, and handleAssistantTags functions to utilize the new Translate method for improved response translation based on user locale.
- Simplified locale handling by removing redundant code and centralizing translation logic.
2025-05-25 10:51:02 +08:00
Max
6467a9c37e Refactor API response handling and enhance locale support in assistant functions
- Removed the generateResponse struct and its associated methods to simplify response handling.
- Added locale support in handleAssistantList and handleAssistantDetail functions to allow for localized responses based on user input.
- Updated the Context struct to include locale information for better customization.
- Refactored the Load function in load.go to incorporate i18n support for assistant localization.
2025-05-24 20:36:00 +08:00
Max
c087ed1760 Remove hooks.go file and refactor Load function in load.go to streamline assistant initialization
- Deleted hooks.go as it was no longer needed.
- Updated Load function in load.go to set default assistant name to "mohe" and adjusted store settings.
- Removed unused RAG and Vision initialization functions to simplify the codebase.
- Refactored defaultAssistant function to improve error handling for missing default assistant.
2025-05-24 18:37:51 +08:00
Max
0d612753e7 Update dependencies in go.mod and go.sum; refactor imports in main.go and utils.go
- Updated various dependencies in go.mod to their latest versions for improved functionality and security.
- Refactored import statements in main.go to enhance readability and organization.
- Changed the jsonrepair package import in utils.go to use a different library for better performance.
2025-05-22 23:20:11 +08:00
Max
9a0ad73f4c Enhance Context struct by adding Locale and Theme fields
- Introduced Locale and Theme fields to the Context struct for improved customization options.
- Updated the Map method to include these new fields in the returned data.
2025-05-19 18:15:36 +08:00
Max
aca3014167 feat: Add support for Vision and Search in Assistant API
- Introduced Vision and Search capabilities in the Assistant API, enhancing its functionality.
- Updated the Context struct to include Vision and Search fields for better context management.
- Added a new Search type to facilitate search engine integration.
- Adjusted the execute method to handle the new features appropriately.
2025-05-14 16:03:13 +08:00
Max
51cb155d73 fix: Correct assistant ID handling in chat methods
- Updated the assignment of assistant_id to use the Default value from neo.Use, ensuring consistent behavior when the assistant_id is nil.
- Adjusted the logic for determining assistant_deleteable to compare against the Default value, improving clarity and correctness in chat functionality.
2025-05-13 15:18:25 +08:00
Max
15f3f0adf8 fix: Add support for attachments in message mapping
- Implemented functionality to handle attachments in the Map method of the Message struct.
- Added JSON parsing for attachments, ensuring proper error handling and feedback during the process.
2025-05-12 14:38:37 +08:00
Max
6934381319 fix: Comment out Assistant metadata in error handling within Assistant API
- Commented out the Assistant metadata in error handling to prevent unnecessary data exposure during error responses.
- Ensured that the output is sent to the client correctly in the streamChat method, maintaining clarity in the execution flow.
2025-05-09 15:25:39 +08:00
Max
eb89272048 fix: Update client type constant for Android in context management
- Renamed ClientTypeSDK to ClientTypeAndroid for clarity and consistency in client type definitions.
- Updated SupportedClientTypes map to reflect the change in client type naming.
2025-05-09 12:14:41 +08:00
Max
dc54d17f2b fix: Improve result handling in Assistant API streamChat method
- Refactored the result handling logic to ensure that the output is sent to the client correctly, whether a callback is provided or not.
- Simplified the flow by removing redundant callback handling when a result is available.
2025-05-09 12:09:19 +08:00
Max
c44c332334 feat: Update asset metadata and enhance Assistant API functionality
- Updated modification times for various asset files in bindata.go to reflect recent changes.
- Refactored the Assistant API to improve result handling and streamline message processing.
- Removed unused stream handling code in the Assistant, simplifying the execution flow.
- Enhanced the Agent class in libsui/agent.ts to better manage message states and improve error handling.
2025-05-09 10:27:31 +08:00
Max
712bb99ab1 feat: Enhance context management and update asset metadata in SUI
- Updated modification times for various asset files in bindata.go to reflect recent changes.
- Improved context handling in the API by adding support for silent mode, history visibility, and client type.
- Refactored assistant ID usage to ensure consistent access to the default assistant across various methods.
- Enhanced the Agent class in libsui/agent.ts to manage silent mode and history visibility settings effectively.
2025-05-08 20:05:39 +08:00
Max
83bdab3499 feat: Enhance context management and agent functionality in SUI
- Added support for assistant ID in context handling to improve user-specific interactions.
- Updated asset metadata in bindata.go to reflect recent changes in modification times.
- Enhanced the Agent class in libsui/agent.ts with improved type definitions for the Call method, ensuring better type safety and clarity in asynchronous operations.
- Improved event handling in the Agent class to manage message completion more effectively.
2025-05-06 19:24:06 +08:00
Max
bc13b0d83f feat: Improve error handling and result processing in Assistant API
- Update streamChat method to set a default prompt for error messages, enhancing user guidance.
- Refactor case handling in streamChat to better manage boolean and map results, improving response clarity.
- Modify HookRetry method to streamline result extraction and handle action presence more effectively, ensuring robust error handling.
2025-04-29 20:35:27 +08:00
Max
a865595254 feat: Enhance result handling in Assistant API and hooks
- Add result field to ResHookInit struct for improved response handling.
- Update HookCreate method to initialize result in response and handle result extraction from input.
- Modify execute method to return result directly if available, improving response efficiency.
2025-04-28 12:47:35 +08:00
Max
93be3acb97 refactor: Improve asynchronous message processing in WriteMessageAsync
- Introduce a done channel to track message processing completion.
- Increase timeout for message processing to 5 seconds for better reliability.
- Adjust queue timeout to 1 second to enhance responsiveness when the queue is full.
2025-04-27 12:19:54 +08:00
Max
c76024fda1 refactor: Update message writing logic to use message queue
- Modify the Write method in the Message struct to utilize WriteMessageAsync for improved asynchronous message handling.
- Update ignored message types to include "plan" alongside "loading", "error", "action", and "progress" for better message filtering.
2025-04-26 21:25:38 +08:00
Max
57e8389afd refactor: Update message handling to ignore progress messages
- Modify message handling logic to include "progress" in the list of ignored message types alongside "loading", "error", and "action".
- Comment out the loading message sending logic in the Execute method to streamline the process and improve clarity in message flow.
2025-04-19 15:38:12 +08:00
Max
6203b5ccf2 feat: Enhance message structure with ToolID for improved context
- Add ToolID field to Message struct to associate messages with specific tools.
- Update streamChat method to include ToolID in message handling for better tracking.
- Modify message properties to incorporate ToolID, enhancing clarity in message processing.
2025-04-16 16:52:32 +08:00
Max
f1de4c07f8 refactor: Rename BeginAt and EndAt fields for consistency in message handling
- Change BeginAt and EndAt fields to Begin and End in Message struct for improved clarity.
- Update related methods and parameters across the codebase to reflect the new naming convention.
- Ensure consistency in timestamp handling within the ScanTokens function and message processing methods.
2025-04-16 16:40:45 +08:00
Max
712c8ade62 feat: Refactor token management and enhance message scanning
- Update ScanTokens function to utilize ScanCallbackParams for improved clarity and structure in token processing.
- Modify ClearToken method to accept an ID parameter, enhancing token stack management.
- Refactor GenerateWithAI and streamChat methods to leverage new token handling features, improving message flow and context.
- Introduce BeginAt and EndAt fields in message processing for better timing accuracy.
2025-04-16 16:23:00 +08:00
Max
14f447c782 feat: Enhance message handling with timestamps and token management
- Introduce BeginAt and EndAt fields in Message struct to track message timing.
- Update NewText and NewType methods in Contents to accept Extra struct for better metadata handling.
- Modify ScanTokens function to manage token IDs and beginning timestamps, improving token processing accuracy.
- Refactor GenerateWithAI and streamChat methods to utilize new timestamp features, enhancing message context and flow.
2025-04-16 14:29:50 +08:00
Max
1fadfe0882 feat: Add current time message to formatMessages function
- Introduce a system message containing the current time formatted in RFC3339 to the beginning of the filtered messages in the formatMessages function, enhancing message context for users.
2025-04-10 10:50:29 +08:00
Max
1e047a86eb feat: Enhance getTimestamp function to support time.Time type
- Add case for time.Time in getTimestamp function to return Unix timestamp in nanoseconds, improving versatility in timestamp handling.
2025-04-10 10:46:19 +08:00
Max
5965460c3f feat: Enhance SchemaProperty and Parameter structures with additional fields
- Add OneOf and Enum fields to SchemaProperty for improved schema flexibility.
- Update Parameter structure to include optional description, OneOf, and Enum fields.
- Modify generateExampleValue function to handle new OneOf and Enum logic for generating example values.
2025-04-09 16:24:46 +08:00
Max
55e3bb4387 Refactor: Remove deprecated retry logic from objectCall, use the retry hook instead.
- Comment out the retry function and related logic in the run method to streamline the codebase.
- Update the options structure to remove unused retry parameters, enhancing clarity and maintainability.
- Ensure that error handling remains intact while simplifying the execution flow of the assistant.
2025-04-08 12:29:48 +08:00
Max
46b0947dfd fix: Update Assistant API to handle arguments and improve error logging
- Modify APIPayload structure to include Args field for passing arguments.
- Enhance error handling in Call method by adding logging for method not found scenarios.
- Adjust Call method to handle cases with and without arguments, ensuring flexibility in API usage.
2025-04-03 14:36:39 +08:00
Max
af002aa396 fix: Enhance message role handling in Assistant API and object
- Add logging for empty message roles in requestMessages function to aid debugging.
- Default message role to "assistant" if not provided in jsSend function, ensuring consistent message handling.
- Clean up error handling in jsReplace function for improved clarity.
2025-04-02 09:14:09 +08:00
Max
d67807ca2e feat: Extend SchemaProperty and Parameter structures with new fields
- Add Items field to SchemaProperty for better JSON Schema representation.
- Introduce Strict field to Parameter for enhanced parameter validation options.
- Improve data structure flexibility for future tool enhancements.
2025-03-22 18:29:27 +08:00