Commit graph

233 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
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
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
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
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
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
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
27d8378511 Remove unnecessary blank line in HasJobAccess function for cleaner code. 2025-11-05 14:22:40 +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
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
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
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
3b26873d56 Enhance environment variable processing in EntryConfig
- Added functionality to process SuccessURL, FailureURL, and LogoutRedirect fields in EntryConfig for environment variable substitution.
- Implemented checks to ensure that referenced environment variables exist, collecting any missing variables for further handling.
- Improved overall configuration handling by ensuring URLs are properly replaced with their corresponding environment variable values.
2025-11-03 08:16:41 +08:00
Max
7bbd0d08ca Refactor EndpointInfo struct initialization for improved readability
- Reformatted the initialization of the EndpointInfo struct in the ScopeManager to enhance code clarity and maintainability.
- Ensured consistent alignment of struct fields for better visual organization.
2025-10-31 20:55:23 +08:00
Max
6751136e6b Enhance scope management with deep copy functionality
- Implemented deep copy mechanisms for extra constraints and endpoint information to prevent shared state issues.
- Updated the `addEndpointRule` and `matchEndpoint` methods to utilize deep copies, ensuring data integrity during scope management.
- Added utility functions for deep copying maps and values, enhancing the robustness of the ACL system.
2025-10-31 20:32:22 +08:00
Max
6b38b76558 Add authorization checks and filtering in collection and document listing
- Integrated authorization information retrieval in `ListCollections` and `ListDocuments` functions to enhance security.
- Implemented permission-based filtering to ensure users can only access collections and documents they are authorized to view.
- Refactored query parameter construction for improved readability and maintainability.
2025-10-31 19:50:21 +08:00
Max
0eff0091a0 Update asset modification times and refactor import statements
- Updated the modification times for various assets in `bindata.go` to reflect recent changes.
- Refactored import statements in `team_invitation.go` to maintain consistency and improve code organization by moving the `utils` import to the correct position.
2025-10-31 11:13:57 +08:00
Max
d17832c016 Update asset metadata and enhance collection features in the API
- Updated the modification times for various assets in `bindata.go` to reflect recent changes.
- Enhanced the collection management in the API by adding new fields for `preset`, `public`, and `share` in the collection and document models, allowing for better control over collection visibility and sharing options.
- Updated the `CreateCollection` function to incorporate the new `share` field, improving the handling of collection data based on user permissions.
- Refactored utility functions to streamline type conversions, ensuring consistent data handling across the user and team management functionalities.
2025-10-31 11:05:46 +08:00
Max
0ee38a1cb3 Implement attachment wrapper parsing and Base64 conversion in attachment manager
- Added `Parse` function to handle attachment wrapper strings, extracting uploader name and file ID.
- Introduced `Base64` function to convert attachment wrappers to Base64 format, with optional data URI support.
- Enhanced `readFilePathAsBase64` to read files from the filesystem and return Base64 encoded content.
- Updated `teamInvitationGetPublic` to process team logos and inviter pictures as Base64 for direct display in the response.
2025-10-30 09:59:09 +08:00
Max
538f76e317 Add features query endpoint to user API
- Introduced a new endpoint `GET /features` to allow authenticated users to query available features.
- This addition enhances the user experience by providing access to feature-related information directly through the API.
2025-10-29 15:32:36 +08:00
Max
47934f87a7 Add feature manager support in ACL initialization
- Enhanced the ACL structure to include a new FeatureManager field, allowing for better management of feature-related permissions.
- Updated the New function to load the feature manager during ACL initialization, improving the overall functionality and logging success messages for better traceability.
2025-10-29 12:07:27 +08:00
Max
d7dc5dfd3f Fix error handling in invitation resend test
- Updated the `TestInvitationResend` function to properly handle errors when sending the invitation request, ensuring that any failures are reported during the test execution.
- This change improves the reliability of the test by providing clearer feedback on issues encountered during the invitation process.
2025-10-29 09:52:57 +08:00
Max
481a6edbd5 Enhance team invitation functionality with locale support
- Updated the invitation resend process to accept a locale parameter, allowing for locale-specific email formatting and invitation link generation.
- Modified the `teamInvitationResend` function to include locale handling, ensuring proper configuration based on the user's locale.
- Enhanced the `toString` utility function to support time formatting based on locale, improving date presentation in emails.
- Added new utility functions for locale-specific time formatting, ensuring consistent user experience across different regions.
- Expanded tests to validate the new locale handling in invitation processes, ensuring comprehensive coverage for various scenarios.
2025-10-29 09:28:55 +08:00
Max
7549a890e5 Refactor team configuration tests to remove uploader and avatar agent assertions
- Removed assertions for the uploader and avatar agent fields in the team configuration tests, as these fields are no longer preserved in the public configuration.
- Updated the GetTeamConfigPublic function to reflect the changes in the TeamConfig structure, ensuring only relevant fields are included in the public configuration.
- Adjusted test cases to maintain coverage while aligning with the updated configuration structure.
2025-10-28 17:22:44 +08:00
Max
376befc21b Add Yao member profile support in OIDC user info
- Enhanced the OIDC user info structure to include Yao member profile information, such as member ID, display name, bio, avatar, and email.
- Updated the SignIDToken and MakeOIDCUserInfo functions to incorporate member details if available, improving team context handling.
- Refactored the issueTokens function to accept a new IssueTokensParams structure, streamlining token issuance with team and member context.
- Adjusted login functions to retrieve and pass member profile data during token issuance, ensuring comprehensive user context in authentication flows.
2025-10-28 16:55:06 +08:00
Max
bf452ba1d3 Add member profile retrieval functionality
- Introduced a new endpoint `GET /teams/:team_id/members/:member_id/profile` to allow users to retrieve member profile information, including display name, bio, avatar, and email.
- Implemented the `GinMemberGetProfile` handler to process profile retrieval requests with appropriate authentication and error handling.
- Added business logic in `memberGetProfile` to ensure only authenticated users can access their own profile data.
- Expanded test cases in `TestMemberProfileGet` to validate various scenarios for profile retrieval, ensuring comprehensive coverage for authentication and data validation.
2025-10-28 16:18:52 +08:00
Max
af02a21f65 Implement member profile update functionality
- Added a new endpoint `PUT /teams/:team_id/members/:member_id/profile` to allow members to update their profile information, including display name, bio, avatar, and email.
- Introduced `UpdateMemberProfileRequest` structure to handle profile update requests.
- Enhanced the `GinMemberUpdateProfile` handler to process profile updates with appropriate validation and error handling.
- Implemented business logic in `memberUpdateProfile` to ensure only the member can update their own profile.
- Expanded test cases to validate the new profile update functionality, ensuring comprehensive coverage for various update scenarios.
2025-10-28 11:49:01 +08:00
Max
b2c7ddde19 Add new endpoint for file content retrieval
- Introduced a new API endpoint `GET /file/:uploaderID/:fileID/content` to facilitate the retrieval of file content based on uploader ID and file ID.
- This addition enhances the user capabilities for accessing file data within the application.
2025-10-28 09:28:05 +08:00
Max
8ffa767dfe Add logo support to team creation and update functionality
- Enhanced the team creation and update processes to include an optional logo field, allowing teams to have custom logos.
- Updated the CreateTeamRequest and UpdateTeamRequest structures to accommodate the new logo field.
- Modified the GinTeamCreate and GinTeamUpdate handlers to handle logo data appropriately.
- Expanded test cases for team creation and updates to validate logo handling, ensuring comprehensive coverage for scenarios involving logos.
2025-10-27 17:46:25 +08:00
Max
7572f99ba0 Enhance robot member functionality with avatar support
- Added avatar field to CreateRobotMemberRequest and UpdateRobotMemberRequest structures, allowing for avatar URL or file ID during member creation and updates.
- Updated GinMemberCreateRobot and GinMemberUpdateRobot handlers to process avatar information, ensuring it is included in the member data.
- Expanded test cases for member creation and updates to validate avatar handling, including scenarios for updating only the avatar without affecting other fields.
- Enhanced team configuration tests to verify preservation of uploader and avatar agent fields, improving overall test coverage and reliability.
2025-10-27 16:45:10 +08:00
Max
26b690246d Refactor test case for member update to remove unnecessary whitespace
- Cleaned up the `TestMemberUpdateRobot` function by removing redundant blank lines, improving code readability and maintainability.
2025-10-27 13:43:27 +08:00
Max
1e01ed768e Implement robot member update functionality with comprehensive validation
- Added the `UpdateRobotMember` method to handle updates for robot members, including validation for member existence, type checks, and email uniqueness.
- Introduced a new `UpdateRobotMemberRequest` structure to facilitate updates via the API, allowing for modifications to various fields such as `robot_email`, `status`, and `autonomous_mode`.
- Enhanced the `GinMemberUpdateRobot` handler to process update requests, ensuring proper authentication and error handling for various scenarios.
- Expanded test coverage with new test cases for the robot member update functionality, validating successful updates, error conditions, and edge cases.
- Refactored existing member management logic to integrate the new update capabilities, improving overall system robustness and user experience.
2025-10-27 12:05:11 +08:00
Max
7de562f80d Update robot member functionality with new fields and validation
- Introduced the `robot_email`, `authorized_senders`, and `email_filter_rules` fields to the robot member model, enhancing the configuration options for robot members.
- Updated the member creation and existence check logic to ensure the uniqueness of `robot_email` globally, improving data integrity.
- Refactored API endpoints and request/response structures to accommodate the new fields, ensuring consistency across the member management system.
- Enhanced test cases to validate the new robot member features, including scenarios for email uniqueness and configuration updates, improving overall test coverage and reliability.
2025-10-27 11:34:07 +08:00
Max
772c00e095 Enhance member listing functionality with advanced filtering and sorting
- Introduced a new MemberListRequest structure to support advanced filtering options such as status, member_type, role_id, email, and display_name.
- Updated the GinMemberList handler to parse and validate query parameters, improving user experience with clearer error messages for invalid inputs.
- Enhanced the memberList function to handle advanced filtering and sorting, allowing for more flexible and efficient member retrieval.
- Added comprehensive test cases to validate new filtering and sorting functionalities, ensuring robust coverage and reliability in member listing scenarios.
- Refactored existing member response structures to include new fields and improve data representation.
2025-10-26 14:10:04 +08:00
Max
420a17f844 Enhance member model and team management with is_owner field
- Added the is_owner field to the member model to indicate if a member is the team owner, improving clarity and performance for queries related to team ownership.
- Updated the team creation process to automatically set the is_owner field for the creator of the team, ensuring accurate member status upon creation.
- Refactored related tests to verify the correct assignment of the is_owner field, enhancing test coverage and reliability in team membership scenarios.
- Removed redundant permission and restriction fields from the member model to streamline the data structure and improve maintainability.
2025-10-26 12:25:15 +08:00
Max
40b0c449f1 Enhance robot member creation with additional fields
- Added new fields to the robot member creation process, including permissions, restrictions, notes, and metadata, to improve the flexibility and detail of robot member configurations.
- Updated the AddMember function to include tracking of the user who invited the member and the team ID, enhancing member management and accountability.
- These changes improve the overall functionality and usability of the member management system.
2025-10-26 11:31:50 +08:00
Max
f71ce2ac9a Implement existence checks for various entities in update functions
- Added functions to check the existence of invitation codes, members, OAuth accounts, roles, teams, and user types before performing updates, enhancing error handling and user feedback.
- Updated relevant update functions to utilize these existence checks, ensuring accurate error messages when no changes are made or when entities do not exist.
- Refactored tests to validate the new existence check logic, improving overall test coverage and reliability.
2025-10-26 11:09:07 +08:00
Max
5f6f8d7911 Enhance member management with member_id and email checks
- Introduced member_id as a unique identifier for members, improving data integrity and consistency across member operations.
- Updated member-related functions to utilize member_id instead of internal IDs, enhancing API usability and clarity.
- Implemented email existence checks for team members, allowing for better validation during member creation and updates.
- Refactored existing tests to accommodate changes in member identification and email validation, ensuring comprehensive coverage and reliability.
- Added new API endpoint for checking if an email exists within a team, improving user experience during member management.
2025-10-26 09:49:45 +08:00