Commit graph

3018 commits

Author SHA1 Message Date
Max
8dca4719c0 Remove deprecated agent API files and refactor agent loading logic
- Deleted obsolete agent API files (agent.go, api.go, api_test.go, types.go) to streamline the codebase.
- Refactored the agent loading logic to initialize the API instance correctly, ensuring proper integration with the new structure.
- Updated context handling to improve clarity and maintainability across the agent's functionality.
- Enhanced error handling and cache management in the agent's initialization process.
2025-11-11 11:23:20 +08:00
Max
1c502bfea8 Refactor context handling in agent API and assistant methods
- Updated context creation in handleChat, handleGenerateTitle, and handleGeneratePrompts to use the request context, improving context management.
- Commented out unused context settings for assistant ID, silent mode, history visibility, and client type to streamline the code.
- Refactored context handling in assistant methods to enhance clarity and maintainability.
- Removed deprecated functions and cleaned up the context structure for better performance and readability.
2025-11-10 17:30:53 +08:00
Max
af383dd941 Enhance GetAssistants filtering to include locales
- Updated the GetAssistants method to allow filtering by locales in addition to keywords in name and description.
- Improved query flexibility for retrieving assistants based on multiple criteria, enhancing user search capabilities.
2025-11-08 16:48:08 +08:00
Max
ff41c6555d Refactor CreateAssistant and UpdateAssistant response handling to return only assistant_id
- Updated the CreateAssistant and UpdateAssistant functions to simplify the success response by returning only the assistant_id instead of the full assistant data.
- Removed unnecessary JSON marshaling and unmarshaling, improving performance and clarity in response handling.
2025-11-08 16:26:46 +08:00
Max
2099921cf4 Refactor test cases for assistant updates to improve consistency
- Standardized formatting in TestUpdateAssistant and assistant_update_test.go to enhance readability.
- Ensured comments clearly indicate which fields are ignored during updates, maintaining clarity in test intentions.
2025-11-08 16:22:29 +08:00
Max
fa5b98f5bf Add UpdateAssistant method for modifying assistant fields
- Implemented UpdateAssistant method in Mongo, Redis, and Xun stores to allow partial updates of assistant fields.
- Updated Store interface to include the new UpdateAssistant method, enhancing the flexibility of assistant management.
- Added comprehensive tests for UpdateAssistant functionality, covering various scenarios including single and multiple field updates, JSON field handling, and error cases.
- Updated API routes to support PUT requests for updating assistants, ensuring proper permission checks and response handling.
2025-11-08 16:21:35 +08:00
Max
90386ddb70 Refactor response handling in GetAssistant and ListAssistantTags functions
- Simplified the response structure by directly returning the assistant and tags objects instead of wrapping them in a "data" field.
- Updated corresponding tests to reflect the new response format, ensuring accurate assertions and improved readability.
2025-11-08 15:17:56 +08:00
Max
5ce5baa748 Enhance getBool function to support multiple data types
- Refactored the getBool function to handle boolean values as well as int64, int, and float64 types, returning true for non-zero values.
- Improved type safety and flexibility in data handling within the utility functions.
2025-11-08 14:58:14 +08:00
Max
0f17db74ca Implement GetAssistant endpoint with permission verification
- Added a new GetAssistant function to retrieve assistant details by ID, incorporating permission checks to ensure authorized access.
- Updated the assistant route to use the new GetAssistant handler, enhancing security by verifying user permissions before returning assistant data.
- Introduced a FilterBuiltInAssistant function to clear sensitive fields for built-in assistants, ensuring compliance with data protection standards.
- Enhanced test coverage for the GetAssistant functionality, including tests for successful retrieval, permission filtering, and error handling scenarios.
2025-11-08 13:46:29 +08:00
Max
42b5e17d78 Fix formatting in TestListAssistantTags to improve readability
- Removed unnecessary blank lines in the test function, enhancing code clarity and maintainability.
2025-11-08 11:44:19 +08:00
Max
17de4e14ed Refactor assistant route handling to apply OAuth guard globally
- Moved the OAuth guard application from a specific assistants group to the main router group, simplifying route management.
- Updated assistant CRUD and action endpoints to directly use the main group, ensuring consistent access control across all assistant-related routes.
2025-11-08 11:43:43 +08:00
Max
46e0f30599 Implement filtering for assistant tags retrieval
- Enhanced the HandleAssistantTags function to support multiple filtering options including type, connector, built-in status, mentionable status, automated status, and keywords.
- Updated the GetAssistantTags method in the store interfaces to accept a filter parameter, allowing for more granular tag retrieval.
- Refactored the Xun, Mongo, and Redis implementations of GetAssistantTags to utilize the new filtering capabilities.
- Added comprehensive tests for the new filtering functionality, ensuring correct behavior across various scenarios.
- Updated API endpoint documentation to reflect the new filtering options for assistant tags.
2025-11-08 11:14:08 +08:00
Max
bed36b754f Enhance assistant model and query handling
- Added permission fields (YaoCreatedBy, YaoUpdatedBy, YaoTeamID, YaoTenantID) to the AssistantModel for better tracking of ownership and access control.
- Introduced a custom QueryFilter in the AssistantFilter struct to allow for flexible permission-based filtering of assistants.
- Updated the GetAssistants method to apply the custom query filter, improving the retrieval logic based on user permissions.
- Enhanced test coverage for the new QueryFilter functionality, ensuring accurate filtering of assistants based on various criteria.
2025-11-08 10:25:28 +08:00
Max
c61688d8be Remove xun_assistant_test.go file to streamline test suite and eliminate redundancy. This file contained extensive test cases for assistant functionalities, which are now covered by other tests in the codebase. 2025-11-07 19:09:42 +08:00
Max
bbcec4d186 Enhance i18n support in assistant model and storage
- Added null handling for input in the I18n Parse method to prevent errors with nil values.
- Refactored string parsing logic into a separate method for improved clarity and maintainability.
- Updated assistant translation logic to streamline the application of i18n translations for various fields, including name, description, and prompts.
- Introduced new tests to validate the retrieval of assistants with locale-specific translations, ensuring correct behavior across different languages.
- Enhanced the GetHistoryWithFilter method to maintain consistent silent message filtering and pagination logic.
2025-11-07 18:59:59 +08:00
Max
e763fadc6e Remove deprecated Store interface from agent package to streamline codebase and improve maintainability. 2025-11-07 18:30:37 +08:00
Max
447ab4c15b Refactor store imports and update store initialization logic
- Updated import paths for store packages to use specific types for better clarity and maintainability.
- Refactored store initialization in the agent to utilize the new store types for Mongo, Redis, and Xun.
- Removed deprecated store-related files to streamline the codebase and improve overall organization.
- Ensured that all references to the store in the agent files are consistent with the new structure.
2025-11-07 18:27:43 +08:00
Max
52f74e5edd Enhance assistant model handling and storage logic
- Added handling for nullable string fields in the AssistantModel, ensuring empty strings are stored as NULL in the database.
- Implemented default value assignment for the Share field, applying "private" when no value is provided.
- Introduced a new test case to verify that empty strings are correctly stored as NULL and that default values are applied as expected.
- Updated existing tests to include the Share field in various assistant scenarios, ensuring comprehensive coverage.
2025-11-07 14:43:01 +08:00
Max
1d5f27cd98 Refactor assistant handling and storage integration
- Updated assistant data handling to utilize structured models, improving code clarity and maintainability.
- Enhanced the assistant save and load functions to work with the new AssistantModel structure.
- Refactored mention handling to streamline the conversion process from raw data to structured mentions.
- Improved error handling in the assistant save process, ensuring better feedback for invalid data.
- Updated API responses to use the new gin.H format for consistency across the application.
2025-11-07 11:20:59 +08:00
Max
296a37f031
Merge pull request #1274 from trheyi/main
Refactor to decouple attachments, RAG, and AI assistant components.
2025-11-06 19:10:11 +08:00
Max
95b2547c54 Refactor to decouple attachments, RAG, and AI assistant components.
- Deleted session-related functions (UserID, GuestID, UserRoles, UserOrGuestID) from the agent package to streamline the codebase.
- Removed RAG-related code and references, simplifying the agent's architecture.
- Updated API and load functions to reflect these changes, ensuring consistency across the agent module.
- Enhanced test coverage by cleaning up deprecated test cases related to removed functionalities.
2025-11-06 19:09:44 +08:00
Max
bcaef8af08
Merge pull request #1273 from trheyi/main
Update version constants to 1.0.0 for Yao App Engine
2025-11-06 18:21:16 +08:00
Max
77d59b203e Update version constants to 1.0.0 for Yao App Engine
•	Changed VERSION and CUI constants from 0.10.5 to 1.0.0 to reflect the upcoming release.
	•	Ensured consistency in versioning across the application.

