Commit graph

3943 commits

Author SHA1 Message Date
Max
edcd8d0a91
Merge pull request #1318 from trheyi/main
Refactor connector settings to model capabilities
2025-11-17 09:47:07 +08:00
Max
033d94d96f Refactor connector settings to model capabilities
- Renamed and refactored functions and variables to transition from connector settings to model capabilities, enhancing clarity and consistency.
- Updated the loading mechanism to read model capabilities from `models.yml` instead of `connectors.yml`.
- Adjusted the assistant's global settings to utilize model capabilities, ensuring proper integration with the new configuration structure.
- Enhanced the reasoning adapter to support temperature adjustment based on model capabilities, improving flexibility in handling reasoning parameters.
2025-11-17 09:45:54 +08:00
Max
8c06ddf500
Merge pull request #1317 from trheyi/main
Add DeepSeek API configuration and enhance reasoning support in LLM a…
2025-11-17 08:07:58 +08:00
Max
494c8dc98e Add DeepSeek API configuration and enhance reasoning support in LLM adapters
- Added DeepSeek API keys and model configurations to the GitHub workflows for both unit and PR tests.
- Introduced a new `ReasoningEffort` parameter in the `CompletionOptions` struct to manage reasoning levels for models like o1 and GPT-5.
- Updated the `ReasoningAdapter` to handle the new `ReasoningEffort` parameter, ensuring it is stripped if not supported by the model.
- Enhanced the OpenAI provider to preprocess options through adapters, improving the handling of reasoning content and ensuring compatibility with DeepSeek R1 reasoning format.
2025-11-17 08:07:20 +08:00
Max
a13f4fe929
Merge pull request #1316 from trheyi/main
Refactor LLM provider architecture to utilize capability adapters
2025-11-17 06:45:33 +08:00
Max
3d149057fd Refactor LLM provider architecture to utilize capability adapters
- Removed legacy and audio providers, consolidating functionality into a new architecture that separates API format handling from capability management.
- Updated the OpenAI provider to support capability adapters for tool calls, vision, audio, and reasoning, enhancing modularity and extensibility.
- Introduced a new method for detecting API formats and streamlined the provider selection process.
- Enhanced documentation to reflect the new architecture and clarify provider capabilities and usage.
2025-11-17 06:44:20 +08:00
Max
b7b586b505
Merge pull request #1315 from trheyi/main
Enhance message handling in OpenAI adapter to skip non-delta "done" m…
2025-11-17 06:23:12 +08:00
Max
fa95f32db7 Enhance message handling in OpenAI adapter to skip non-delta "done" messages
- Added logic to ignore "done" messages that are not delta updates, ensuring that final confirmation messages are not sent to OpenAI clients, which rely on finish_reason instead.
2025-11-17 06:22:18 +08:00
Max
704b69abab
Merge pull request #1314 from trheyi/main
Implement event message handling and enhance output capabilities
2025-11-16 10:31:23 +08:00
Max
b43929210e Implement event message handling and enhance output capabilities
- Added support for lifecycle event messages, including a new event type for tracking stream states (e.g., stream_start, stream_end).
- Introduced a NewEventMessage function to create event messages with structured properties.
- Updated the output package to include event messages in the built-in types, ensuring compatibility with CUI clients while remaining silent for OpenAI clients.
- Enhanced the DefaultStreamHandler to utilize event messages for better lifecycle tracking during streaming operations.
- Improved error handling and logging in the OpenAI provider to capture and report streaming errors effectively.
2025-11-16 10:30:55 +08:00
Max
761ad5696d
Merge pull request #1313 from trheyi/main
Remove unnecessary blank lines in multiple files for improved code re…
2025-11-15 17:57:11 +08:00
Max
7ddea66106 Remove unnecessary blank lines in multiple files for improved code readability 2025-11-15 17:56:47 +08:00
Max
2af5defb0e
Merge pull request #1312 from trheyi/main
Add streaming support and message handling in DefaultStreamHandler
2025-11-15 17:40:31 +08:00
Max
91aa109f5b Add streaming support and message handling in DefaultStreamHandler
- Implemented a state management system for handling different streaming chunk types, including stream start, group start, text, thinking, tool calls, metadata, errors, and stream end.
- Introduced a new Send method in the context to facilitate message sending to the client.
- Enhanced the output package with message sending capabilities, including support for message groups and flushing.
- Improved error handling and message ID generation for better streaming reliability and user feedback.
2025-11-15 17:40:03 +08:00
Max
6e5cf2a60a
Merge pull request #1311 from trheyi/main
Enhance context cancellation support in OpenAI provider and tests
2025-11-15 15:44:33 +08:00
Max
8636b0c842 Enhance context cancellation support in OpenAI provider and tests
- Added context cancellation handling in the OpenAI provider's Stream and Post methods, allowing for graceful termination of operations when the context is cancelled.
- Implemented a new test, TestOpenAIStreamContextCancellation, to validate that streaming respects context cancellation, ensuring proper error handling and event emission during cancellation scenarios.
- Refactored context usage in existing methods to improve consistency and reliability in handling context across streaming operations.
2025-11-15 15:43:57 +08:00
Max
d6155b230f
Merge pull request #1310 from trheyi/main
Fix formatting issues in OpenAI stream lifecycle event tests
2025-11-15 15:37:32 +08:00
Max
da53917d51 Fix formatting issues in OpenAI stream lifecycle event tests
- Removed unnecessary blank lines in the TestOpenAIStreamLifecycleEvents function to improve code readability.
- Adjusted log formatting for group_end event to ensure consistent output during test execution.
2025-11-15 15:36:31 +08:00
Max
5e16883daf
Merge pull request #1309 from trheyi/main
Implement stream lifecycle events in OpenAI provider
2025-11-15 15:33:09 +08:00
Max
bdbaf011b2 Implement stream lifecycle events in OpenAI provider
- Added support for stream lifecycle events including stream_start, stream_end, group_start, and group_end.
- Introduced new data structures for handling lifecycle event data, enhancing communication of stream boundaries and metadata.
- Updated the OpenAI provider to track and emit these events during streaming operations, improving UI/UX capabilities.
- Added tests to validate the correct emission and order of lifecycle events during streaming.
2025-11-15 15:32:49 +08:00
Max
181a889cf4
Merge pull request #1308 from trheyi/main
Add tests for JSON response formatting and schema validation in OpenA…
2025-11-15 11:31:38 +08:00
Max
d705fcc484 Add tests for JSON response formatting and schema validation in OpenAI provider
- Introduced TestOpenAIJSONMode and TestOpenAIJSONModePost to validate JSON response formatting for streaming and non-streaming requests.
- Added TestOpenAIJSONSchema and TestOpenAIJSONSchemaPost to ensure compliance with strict JSON schema validation.
- Enhanced request body construction in the OpenAI provider to support JSON schema details in response formats.
2025-11-15 11:31:17 +08:00
Max
9b6916bf5a
Merge pull request #1307 from trheyi/main
Implement message preprocessing and enhance OpenAI provider
2025-11-15 11:14:04 +08:00
Max
68ed9ece6d Remove unnecessary blank line in accumulatedToolCall struct definition in OpenAI provider types.go 2025-11-15 11:13:26 +08:00
Max
353ad56ddd Implement message preprocessing and enhance OpenAI provider functionality
- Added message preprocessing in the base provider to filter unsupported content types (vision and audio) based on model capabilities.
- Introduced new methods in the OpenAI provider for handling streaming and non-streaming requests with retry logic and tool call validation.
- Enhanced request body building to support various options and improved error handling for API interactions.
- Implemented validation for tool call arguments against JSON schemas, ensuring compliance with expected formats.
2025-11-15 11:12:30 +08:00
Max
450be347a1
Merge pull request #1306 from trheyi/main
Refactor defaultConnector variable formatting for improved readability
2025-11-15 10:12:23 +08:00
Max
cef75ff71b Refactor defaultConnector variable formatting for improved readability 2025-11-15 10:12:00 +08:00
Max
ba4e6433bd
Merge pull request #1305 from trheyi/main
Update Go module dependencies and enhance assistant context management
2025-11-15 10:06:28 +08:00
Max
f2099babd9 Update Go module dependencies and enhance assistant context management
- Upgraded Go version to 1.25 and updated several dependencies, including `testify` to v1.11.1 and added new indirect dependencies for JSON schema validation.
- Refactored the assistant's context management to utilize a new `context.Uses` structure, improving the handling of vision, audio, search, and fetch configurations.
- Enhanced the assistant's request building process to support new response formats, including JSON schema validation, ensuring better integration with various tools and services.
2025-11-15 10:05:57 +08:00
Max
71c69fa581
Merge pull request #1304 from trheyi/main
Implement global uses configuration and enhance assistant capabilities
2025-11-14 19:17:50 +08:00
Max
124bd38f7a Implement global uses configuration and enhance assistant capabilities
- Added global uses configuration to the assistant, allowing for centralized management of vision, audio, search, and fetch settings.
- Updated the Assistant struct and related methods to support the new Uses configuration, improving flexibility in assistant operations.
- Refactored the Stream method to utilize the new CompletionResponse type, enhancing response handling.
- Introduced new methods for building requests and managing capabilities, streamlining the assistant's interaction with various connectors.
2025-11-14 19:17:21 +08:00
Max
ea8d000ede
Merge pull request #1303 from trheyi/main
Enhance testing and context management in assistant operations
2025-11-14 12:39:10 +08:00
Max
889fba942a Enhance testing and context management in assistant operations
- Refactored the Makefile to include new benchmark and memory leak detection tests, improving test coverage.
- Introduced context adjustments in the Create method, allowing hooks to modify context fields such as AssistantID, Connector, Locale, Theme, Route, and Metadata.
- Added a new test scenario to validate context field adjustments, ensuring proper updates during assistant operations.
- Updated test preparation to support optional V8 mode configuration for improved performance during benchmarks.
2025-11-14 12:38:03 +08:00
Max
6d0d0cfedf
Merge pull request #1302 from trheyi/main
Add test for context field validation in JavaScript integration
2025-11-14 08:52:26 +08:00
Max
31adde43b0 Add test for context field validation in JavaScript integration
- Introduced a new test scenario to verify context fields in the assistant's JavaScript execution.
- Enhanced validation checks for response messages, ensuring proper handling of success and failure indicators.
- Improved logging for detailed validation results, aiding in debugging and verification of context handling.
2025-11-14 08:51:51 +08:00
Max
1f5a2bf600
Merge pull request #1301 from trheyi/main
Enhance context handling and metadata management in assistant operations
2025-11-14 08:42:02 +08:00
Max
aa69b693e3 Enhance context handling and metadata management in assistant operations
- Introduced a new test context creation function to streamline test setup for assistant operations.
- Refactored context structure to replace the deprecated 'Data' field with 'Metadata', improving clarity and consistency.
- Updated various methods to utilize the new 'Metadata' field, ensuring proper handling of request metadata across the system.
- Adjusted tests to reflect changes in metadata handling, enhancing validation of context fields in JavaScript integration.
2025-11-14 08:41:40 +08:00
Max
27144d82a8
Merge pull request #1300 from trheyi/main
Refactor assistant creation handling and response types
2025-11-13 18:28:08 +08:00
Max
e0f69368fb Refactor assistant creation handling and response types
- Updated the Create method in the Script type to return a structured HookCreateResponse instead of the previous ResponseHookCreate.
- Enhanced the getHookCreateResponse method to handle various response scenarios, including nil and undefined results.
- Refactored context types to introduce the new HookCreateResponse structure, which includes fields for messages, audio configuration, generation parameters, and metadata.
- Adjusted related methods in the Assistant to ensure compatibility with the new response structure.
2025-11-13 18:27:15 +08:00
Max
d385d3bf86
Merge pull request #1299 from trheyi/main
Add test for assistant creation and script execution
2025-11-13 15:24:03 +08:00
Max
baf90d374c Add test for assistant creation and script execution
- Implemented TestCreate to validate the creation of the 'tests.create' assistant.
- Added context handling for the assistant, ensuring proper execution of the script with a sample user message.
- Enhanced error handling to check for the presence of the script in the assistant.
2025-11-13 15:23:30 +08:00
Max
22fbc69ad2
Merge pull request #1298 from trheyi/main
Refactor object registration in Context for improved lifecycle manage…
2025-11-13 14:58:38 +08:00
Max
73f6fae626 Refactor object registration in Context for improved lifecycle management
- Updated the objectRegister method to generate a new ID internally, simplifying the API by removing the need for an external ID parameter.
- Adjusted the NewObject method to utilize the new object registration mechanism, ensuring proper ID assignment and resource cleanup during instance creation.
2025-11-13 14:57:52 +08:00
Max
eac598b599
Merge pull request #1297 from trheyi/main
Add concurrent testing and object registration for JsValue function
2025-11-13 14:50:46 +08:00
Max
b13c40e88d Add concurrent testing and object registration for JsValue function
- Implemented TestJsValueConcurrent to validate the JsValue function under concurrent requests, ensuring proper handling of multiple goroutines.
- Added TestJsValueRegistrationAndCleanup to verify the registration and cleanup of context objects, enhancing resource management.
- Introduced object registration and release mechanisms in the Context type to manage JavaScript object lifecycles effectively.
- Utilized sync.Mutex for thread-safe access to shared resources, improving the robustness of concurrent operations.
2025-11-13 14:43:40 +08:00
Max
c8dbf3bc0d
Merge pull request #1296 from trheyi/main
Implement Execute method call in Create function for improved assista…
2025-11-13 12:21:05 +08:00
Max
240cddbcaf Implement Execute method call in Create function for improved assistant creation handling 2025-11-13 12:20:27 +08:00
Max
a9fced2dd5
Merge pull request #1295 from trheyi/main
Refactor Assistant methods and context handling for improved function…
2025-11-13 11:44:23 +08:00
Max
71698b1405 Add Execute method to Script type for enhanced script execution 2025-11-13 11:42:36 +08:00
Max
9c97035cc6 Refactor Assistant methods and context handling for improved functionality
- Updated the Stream method to return a structured response, including create, done, and completion hooks.
- Introduced new methods for managing message history and building LLM requests, enhancing modularity.
- Refactored the Script type to utilize a new hook structure, improving code organization.
- Removed the obsolete hooks file to streamline the codebase.
- Enhanced context types with additional fields for better integration with LLM models.
2025-11-13 09:26:45 +08:00