mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-02 20:32:39 +02:00
feat: enhance LLM response handling and token usage tracking in chat services and UI components
This commit is contained in:
parent
5510c1de03
commit
f21bdc0668
4 changed files with 67 additions and 37 deletions
|
|
@ -4,6 +4,10 @@ Token usage tracking via LiteLLM custom callback.
|
|||
Uses a ContextVar-scoped accumulator to group all LLM calls within a single
|
||||
async request/turn. The accumulated data is emitted via SSE and persisted
|
||||
when the frontend calls appendMessage.
|
||||
|
||||
Agent LLM calls are captured automatically via the async callback.
|
||||
Title-generation usage is added explicitly from the LangChain response
|
||||
metadata to avoid callback-timing issues.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue