Commit graph

2189 commits

Author SHA1 Message Date
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
77b991ed20 feat: Upgrade JWT library and enhance token validation
- Update JWT library from v3.2.2 to v4.5.2 for improved security and features.
- Refactor JwtClaims to use RegisteredClaims for better compliance with the latest JWT standards.
- Introduce token length and format validation in JwtValidate function to enhance security.
- Modify JwtMake function to utilize time.Duration for timeout settings, improving clarity and usability.
2025-04-16 14:43:09 +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
645861d7a1 feat: Add Developer information to AppInfo structure and update processXgen
- Introduce Developer struct to encapsulate developer details such as ID, Name, Info, Email, and Homepage.
- Update processXgen to include developer information in the generated settings map, enhancing app metadata.
2025-04-09 23:05:45 +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
c59e12434a feat: Add ConsoleMode configuration to runtime settings
- Introduce ConsoleMode parameter in the Start function to allow configuration based on the provided runtime settings.
- Enhance runtime initialization by incorporating the new ConsoleMode option from the configuration.
2025-04-04 18:26:35 +08:00
Max
f2882c3cbb feat: Enhance Pinyin processing with additional options and tests
- Update ProcessPinyin function to support tone as a string ("mark" for tone marks, "number" for numeric tones) and add heteronym functionality for multiple pronunciations.
- Modify README.md to include examples for new tone options and heteronym mode.
- Expand unit tests to cover various configurations for tone and heteronym, ensuring comprehensive validation of Pinyin conversion scenarios.
2025-04-04 16:35:34 +08:00
Max
efb9da57c1 feat: Add Pinyin processing functionality to string utilities
- Introduce ProcessPinyin function to convert Chinese characters to Pinyin with customizable options for tone and separator.
- Register the new Pinyin process in the utils package for easy access.
- Add comprehensive unit tests for various Pinyin conversion scenarios to ensure accuracy and reliability.
2025-04-04 16:22:39 +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
547b880ca5 fix: Correct processRead output format and enhance unit tests
- Adjust processRead function to ensure it returns the correct string representation of table data.
- Refine unit test for TestProcessRead to validate substring presence in the output, confirming the function's accuracy.
2025-03-31 09:54:07 +08:00
Max
13f89e8395 fix: Update processRead to return string representation of table data
- Modify processRead function to return the string output of the table read operation instead of a map.
- Update unit test for TestProcessRead to check for substring presence in the result, ensuring correct functionality.
2025-03-31 09:02:03 +08:00
Max
eba6ba49c0 feat: Add table listing and DSL retrieval processes
- Implement processList to return all loaded tables and processDSL to retrieve the DSL of a specified table.
- Add unit tests for the new processes to ensure correct functionality and data integrity.
- Update process registration in exportProcess to include the new operations.
2025-03-31 08:52:25 +08:00
Max
cae4d06373 feat: Add sheet existence check to Excel module
- Implement processSheetExists function to verify if a specified sheet exists in the workbook.
- Update README.md with usage examples for the new sheet existence check feature.
- Add unit tests for SheetExists functionality to ensure accurate detection of existing and non-existent sheets.
2025-03-29 18:16:58 +08:00
Max
5d01f62a9e fix: Update directory creation permissions in Open function
- Change directory creation permissions from 0644 to 0755 in the Open function to align with standard directory permission practices, ensuring proper access for created directories.
2025-03-29 17:26:24 +08:00
Max
bc576f1bab refactor: Simplify data handling in processWriteAll function
- Replace individual row handling with a unified approach to convert input values into a two-dimensional slice of interfaces.
- Streamline the writing process by directly passing the constructed slice to the WriteAll method, enhancing code clarity and maintainability.
2025-03-29 17:19:58 +08:00
Max
efb588bbd1 feat: Add sheet name validation to Excel module
- Implement validateSheetName function to check for invalid characters, empty names, and length restrictions for sheet names.
- Integrate validation into CreateSheet, UpdateSheet, and CopySheet methods to ensure compliance before proceeding with operations.
- Enhance WriteAll method to create a new sheet if it doesn't exist, improving robustness in sheet handling.
2025-03-29 17:10:34 +08:00
Max
6e4b7cd59e feat: Add sheet management operations to Excel module
- Implement new process handlers for creating, reading, updating, copying, and deleting sheets in Excel files.
- Enhance the Open function to automatically create directories for file paths if they do not exist.
- Update README.md to include detailed documentation and examples for new sheet operations, improving user guidance.
2025-03-29 17:02:18 +08:00
Max
8371a8959f chore: Update go-colorable dependency to v0.1.14 and refactor expression execution
- Bump github.com/mattn/go-colorable from v0.1.13 to v0.1.14 in go.mod and go.sum.
- Refactor expression execution in pipe and core data handling to use a map for improved type safety.
2025-03-28 23:37:13 +08:00
Max
fd01c6d590 chore: Update Go module dependencies and toolchain version
- Bump Go version from 1.23 to 1.23.0 and set toolchain to go1.23.4.
- Upgrade github.com/expr-lang/expr from v1.16.9 to v1.17.2.
- Update golang.org/x/crypto from v0.31.0 to v0.36.0, golang.org/x/net from v0.33.0 to v0.38.0, and golang.org/x/text from v0.21.0 to v0.23.0.
- Adjust indirect dependencies for golang.org/x/sync and golang.org/x/sys to their latest versions.
2025-03-28 22:56:52 +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
f28076f908 docs: Add style ID constants and usage examples to Excel README
- Introduce a section detailing supported style ID constants for borders and fills in the Excel module.
- Provide examples for creating and applying custom styles using the `excel.set.Style` method.
- Enhance documentation clarity for users implementing styling in Excel files.
2025-03-21 22:14:13 +08:00
Max
6f4c2fa5c4 refactor: Standardize Excel process method names to PascalCase
- Update all Excel-related Process method calls in README.md to use PascalCase for consistency.
- Adjust method names such as "excel.open" to "excel.Open" and "excel.write.cell" to "excel.write.Cell" to align with naming conventions.
- Ensure clarity and uniformity in the documentation for better usability.
2025-03-21 22:10:03 +08:00
Max
57fe05bed8 fix: Update processOpen to use writable flag for Excel file operations
- Change the argument from readonly to writable in the processOpen function.
- Adjust the Open function call to reflect the new writable parameter for improved clarity in file handling.
2025-03-21 21:56:22 +08:00
Max
8eb434cc7a feat: Enhance Excel functionality with row and column operations
- Introduce new process handlers for reading and writing rows and columns in Excel files.
- Update existing methods to utilize absolute paths for file operations, ensuring consistency.
- Add comprehensive tests for new row and column functionalities, including iterators for both.
- Implement rich text and comment handling, along with row height and column width adjustments.
2025-03-21 21:39:03 +08:00
Max
f0da60f467 feat: Migrate Excel plugin to built-in functionality
Move Excel plugin from external plugin to built-in functionality, including:
- Core Excel file operations (open, close, save)
- Sheet manipulation and cell operations
- Row and column iterators
- Process handlers for Excel operations
- Comprehensive test coverage

This change internalizes Excel manipulation capabilities:
- Read/write operations on cells, rows and columns
- Sheet management and styling
- Cell merging and formula handling
- Coordinate conversion utilities
2025-03-21 20:56:35 +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
6edaa712df Update error message for missing assistant data in GetAssistant method
- Change error message from "assistant not found" to "the assistant is empty" for improved clarity in the Xun store.
2025-03-21 18:36:59 +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
38b910108b Add connector support for AI assistants in processXgen
- Import connector package to access AIConnectors
- Update processXgen function to include 'connectors' field in agent map
- Add 'placeholder' field to the assistant data structure for enhanced context
2025-03-16 11:49:22 +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
e59dacefa2 Improve error handling in request value execution
- Modify request value execution to log errors when method calls fail
- Prevent propagation of errors during value resolution
- Update error message in data merging to be more descriptive
2025-03-06 10:48:27 +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