Commit graph

53 commits

Author SHA1 Message Date
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
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
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
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
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
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
Max
fd10a058b1 Implement robot member creation and validation
- Introduced a new endpoint for creating robot members, enhancing the member model to include fields specific to robots such as email, system prompt, and autonomous mode.
- Refactored existing member creation logic to accommodate robot-specific requirements and ensure email uniqueness within teams.
- Updated request and response structures to support the new robot member functionality, improving API consistency.
- Added comprehensive test cases to validate the new robot member creation process, including scenarios for required fields, duplicate emails, and invalid inputs.
2025-10-26 09:04:22 +08:00
Max
b5812a7f2f Add Neo loading in test preparation
- Integrated Neo loading in the Prepare function of testutils.go to ensure the Neo environment is initialized before running tests.
- Updated error handling to log failures in loading Neo, enhancing test reliability and feedback.
- Adjusted variable assignment for Knowledge Base loading to maintain consistency in error handling.
2025-10-25 16:43:28 +08:00
Max
0abb8c7d3b Update user status in test cases from "enabled" to "active"
- Modified the user creation functions in entry_test.go and invitation_test.go to use "active" as the status value instead of "enabled", aligning with the valid enum values for user status.
- This change ensures consistency across user-related tests and improves clarity regarding user status representation.
2025-10-25 14:59:57 +08:00
Max
ddf8fd7a32 Refactor test utilities and enhance access token handling
- Introduced ObtainAccessTokenWithRootPermission function to streamline the creation of test users with root permissions, ensuring consistent access token generation for tests.
- Updated various test cases to utilize the new function, improving clarity and reducing redundancy in access token acquisition.
- Enhanced team configuration retrieval to expose public settings while hiding sensitive information, improving security in API responses.
2025-10-25 13:26:51 +08:00
Max
7aff66e3b4 Enhance ACL enforcement and logging for improved error handling
- Added detailed logging for ACL enforcement failures in the OAuth guard, providing clearer insights into permission issues.
- Updated error messages in the ACL enforcement logic to include contextual information such as client and user IDs, enhancing debugging capabilities.
- Introduced new constraints (CreatorOnly, EditorOnly) in the data access model, allowing for more granular control over data visibility based on user roles.
- Enhanced scope definitions to support additional constraints, improving flexibility in access control configurations.
- Updated documentation to reflect changes in data constraints and their usage in API handlers.
2025-10-22 09:51:06 +08:00
Max
e96896eb40 Implement detailed ACL enforcement logic and data access constraints
- Refactored the ACL enforcement process to include a comprehensive chain of permission checks for clients, users, teams, and members.
- Introduced data access constraints (OwnerOnly, TeamOnly) to enhance access control based on endpoint requirements.
- Updated the Error struct to include the stage of permission checks where failures occur, improving error reporting.
- Enhanced scope management with wildcard matching capabilities and added checks for restricted scopes.
- Implemented tests to validate the enforcement logic and ensure correct handling of data access constraints.
2025-10-21 17:04:20 +08:00
Max
8e31f43039 Enhance ACL configuration and role management integration
- Updated ACL configuration to include Cache and Provider fields for improved role management.
- Initialized Role Manager within the ACL setup, ensuring proper role handling and cache management.
- Enhanced tests to verify access denial and error handling for unmatched endpoints, improving overall test coverage and clarity in error responses.
2025-10-21 10:51:26 +08:00
Max
0e260ffb6a Enhance OAuth guard with authorized info handling and ACL integration
- Updated the OAuth guard to set authorized information in the context using the new authorized package.
- Refactored the GetAuthorizedInfo function to utilize the authorized.GetInfo method, improving clarity and maintainability.
- Enhanced the ACL implementation by adding scope resolution logic in the Enforce method, ensuring proper access control based on user roles and scopes.
- Improved error handling and logging during ACL operations, providing better insights into access decisions.
2025-10-20 08:50:20 +08:00
Max
481323104a Implement deep copy for entry configuration to prevent global config corruption
- Added a new function, createPublicEntryConfig, to create a deep copy of EntryConfig without sensitive data, ensuring that global configuration remains intact when returning public config.
- Updated entry verification logic to utilize EntryVerificationStatus for clearer status handling during user verification.
- Enhanced tests to verify that the global config is not modified after multiple requests for public entry configuration, addressing a critical bug related to captcha secret exposure.
2025-10-15 19:32:40 +08:00
Max
c4ecda54e9 Refactor captcha handling in tests and core functionality
- Updated captcha test cases to utilize the new CaptchaGet function for retrieving captcha answers, improving test reliability.
- Refactored CaptchaMake and CaptchaValidate functions to leverage a new utils package for better encapsulation and maintainability.
- Enhanced error handling and logging in captcha-related processes, contributing to a more robust user experience during authentication.
- Streamlined the captcha generation process by integrating with the utils.captcha package, ensuring consistency across the codebase.
2025-10-15 15:43:16 +08:00
Max
d1a9e5c892 Refactor user authentication to unify entry configuration handling
- Renamed and updated functions and tests to replace 'login' terminology with 'entry', reflecting the unified handling of login and registration processes.
- Removed deprecated login configuration functions and structures, streamlining the codebase.
- Enhanced test coverage for entry configuration retrieval and validation, ensuring comprehensive testing of the new unified approach.
- Improved error handling and logging for entry configuration scenarios, contributing to a better user experience during authentication.
2025-10-15 11:16:54 +08:00
Max
721f47c345 Enhance invitation acceptance flow with invitation ID support
- Updated the AcceptInvitation method to require both invitation ID and token, improving the invitation acceptance process.
- Modified related tests to accommodate the new invitation ID parameter, ensuring comprehensive coverage of acceptance scenarios.
- Enhanced the invitation acceptance endpoint to validate invitation ID, providing clearer error handling for invalid or expired invitations.
- Refactored tests to include detailed scenarios for accepting invitations, including success and failure cases, ensuring robust testing of the invitation flow.
2025-10-14 11:58:20 +08:00
Max
cf42d255d3 Enhance invitation handling and team configuration tests
- Updated the invitation creation response to return complete invitation details, including the invitation token.
- Improved error handling when retrieving created invitations, ensuring fallback to ID return on failure.
- Modified team configuration tests to require authentication, reflecting recent API changes.
- Added access token retrieval for authenticated requests in team configuration tests, enhancing security and compliance.
2025-10-08 17:56:56 +08:00
Max
ca2344edb8 Refactor invitation handling and improve test coverage
- Updated invitation creation logic to support email invitations and customizable expiry durations.
- Enhanced tests for invitation creation, including scenarios for registered and unregistered users, and handling of missing email requirements.
- Refactored API endpoints to use consistent parameter naming for team IDs.
- Improved error handling and logging for invitation-related operations, ensuring clarity in failure cases.
- Added support for sending invitation emails through the messenger service, with appropriate templates and settings.
2025-10-08 16:16:49 +08:00
Max
d113adaa8a Refactor test files to improve readability and consistency
- Cleaned up whitespace in user configuration validation and environment variable extraction tests.
- Enhanced logging statements for better clarity during test execution.
- Standardized formatting across test cases to improve maintainability.
2025-10-07 10:32:35 +08:00
Max
9044d4c30a Enhance user login and team configuration management
- Updated login configuration tests to clarify endpoint descriptions.
- Introduced team configuration loading and retrieval functionality, including new endpoints for public access to team configurations.
- Refactored team management routes to standardize parameter usage and improve clarity.
- Added error handling for missing environment variables in client configuration.
- Implemented team configuration types and related structures for better organization and usability.
2025-10-07 10:23:43 +08:00
Max
b9a912b7d9 Enhance member invitation management and related functionality
- Introduced invitation_id handling for member management, allowing for unique identification of pending invitations.
- Added methods to create, update, and remove members by invitation_id, improving the invitation workflow.
- Updated member data structures and API responses to include invitation-related fields, enhancing clarity and usability.
- Implemented tests for invitation ID operations, ensuring robust validation and error handling.
- Refactored team access checks to streamline member management processes.
2025-09-23 17:47:43 +08:00
Max
35afc1d58c Add team ownership and membership checks in user management
- Introduced IsTeamOwner and IsTeamMember methods to verify user ownership and membership status within a team.
- Added CheckTeamAccess method to assess a user's access level, returning ownership and membership status.
- Enhanced user types with new MemberResponse and MemberDetailResponse structures for improved member management.
- Updated routing for team member management to utilize new handler functions for clarity and consistency.
2025-09-23 16:14:42 +08:00
Max
9aff88d2fc Add team member removal functionality and related tests
- Implemented RemoveAllTeamMembers method in DefaultUser to delete all members from a team during team deletion.
- Added TestTeamDeleteMemberCleanup to verify that all members are removed when a team is deleted.
- Refactored team creation and deletion logic to ensure proper member management and error handling during these operations.
2025-09-23 11:24:57 +08:00
Max
abeae77619 Remove unnecessary blank line in test utility function to enhance code clarity. 2025-09-23 10:30:10 +08:00
Max
5a894c11ab Add authorized info handling and session ID retrieval in OAuth guard
- Introduced methods to set and retrieve authorized information from the context, enhancing the OAuth guard functionality.
- Added a new `AuthorizedInfo` type to encapsulate user-related data such as subject, client ID, user ID, and scope.
- Implemented session ID retrieval from various sources (cookies, headers, query strings) to improve session management.
- Updated test utilities to support the creation of test users and access tokens, ensuring comprehensive testing of OAuth functionalities.
2025-09-23 10:22:52 +08:00
Max
7977b7f48e Remove signin module and refactor OpenAPI to eliminate signin dependencies
- Deleted the entire signin module, including related files and configurations, to streamline the authentication process.
- Updated OpenAPI to remove references to signin, including the loading of signin configurations and associated handlers.
- Refactored user authentication routes to integrate captcha functionality directly within the user module, enhancing user experience and security.
- Adjusted routing structure to reflect the removal of signin, ensuring clarity and consistency in user management operations.
2025-09-22 11:04:00 +08:00
Max
54d7120626 Fix formatting in OAuth authorization test for improved readability
- Removed unnecessary blank line in TestUserOAuthAuthorizationURLParameters to enhance code clarity and maintain consistency in test formatting.
2025-09-18 09:11:09 +08:00
Max
a6e1f6e382 Add user configuration loading and update authentication routes
- Integrated user configuration loading in the OpenAPI server initialization to enhance user management capabilities.
- Migrated authentication routes from /signin to /login, updating handler functions for clarity and consistency.
- Adjusted OAuth provider routes to reflect new paths, improving the overall routing structure for user authentication.
2025-09-18 09:02:54 +08:00
Max
91d67d3b54 Enhance collection management and segment handling in the API
- Added GetCollection endpoint to retrieve collections by ID, including error handling for missing IDs and uninitialized knowledge base.
- Updated CreateCollectionConfig to use more descriptive field names for embedding provider and option IDs.
- Refactored UpdateSegments function to improve validation and error handling, ensuring document IDs and segment texts are properly checked.
- Introduced new request structures for updating votes, scores, and weights for segments, enhancing the API's capabilities.
- Removed the outdated vote handling file to streamline the codebase.
2025-08-20 18:25:28 +08:00
Max
6acea5b004 Refactor extractor to extraction provider and update related configurations
- Renamed extractor provider to extraction provider across the codebase for consistency and clarity.
- Updated references in configuration files, provider factories, and asset management to reflect the new terminology.
- Removed the extractor provider implementation and associated test files, streamlining the provider structure.
- Adjusted test cases and documentation to align with the new extraction provider framework.
2025-08-13 16:32:30 +08:00
Max
fe49cc5fa1 Update collection tests to reflect new embedding provider configuration
- Modified test cases for CreateCollection, RemoveCollection, and CollectionIntegration to use the new embedding provider and option values.
- Removed outdated fields related to the previous embedding model and added locale support for provider reading.
- Ensured consistency in the configuration structure across all relevant tests.
2025-08-12 11:10:35 +08:00
Max
5301023cf2 Refactor user provider methods to return string IDs and update test data handling
- Updated GetUserProvider to return an error alongside the user provider for better error handling.
- Modified CreateUser, CreateRole, and CreateType methods to return user and role IDs as strings instead of interfaces, enhancing type safety.
- Adjusted test data setup in oauth_test.go to reflect changes in user ID handling and ensure compatibility with the updated user provider interface.
- Removed unnecessary nil checks and improved assertions in tests for clarity and reliability.
2025-08-03 10:25:09 +08:00
Max
97f053e41d Refactor provider retrieval and configuration loading for signin module
- Updated GetProvider function to retrieve providers using only the provider ID, removing locale dependency.
- Introduced a global providers map to decouple provider configurations from locale-specific settings.
- Enhanced Load function to prioritize loading provider configurations before signin configurations.
- Added new helper functions for loading providers and signin configurations, improving code organization and maintainability.
- Updated tests to reflect changes in provider handling and ensure proper functionality.
2025-08-03 08:51:03 +08:00
Max
409151037a Add Cloudflare Turnstile configuration and enhance OAuth handling in Signin API
- Added Cloudflare Turnstile site key and secret to the environment variables in both `pr-test.yml` and `unit-test.yml` workflows.
- Introduced a new endpoint in the Signin API for generating OAuth authorization URLs, improving support for third-party authentication providers.
- Enhanced the handling of OAuth provider configurations, including validation and error responses for missing or incomplete settings.
- Updated tests to cover the new OAuth authorization URL functionality and ensure sensitive data is not exposed in public configurations.
2025-07-30 20:19:55 +08:00
Max
315618da47 Add Signin API and update file management endpoints
- Introduced a comprehensive Signin API for user authentication, supporting multiple OAuth providers (Google, GitHub, Microsoft, Apple).
- Updated the file management API endpoints to use a singular `/file` path instead of `/files`, enhancing consistency across the API.
- Revised README documentation to include detailed descriptions of the new Signin API and updated file management endpoints.
- Enhanced test cases to reflect the changes in endpoint structure and ensure robust coverage for the new Signin functionality.
2025-07-30 16:49:28 +08:00
Max
070ff59225 Enhance attachment management with file storage improvements
- Refactored the attachment manager to support file uploads with a new storage path and improved metadata handling.
- Implemented chunked uploads and direct content retrieval, enhancing performance and flexibility.
- Updated the file management API to include comprehensive operations for file uploads, downloads, and metadata management.
- Added support for multiple storage backends, including local and S3, with improved error handling and validation.
- Enhanced test coverage for file operations, ensuring reliability and consistency across different storage implementations.
2025-07-26 19:25:41 +08:00