Skip to content

v.2.4.0

Latest

Choose a tag to compare

@huynhbaoking112 huynhbaoking112 released this 04 May 15:14
· 55 commits to main since this release
9202544

Release 2.4.0

Overview

This release introduces a complete In-App Notification System, Stock Research Scheduling, KBS Stock Price Source Migration, Stock Financial Reports, and multiple runtime improvements including LangSmith monitoring and token-trimming middleware.


Key Highlights

1) In-App Notification System (PR #34)

  • Introduced a full notification domain: Notification model, schemas, repository (notification_repo.py), and service (notification_service.py).
  • Added notification types registry (notification_types.py) and dedicated exception classes.
  • New REST API endpoint GET /api/v1/notifications for fetching the authenticated user's inbox (with pagination and read/unread filter).
  • Real-time delivery via Socket.IO — notifications are pushed to the user's room when triggered.
  • Stock research service now emits in-app notifications automatically when a report completes or fails.
  • Frontend integration guide: doc/feature/notifications/frontend_integration_guide.md.
  • Full unit and integration test coverage for repo, service, and API.

2) Stock Research Runtime Metadata Tracking (PR #35)

  • Extended StockResearchReport model and schema with runtime metadata fields (provider, model, token usage, execution time, etc.).
  • Updated the stock research service to persist and expose runtime metadata on each report.
  • Added stock_research_runtime_metadata_frontend_guide.md for frontend consumers.
  • All related unit and integration tests updated.

3) Stock Research Scheduling System (PR #36)

  • New scheduling domain: StockResearchSchedule + schedule-run models, schemas, and repositories.
  • Schedule calculation engine (stock_research_schedule_calculator.py) supporting daily, weekly, and custom cron frequencies.
  • Dispatcher service (stock_research_schedule_dispatcher_service.py) for enqueuing due scheduled jobs.
  • Redis-backed async worker (stock_research_worker.py) that executes scheduled stock research runs.
  • New public API endpoints under /api/v1/stock_research/schedules (create, list, get, update, delete).
  • Internal API route for triggering dispatching of due schedules.
  • New env variable required: STOCK_RESEARCH_QUEUE_NAME (see .env.example).

4) Research Agent Runtime Improvements (standalone commits, 2026-04-27)

  • LangSmith Monitoring: Central LangSmith config and automatic tracing injected into the stock research worker.
  • Token-Trimming Middleware: New truncate middleware that trims oversized context windows before LLM calls.
  • Token & Message Trigger Tuning: Updated token count thresholds and message triggers for the research agent.
  • Summary Research Update: Updated summary step to align with the latest search flow.
  • Default Provider: Updated default LLM provider fallback logic.
  • System Prompt Migration: Migrated research agent system prompt to the latest search-flow version.

5) KBS Stock Price Source Migration (PR #37)

  • Migrated stock price data source from VCI to the KBS provider for improved data coverage.
  • StockCompanyEventItem.id now accepts str | int to handle both KBS and VCI formats.
  • Reworked price_gateway.py and price_service.py for KBS adapter with isolated caching logic.
  • Updated StockPriceTimeseries schema to accommodate new KBS field mappings.
  • Full test coverage updated: gateway, service, and integration tests.

6) Stock Financial Reports (PR #39)

  • New StockFinancialReport schema covering income statement, balance sheet, and cash flow report types.
  • KBS financial report gateway (financial_report_gateway.py) to fetch quarterly/annual financials from KBS.
  • Caching service (financial_report_cache.py) with TTL-based cache to reduce redundant API calls.
  • Orchestration service (financial_report_service.py) for validation and data transformation.
  • New API routes added to the stocks router for income statement, balance sheet, and cash flow endpoints.
  • Frontend integration guide: doc/feature/stocks/stock_financial_report_frontend_guide.md.
  • Full unit and integration test coverage.

Included PRs

  • #34 King/feat/notification
  • #35 King/chore/meta_research
  • #36 King/feat/scheduler_job
  • #37 King/feat/migrate_kbs
  • #39 King/feat/financial_report

Additional Standalone Commits (2026-04-27)

  • 206fa6db Migrate system prompt of research agent to search flow latest
  • 5872f685 Summary research: DONE
  • 7575b3d5 Update trim token and token trigger
  • 2b88ad4e Default provider update
  • ee97e00f Implement central LangSmith config and track into worker
  • 4b7f2821 Add LangSmith monitoring
  • a4134ac9 Update estimated content of fetch_tool by token
  • 70d21882 Implement truncate middleware
  • 38199856 Update message trigger
  • 9254c506 Update token trigger and trim tokens

Compatibility Notes

  • No breaking changes to existing public APIs.
  • New env variable required for scheduling: STOCK_RESEARCH_QUEUE_NAME (see .env.example).
  • Frontend updates recommended to use: notification inbox API, scheduling endpoints, financial report endpoints, and runtime metadata on stock research reports.
  • KBS migration is transparent for API consumers; StockCompanyEventItem.id type widened to str | int.