Commit graph

128 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Max
211e523759 Implement built-in assistant deletion and loading improvements
- Retrieve existing built-in assistants before deletion to ensure accurate removal.
- Update LoadBuiltIn function to track and delete assistants that are no longer present.
- Enhance error handling during the deletion process for better reliability.
2025-03-21 19:57:46 +08:00
Max
f820e376ab Refactor assistant save and delete methods for cache management
- Rename variable for clarity in handleAssistantSave method.
- Implement cache removal and reloading for assistants after save and delete operations to ensure data consistency.
- Add GetCache method to retrieve the loaded cache for better cache management.
2025-03-18 15:36:44 +08:00
Max
586ad9866c Enhance assistant loading and ID generation
- Update loadMap function to handle prompts as both string and array types, improving flexibility in data loading.
- Refactor assistant ID generation in SaveAssistant method to use a dedicated GenerateAssistantID function, ensuring unique IDs are created with error handling.
- Add GenerateAssistantID method to create a random 6-digit ID while checking for uniqueness in the database.
2025-03-17 18:28:02 +08:00
Max
97a469bc03 Add type filtering for assistants in API and data loading
- Introduce 'Type' field in AssistantFilter for filtering assistant lists
- Update handleAssistantList and handleAssistantDetail methods to set 'Type' to 'assistant'
- Modify LoadPath function to ensure 'type' is set if not already present
- Adjust GetAssistants and GetAssistantTags methods to apply type filtering in queries
2025-03-15 17:57:35 +08:00
Max
d3734cf1d0 Add support for passing arguments in assistant method calls
- Extend Context struct to include Args field for storing call arguments
- Modify objectCall.run to capture and store arguments in chat context
- Update context mapping to include arguments when present
2025-03-12 17:24:36 +08:00
Max
b89a39b192 Refactor error handling and logging in chat streaming and API methods
- Update error handling in handleChat to return and log errors
- Modify streamChat to remove explicit error logging and improve retry mechanism
- Adjust HookRetry method to return nil for more flexible error handling
- Improve error handling in retryMessages method with better index tracking
- Remove redundant error logging in requestMessages method
2025-03-07 16:57:58 +08:00
Max
47da72bbee Handle null return for non-existent shared space keys
- Modify jsGet method to return null when key is not found
- Add string-based error checking to differentiate between missing keys and other errors
- Improve shared space key retrieval error handling in JavaScript bridge
2025-03-04 17:31:07 +08:00
Max
dafd6b029b Enhance retry mechanism with flexible action handling
- Modify HookRetry to support returning NextAction
- Update streamChat to handle different retry response types
- Add type switching for retry hook return values
- Implement execution of NextAction in retry flow
- Improve error handling and response processing during retry
2025-03-04 15:27:40 +08:00
Max
f469568d85 Improve request context handling in chat streaming
- Use request context for client connection tracking
- Replace CloseNotify with context cancellation
- Enhance streaming method to handle request context termination
2025-03-04 12:03:19 +08:00
Max
709c7ec738 Add optional options handling in objectCall.run method
- Modify options unmarshaling to handle undefined JavaScript options
- Add null check to prevent unmarshaling errors when no options are provided
- Improve robustness of method call argument processing
2025-03-03 18:13:10 +08:00
Max
48d65c0e39 Handle empty prompt in chat streaming with error callback
- Add error handling for empty prompts in streamChat method
- Ensure proper error message generation and callback invocation
- Improve error propagation in chat streaming scenarios
2025-03-03 15:26:24 +08:00
Max
c74d32390c Add retry mechanism for chat streaming with error handling
- Implement HookRetry method to handle retry scenarios in chat streaming
- Add retry tracking with RetryTimes and Retry flag in context
- Create retryMessages method to modify messages for retry attempts
- Enhance error handling and logging for retry scenarios
- Add color-coded error output for retry failures
2025-03-03 14:49:31 +08:00
Max
392676f2cb Add silent mode support for chat history and filtering
- Implement silent flag in chat and history storage
- Add filter options to retrieve chats and messages with silent mode
- Update store interfaces to support silent message filtering
- Enhance GetChats, GetHistory, and related methods to handle silent messages
- Add comprehensive test cases for silent mode functionality
2025-03-01 16:08:56 +08:00
Max
dcc126ef95 Implement retry mechanism for assistant method calls
- Add comprehensive retry handling in objectCall.run method
- Support configurable retry times, delay, and custom retry prompts
- Enhance error handling and input processing during retry attempts
- Modify method signatures to return interface{} for more flexible result handling
- Implement retry event hook for custom retry logic in JavaScript
2025-03-01 12:20:02 +08:00
Max
86dd04728d Enhance input handling and message processing in assistant methods
- Modify Execute and withHistory methods to support multiple input types
- Add flexible type conversion for input messages using jsoniter
- Implement robust handling of string, map, and slice input formats
- Update method signatures to accept interface{} for more dynamic input processing
- Improve error handling during input marshaling and unmarshaling
2025-02-28 20:13:59 +08:00
Max
ca6d075a22 Add shared space methods to JavaScript bridge
- Implement Set, Get, Del, and Clear methods for shared space interactions
- Add error handling and validation for shared space method calls
- Enhance context management with Release method to clear shared space
- Update context initialization to create a default memory shared space
2025-02-27 16:32:25 +08:00
Max
ae599d9b83 Improve JavaScript argument handling in jsCall method
- Add null check for jsArgs to prevent potential nil pointer dereferences
- Refactor argument parsing logic to handle optional arguments more robustly
- Ensure safe conversion of JavaScript arguments to Go slice
- Enhance error handling for argument type conversion
2025-02-27 15:15:27 +08:00
Max
6b15a1763e Enhance message processing in assistant chat method
- Implement comprehensive message formatting function
- Add filtering for duplicate messages
- Reorder messages to ensure proper system and user message placement
- Merge consecutive assistant messages
- Improve message preprocessing for API requests
2025-02-26 08:27:16 +08:00
Max
f1e6c2c62f Add result handling in assistant streaming and hook responses
- Introduce Result field in ResHookDone struct to support additional data
- Update NextAction.Execute method to pass optional callback arguments
- Modify streamChat method to propagate result data to output messages
- Add Result field to Message struct for flexible result storage
2025-02-25 17:32:58 +08:00
Max
5fe43f8103 Enhance JavaScript bridge argument handling in assistant method calls
- Add support for passing additional arguments to callback functions
- Implement flexible argument parsing for JavaScript method calls
- Handle both array and single argument scenarios
- Update method signature to accommodate optional arguments
2025-02-25 16:11:53 +08:00
Max
5475e0ab39 Add Assets method to assistant for retrieving and processing asset files
- Implement Assets method in Assistant struct to read asset files
- Add jsAssets function to JavaScript bridge for accessing assets
- Support optional data replacement in asset file content
- Enable dynamic asset retrieval with optional template data processing
2025-02-25 11:27:04 +08:00