Commit graph

2379 commits

Author SHA1 Message Date
Max
125876d5ef
Merge pull request #881 from trheyi/main
Improve JavaScript argument handling in jsCall method
2025-02-27 15:16:00 +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
4b6235c568
Merge pull request #880 from trheyi/main
Enhance message processing in assistant chat method
2025-02-26 08:27:48 +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
d42f96ffc7
Merge pull request #879 from trheyi/main
Add result handling in assistant streaming and hook responses
2025-02-25 17:33:43 +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
f0c4c8bf62
Merge pull request #878 from trheyi/main
Enhance JavaScript bridge argument handling in assistant method calls
2025-02-25 16:12:16 +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
e536d6ebcc
Merge pull request #877 from trheyi/main
Add Assets method to assistant for retrieving and processing asset files
2025-02-25 11:35:21 +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
Max
f9f1177e0d
Merge pull request #876 from trheyi/main
Enhance thread safety and tool call handling in streaming components
2025-02-24 19:33:20 +08:00
Max
358f327dee Improve native tool calls handling in assistant streaming
- Refactor tool calls processing to handle multiple tool calls more robustly
- Add new message flags (IsBeginTool, IsEndTool) to track tool call stages
- Modify streaming logic to correctly wrap and manage tool call messages
- Ensure only the first tool call is fully processed and displayed
2025-02-24 19:29:57 +08:00
Max
101927e343 Add thread-safe write method with mutex synchronization
- Introduce sync.Mutex to protect concurrent writes to response writer
- Add locking mechanism in Write method to prevent race conditions
- Ensure safe and synchronized message writing in multi-threaded contexts
2025-02-24 17:24:34 +08:00
Max
e4048a5edd
Merge pull request #875 from trheyi/main
Refactor assistant script loading and improve error diagnostics
2025-02-24 14:33:26 +08:00
Max
3c51f16d95 Refactor assistant script loading and improve error diagnostics
- Comment out assistant script loading in script package
- Enhance global variable error message with detailed type information
- Prepare for moving assistant script loading to a dedicated package
2025-02-24 14:33:04 +08:00
Max
71f71570b3
Merge pull request #874 from trheyi/main
Improve error handling and logging in assistant methods
2025-02-24 10:45:36 +08:00
Max
9c9f137a8a Improve error handling and logging in assistant methods
- Add nil checks for callbacks in message and object methods
- Enhance error logging in plan subscription with more descriptive messages
- Improve write method error handling with additional context logging
- Add safeguards against potential nil function calls
2025-02-24 10:44:15 +08:00
Max
eb2f18fede
Merge pull request #873 from trheyi/main
Add Plan function to JavaScript bridge in InitObject method
2025-02-22 18:39:06 +08:00
Max
df99b9a228 Add Plan function to JavaScript bridge in InitObject method
- Introduce new jsPlan function to script context initialization
- Extend InitObject method with Plan method for script interactions
- Enhance JavaScript bridge capabilities in assistant script contexts
2025-02-22 18:37:35 +08:00
Max
f18c4c94cc
Merge pull request #872 from trheyi/main
Rename Context to GinContext in GlobalVariables struct
2025-02-22 14:07:37 +08:00
Max
05af5d1514 Rename Context to GinContext in GlobalVariables struct
- Update GlobalVariables struct to use more descriptive GinContext field
- Modify all references to Context to use GinContext in assistant methods
- Improve clarity of Gin context usage in JavaScript bridge functions
2025-02-22 14:07:11 +08:00
Max
53f1579806
Merge pull request #871 from trheyi/main
Refactor assistant initialization and script context methods
2025-02-22 13:54:47 +08:00
Max
f3e009c3a7 Refactor assistant initialization and script context methods
- Rename HookInit to HookCreate for clarity
- Modify call method to simplify script context initialization
- Remove explicit SendMessage and Run function additions
- Add InitObject method to handle script context setup
- Streamline assistant script method invocation
2025-02-22 13:53:56 +08:00
Max
27524f7fb0
Merge pull request #870 from trheyi/main
Add assistant script loading mechanism
2025-02-21 15:36:12 +08:00
Max
9c419c3209 Add assistant script loading mechanism
- Implement loading of assistant TypeScript index files
- Filter and load only src/index.ts files from assistants directory
- Generate unique IDs for assistant scripts using file path
- Extend application walk method to support assistant script loading
2025-02-21 15:35:11 +08:00
Max
815e551bfe
Merge pull request #869 from trheyi/main
Update run method to support SendMessage in nested script contexts
2025-02-19 10:10:28 +08:00
Max
9a9d1e38a8 Update run method to support SendMessage in nested script contexts
- Modify run method signature to include contents parameter
- Add SendMessage function to nested script context during execution
- Ensure consistent message sending capabilities across script levels
2025-02-19 09:39:16 +08:00
Max
adc3d018d4
Merge pull request #868 from trheyi/main
Add callback support for assistant chat processing
2025-02-18 18:14:29 +08:00
Max
979acb27a8 Add callback support for assistant chat processing
- Introduce optional callback mechanism for chat messages
- Modify Execute and streamChat methods to support callback functions
- Add support for process and script method callbacks
- Update message handling to trigger callbacks during chat streaming
- Enhance flexibility of assistant chat interactions with dynamic callbacks
2025-02-18 18:13:42 +08:00
Max
09a38d8e1f
Merge pull request #867 from trheyi/main
Add retry and silent modes to assistant chat processing
2025-02-18 11:20:51 +08:00
Max
13c4e65a95 Add retry and silent modes to assistant chat processing
- Introduce retry and silent mode flags in context and message structures
- Modify API and hooks to support new context modes
- Update message handling to propagate retry and silent flags
- Replace debug print statements with structured logging
- Enhance tool call and message processing with new context options
2025-02-18 11:20:20 +08:00
Max
c5eade1523
Merge pull request #866 from trheyi/main
Add go-diff library for diff utilities
2025-02-14 09:53:02 +08:00
Max
14bcaa0bf4 Add go-diff library for diff utilities
- Import github.com/sergi/go-diff library in go.mod and go.sum
- Add import for gou/diff package in main.go
- Prepare for potential diff-related functionality in the project
2025-02-12 17:19:16 +08:00
Max
61aa013980
Merge pull request #865 from trheyi/main
Add JSON repair utility for robust parsing
2025-02-11 17:01:30 +08:00
Max
2eaee671da Add JSON repair utility for robust parsing
- Integrate jsonrepair library to improve JSON parsing resilience
- Replace manual JSON repair attempts with a more comprehensive repair method
- Update go.mod and go.sum to include jsonrepair dependency
- Simplify ParseJSON function with a single repair approach
2025-02-11 17:00:22 +08:00
Max
6d1a118236
Merge pull request #864 from trheyi/main
Refactor tool call prompts and message handling
2025-02-11 16:32:08 +08:00
Max
8bc7f6ddb1 Refactor tool call prompts and message handling
- Update tool call prompts with more detailed schema and usage guidelines
- Add dynamic tool call examples based on available tools
- Modify message name generation to use assistant ID with underscores
- Improve system message formatting for tool calls
- Simplify tool call prompt generation logic
2025-02-11 16:31:09 +08:00
Max
07f95cbda4
Merge pull request #863 from trheyi/main
Enhance tool call processing and message handling
2025-02-10 20:42:18 +08:00
Max
c38bce89dc Enhance tool call processing and message handling
- Refactor tool call prompts with more detailed guidelines
- Improve message name handling for system and user messages
- Add robust JSON parsing utility with error recovery
- Update debug logging for request messages and tool calls
- Modify tool call extraction in HookDone method for better reliability
2025-02-10 20:40:59 +08:00
Max
13bc93fe0b
Merge pull request #862 from trheyi/main
Improve tool call parsing and formatting
2025-02-10 11:24:02 +08:00
Max
617893a579 Improve tool call parsing and formatting
- Refine tool call text extraction in HookDone method
- Add URL decoding for JSON-encoded tool call arguments
- Enhance error handling for tool call parsing
- Modify tool call tag handling in streaming chat
2025-02-10 11:13:59 +08:00
Max
12e15e6bc8
Merge pull request #861 from trheyi/main
Fix assistant context switching and ID handling
2025-02-09 18:35:32 +08:00
Max
8f57c38b26 Refactor assistant type assertion in Xgen processing
- Improve type safety when accessing Neo's assistant
- Use type assertion with ok check to handle potential nil or incorrect type
- Simplify assistant context retrieval in Xgen settings
2025-02-09 18:26:51 +08:00
Max
dc6967805e Fix assistant context switching and ID handling
- Prevent switching to an empty assistant ID
- Update context assistant ID during execution
- Ensure proper assistant context management in chat flow
2025-02-09 18:25:09 +08:00
Max
b841dbc24f
Merge pull request #860 from trheyi/main
Add default assistant details to Xgen settings
2025-02-09 17:58:50 +08:00
Max
ccb1c54927 Add default assistant details to Xgen settings
- Include default assistant information in Xgen settings
- Retrieve assistant details from Neo when available
- Add agent configuration with assistant ID, name, avatar, and deleteable status
- Enhance Xgen settings to support assistant metadata
2025-02-09 17:58:23 +08:00
Max
e4375ea33a
Merge pull request #859 from trheyi/main
Add assistant details to chat API responses
2025-02-09 16:54:52 +08:00
Max
4ba27390d8 Add assistant details to chat API responses
- Enhance chat API endpoints to include assistant information
- Add support for retrieving and displaying assistant details in chat responses
- Update database schema to store assistant_id in chat table
- Modify GetChats, GetChat, and SaveHistory methods to handle assistant metadata
- Improve test coverage for assistant-related chat functionality
2025-02-09 16:54:20 +08:00
Max
1556f3c790
Merge pull request #858 from trheyi/main
Remove debug print statement in OpenAI message parsing
2025-02-09 10:09:45 +08:00
Max
5be65d91cd Remove debug print statement in OpenAI message parsing
- Remove unnecessary debug print of arguments and finish reason
- Maintain clean and concise message processing logic
- Align with previous refactoring efforts to simplify code
2025-02-09 10:08:51 +08:00