Commit Graph

30 Commits

Author SHA1 Message Date
Marvin Zhang
67b51fdc83 refactor: update LLMResponseUsage struct and ChatMessage usage aggregation
- Renamed fields in LLMResponseUsage struct to better reflect their purpose, changing InputTokens and OutputTokens to PromptTokens and CompletionTokens.
- Modified GetUsage method in ChatMessage to accept an optional contents parameter, improving flexibility in usage tracking.
- Ensured consistent field naming and improved clarity in token usage aggregation logic.
2025-04-14 16:29:32 +08:00
Marvin Zhang
8273507d20 refactor: update LLMResponseUsage struct and ChatMessage model for BSON compatibility
- Added BSON tags to fields in LLMResponseUsage struct to ensure proper serialization with MongoDB.
- Updated the Usage field in ChatMessage model to exclude it from JSON serialization while retaining BSON compatibility.
- Introduced GetUsage method in ChatMessage to aggregate token usage from contents, enhancing usage tracking capabilities.
2025-04-12 21:25:57 +08:00
Marvin Zhang
2549abdc61 feat: introduce LLMResponseUsage struct and update ChatMessage models
- Added LLMResponseUsage struct to encapsulate token usage details for language model responses.
- Updated ChatMessageContent and ChatMessage models to include a Usage field of type *entity.LLMResponseUsage, enhancing message handling capabilities.
- Improved structure and clarity of models by ensuring consistent field definitions and descriptions.
2025-04-11 22:29:02 +08:00
Marvin Zhang
c713416a91 refactor: standardize sorting direction constants and JSON annotations
- Updated DESCENDING constant from "dsc" to "desc" for clarity and consistency.
- Changed JSON annotation for Direction field in Sort struct from "d" to "direction" to improve readability and maintainability.
- Ensured alignment with existing coding standards and practices across the codebase.
2025-03-19 18:15:17 +08:00
Marvin Zhang
43d1c7692b refactor: standardize response types across controllers
- Updated multiple controller methods to return VoidResponse instead of generic Response[any].
- Consolidated error handling to utilize GetErrorVoidResponse for consistent error responses.
- Enhanced parameter handling in export and file management functions for improved clarity and maintainability.
- Refactored health check and login/logout methods to align with new response structure.
- Improved overall consistency in response formatting across various endpoints.
2025-03-16 22:25:13 +08:00
Marvin Zhang
41e973a4d3 fix: misaligned nodes when running tasks from a schedule through enhancement by adding new route and handler for running schedules
- Introduced a new POST endpoint '/:id/run' in the router to trigger the execution of a schedule.
- Implemented the PostScheduleRun function to handle the execution logic, including validation of input parameters and scheduling tasks.
- Refactored the PostSpiderRun function to streamline the scheduling process by directly calling the admin service.
- Updated the FsFileInfo struct to clarify the children field description.
- Modified the Task model to make NodeIds field optional in JSON serialization.
2024-12-21 15:33:07 +08:00
Marvin Zhang
c897fb58e4 refactor: streamline error handling and improve HTTP request management
- Removed the print flag from handleError function, simplifying error logging based on the development environment.
- Introduced a new performRequest function for standardized HTTP requests with JSON bodies, enhancing code reusability.
- Updated SendIMNotification and related functions to utilize the new RequestParam type for better clarity and consistency.
- Normalized HTTP request paths in the createHttpRequest method to ensure correct URL formatting.
- Added detailed error logging for JSON unmarshaling failures in syncFiles method.
- Introduced a NewHttpClient function to create HTTP clients with customizable timeouts.
2024-12-21 11:27:58 +08:00
Marvin Zhang
24561bcbe0 refactor: optimized code 2024-11-24 23:14:26 +08:00
Marvin Zhang
a3b286558b refactor: consolidated configs 2024-11-18 16:48:09 +08:00
Marvin Zhang
a0989d36db feat: optimized dependency logic 2024-11-05 18:21:52 +08:00
Marvin Zhang
73674832b8 feat: optimized dependency api 2024-11-04 00:16:42 +08:00
Marvin Zhang
d9b327de17 refactor: code cleanup 2024-11-01 15:19:48 +08:00
Marvin Zhang
418af7c215 refactor: code cleanup 2024-10-20 17:17:08 +08:00
Marvin Zhang
4f52936ad8 refactor: integrated database services into task data insert 2024-10-08 18:41:36 +08:00
Marvin Zhang
64d664b307 feat: updated database model 2024-09-29 16:54:22 +08:00
Marvin Zhang
204021d962 feat: updated database model 2024-09-23 15:33:26 +08:00
Marvin Zhang
4807c0a497 feat: added database table rows crud 2024-09-11 17:45:04 +08:00
Marvin Zhang
aa0cb96936 feat: added index operations for mysql service 2024-09-04 17:07:32 +08:00
Marvin Zhang
f566689738 feat: updated database services 2024-09-02 19:01:58 +08:00
Marvin Zhang
a8ab6af7b2 feat: updated database services 2024-08-29 17:21:18 +08:00
Marvin Zhang
08d1acb15e feat: added hash to models 2024-08-26 18:33:46 +08:00
Marvin Zhang
fdea835d53 feat: added modify table 2024-08-18 22:01:55 +08:00
Marvin Zhang
1197c05316 🚀 feat: add IsDefault field to DatabaseV2 model
🔨 refactor: modify GetDatabaseList, GetDatabaseById, PostDatabaseTestConnection, and GetDatabaseMetadata functions
🐞 fix: GetDatabaseById and GetMetadata functions in MongoService
🔧 chore: add GetDefaultDatabase and GetDatabaseById functions to utils file
2024-08-06 15:35:36 +08:00
Marvin Zhang
5e73467883 feat: Update database models to use DatabaseV2 instead of DataSourceV2
This commit updates the database models and related functions to use the new DatabaseV2 struct instead of the deprecated DataSourceV2 struct. This change ensures consistency and clarity in the codebase.
2024-08-06 11:34:16 +08:00
Marvin Zhang
8c79d51a5a refactor: Update SendNotification function to handle old and new settings triggers 2024-07-16 17:54:06 +08:00
Marvin Zhang
b7cafb4623 refactor: Update SendNotification function to handle old and new settings triggers 2024-07-15 17:34:04 +08:00
Marvin Zhang
972713959f feat: updated grpc for dependencies service 2024-06-15 23:25:24 +08:00
Marvin Zhang
6a60433d25 feat: added modules 2024-06-14 16:37:48 +08:00
Marvin Zhang
dc21bce11f feat: added modules 2024-06-14 15:59:48 +08:00
Marvin Zhang
0b67fd9ece feat: added modules 2024-06-14 15:42:50 +08:00