⚠️ Note: Version 1.0.0 is still under development — this PR does not represent an official release.
2025-11-06 18:20:49 +08:00
Max
e05c18e1cf
Merge pull request #1272 from trheyi/main
⚠️ BREAKING: Removed the Studio package and renamed Neo to Agent. Con…
2025-11-06 18:14:23 +08:00
Max
c54ef71d6a ⚠️ BREAKING: Removed the Studio package and renamed Neo to Agent. Configuration file path changed from neo/neo.yml to agent/agent.yml.
Remove deprecated studio package and refactor agent integration

- Deleted the studio package, which is no longer in use, to streamline the codebase.
- Updated references in the agent and chat modules to utilize the new agent package instead of the deprecated neo package.
- Ensured that all related middleware and routing functionalities are now aligned with the agent architecture, enhancing overall system coherence.
2025-11-06 18:13:54 +08:00
Max
4699f4fa24
Merge pull request #1271 from trheyi/main
Update file tests to handle content type variations
2025-11-06 11:59:02 +08:00
Max
0b88fb6098 Refactor content type assertion in file tests for improved clarity
- Adjusted the assertion for content type in the file tests to enhance readability and maintainability.
- Ensured that the content type validation remains robust while checking for variations that may include charset.
2025-11-06 11:57:59 +08:00
Max
59c32bd1f6 Update file tests to handle content type variations
- Modified assertions in file upload, retrieval, and content tests to account for content type variations that may include charset.
- Enhanced test robustness by checking that the content type starts with the expected value, improving validation accuracy.
2025-11-06 11:57:38 +08:00
Max
4f17105cd1
Merge pull request #1270 from trheyi/main
Enhance attachment upload functionality with image compression and me…
2025-11-06 11:54:02 +08:00
Max
2f6cf1a08c Enhance attachment upload functionality with image compression and metadata caching
- Introduced new fields for image compression options in the UploadChunk struct, allowing for better handling of image uploads.
- Updated the upload process to utilize cached compression settings from the first chunk, improving efficiency and consistency.
- Implemented a fallback mechanism for image compression, logging errors and using original files when compression fails.
- Refactored the compressStoredImage function to return the compressed size, enhancing the upload process and error handling.
2025-11-06 11:53:24 +08:00
Max
1e0d85acdf
Merge pull request #1269 from trheyi/main
Refactor file permission checks to enhance access control logic
2025-11-06 11:32:23 +08:00
Max
e435c03e0e Enhance attachment upload process and content type handling
- Updated the upload process to cache metadata from the first chunk, ensuring consistency in content type, filename, and user path across chunked uploads.
- Modified content type validation in tests to allow for charset variations, improving robustness in file type checks.
- Refactored database save logic to differentiate between new records and updates for chunked uploads, enhancing data integrity and performance.
2025-11-06 11:31:24 +08:00
Max
80d0b80a6d Refactor file permission checks to enhance access control logic
- Combined team and owner permission validation to streamline access checks for files.
- Implemented distinct validation paths for owner-only and team-only permissions, improving clarity and maintainability.
- Updated existing permission checks to ensure proper handling based on file sharing settings, enhancing security and user access management.
2025-11-06 09:44:36 +08:00
Max
6f44168b18
Merge pull request #1268 from trheyi/main
Enhance attachment management with public and share fields
2025-11-05 18:12:13 +08:00
Max
5d18e76acd Enhance attachment management with public and share fields
- Introduced new fields in the attachment model for public access control and sharing options, allowing attachments to be marked as public or shared with specific teams.
- Updated the upload process to handle new permission fields, ensuring proper handling of public and share options during file uploads.
- Implemented permission checks in the file retrieval and deletion processes to enforce access control based on user roles and attachment settings.
- Added comprehensive tests for the new permission fields to validate functionality and ensure correct behavior in various scenarios.
2025-11-05 18:11:36 +08:00
Max
94933cdb81
Merge pull request #1267 from trheyi/main
Remove unnecessary blank line in HasJobAccess function for cleaner code.
2025-11-05 14:23:02 +08:00
Max
27d8378511 Remove unnecessary blank line in HasJobAccess function for cleaner code. 2025-11-05 14:22:40 +08:00
Max
362fe21974
Merge pull request #1266 from trheyi/main
Enhance job and execution access control with authorization checks
2025-11-05 14:15:24 +08:00
Max
7feb3e7c7a Enhance job and execution access control with authorization checks
- Added authorization checks in ListExecutions, GetExecution, StopExecution, and GetExecutionProgress functions to ensure users have access to the respective jobs and executions.
- Implemented similar checks in ListJobs, GetJob, StopJob, and GetJobProgress functions to validate user permissions before performing actions.
- Introduced handling for unauthorized access attempts, returning appropriate error responses for better security and user feedback.
- Updated ListLogs and ListExecutionLogs functions to include access validation for job and execution logs.
2025-11-05 14:14:57 +08:00
Max
79cffc5cd4
Merge pull request #1265 from trheyi/main
Add Yao custom fields and enhance permission checks
2025-11-05 11:32:47 +08:00
Max
4f8f011da7 Add Yao custom fields and enhance permission checks
- Introduced new fields in the Job struct for Yao integration, including YaoCreatedBy, YaoUpdatedBy, YaoTeamID, and YaoTenantID.
- Updated the makeJob function to utilize YaoCreatedBy for setting the CreatedBy field.
- Enhanced permission checks in various functions to validate user access to collections, ensuring proper authorization handling.
- Implemented permission validation in document handling functions to restrict access based on user roles and collection settings.
2025-11-05 11:32:07 +08:00
Max
0bee90307d
Merge pull request #1264 from trheyi/main
Add permission checks for updating collection
2025-11-05 10:02:19 +08:00
Max
5c2f323e64 Add permission checks for collection removal
- Implemented authorization checks in the RemoveCollection function to ensure users have the necessary permissions before removing a collection.
- Introduced error handling for unauthorized access attempts, returning appropriate responses for permission denials.
- Enhanced security by validating user access based on their authorization information.
2025-11-05 10:01:07 +08:00
Max
d6713ecddb Add permission checks for updating collection metadata
- Implemented authorization checks in the UpdateCollectionMetadata function to ensure users have the necessary permissions before making updates.
- Introduced a new checkCollectionPermission function to validate user access based on team and owner constraints.
- Enhanced error handling to return appropriate responses for unauthorized access attempts.
2025-11-05 09:48:21 +08:00
Max
ce2c301278
Merge pull request #1263 from trheyi/main
Improve document search, seed duplicate handling, update token scopes, add user endpoints, and load scopes dynamically
2025-11-04 18:16:58 +08:00
Max
f6aead62bb Refactor scope loading to dynamically retrieve first-level subdirectories
- Introduced a new function to get first-level subdirectories in the scopes directory, enhancing the flexibility of scope definition loading.
- Updated the loadScopeDefinitions method to utilize this new function, replacing hardcoded subdirectory names with a dynamic approach.
- Improved the description of the invite verification scope in the user scope initialization for clarity.
2025-11-04 18:07:22 +08:00
Max
e1405a5fa2 Update user endpoint definitions to include profile and teams retrieval
- Added new endpoints for retrieving user profile and teams in the user scope initialization.
- Ensured the existing endpoint for team selection remains included for continued functionality.
2025-11-04 17:31:33 +08:00
Max
007cf0adb9 Update token scope references in user entry and login processes
- Changed token scope from `ScopeInviteVerification` to `ScopeEntryVerification` in both `GinVerifyInvite` and `LoginByUserID` functions to align with updated authorization requirements.
- Updated error messages to reflect the new expected scope for improved clarity in responses.
2025-11-04 16:52:03 +08:00
Max
30ed90d908 Enhance document search functionality and improve duplicate handling in seed process
- Enabled debug mode in the document search function to aid in troubleshooting.
- Updated duplicate handling logic to check for existing records before creating or updating, ensuring proper handling in reset scenarios where primary keys are present but the database is empty.
2025-11-04 16:26:31 +08:00
Max
b6df16e0a4
Merge pull request #1262 from trheyi/main
Add api_key mapping in VectorStoreConfig conversion
2025-11-03 15:40:17 +08:00