feat: add missing queue handlers for batch operations and code improvements#820
Open
Husainbw786 wants to merge 1 commit intomainfrom
Open
feat: add missing queue handlers for batch operations and code improvements#820Husainbw786 wants to merge 1 commit intomainfrom
Husainbw786 wants to merge 1 commit intomainfrom
Conversation
…ements - Add handlers for update_batch_history and save_batch_metrics (Python publishes these) - Move inline Mongoose schema to AgentMemory.model.js - Add input validation guards in all service functions - Move hardcoded GPT memory prompt to prompts.config.js - Increase batchSize from 1 to 10 for better throughput Handlers added: - saveSubThreadIdAndName.service.js - validateResponse.service.js - totalTokenCalculation.service.js - chatbotSuggestions.service.js - handleGptMemory.service.js (with config-based prompt) - saveToAgentMemory.service.js (uses AgentMemory model) - saveFilesToRedis.service.js - sendApiHitEvent.service.js - broadcastResponseWebhook.service.js - updateBatchHistory.service.js (NEW - writes to PostgreSQL) - saveBatchMetrics.service.js (NEW - writes to Timescale) Ref: PR #819
Contributor
|
PR review rate limit exceeded |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds missing queue handlers that were identified in the code review of PR #819. Python is publishing message types that Node.js had no handlers for, causing data to be dropped.
Changes
New Queue Handlers
updateBatchHistory- Updates conversation_logs for batch processing results (writes to PostgreSQL)saveBatchMetrics- Saves batch metrics to Timescale DBCode Quality Improvements
Moved inline Mongoose schema to proper model file
src/mongoModel/AgentMemory.model.jswith proper schema definitionsaveToAgentMemory.service.jsnow imports from the model fileAdded input validation guards
Moved hardcoded prompt to config
src/configs/prompts.config.jsfor centralized prompt managementhandleGptMemory.service.jsnow usesGPT_MEMORY_PROMPTconstantIncreased batchSize from 1 to 10
logQueueConsumerConfigFiles Created
src/consumers/logQueueConsumer.js- Main consumer with all handlerssrc/services/logQueue/- Service files for each handler typesrc/mongoModel/AgentMemory.model.js- Extracted Mongoose modelsrc/configs/prompts.config.js- Centralized prompts configFiles Modified
src/consumers/index.js- Added log queue consumer registrationsrc/configs/constant.js- Added canonicalizer bridge_idEnvironment Variables
To enable the log queue consumer, set:
Reference
Related to PR #819 (this is a separate PR as requested)