-
Notifications
You must be signed in to change notification settings - Fork 3k
improvement(usage): update usage limit in realtime, standardize token output object across providers #2553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…en object type across providers
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR standardizes token field naming across all AI providers from Key Changes:
Implementation Quality: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant WorkflowExec as Workflow Execution
participant Provider as AI Provider
participant Logger as Execution Logger
participant UsageLog as Usage Log DB
participant QueryClient as Query Client
participant UI as User Interface
User->>WorkflowExec: Execute workflow
WorkflowExec->>Provider: Request with model params
Provider-->>WorkflowExec: Response with tokens {input, output, total}
WorkflowExec->>Logger: Log execution with standardized tokens
Logger->>Logger: Merge costs (backward compat: prompt→input, completion→output)
Logger->>UsageLog: Batch insert usage records
WorkflowExec->>QueryClient: setTimeout(invalidateQueries, 1000ms)
QueryClient->>UI: Refetch subscription/usage data
UI-->>User: Display updated usage in real-time
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
apps/sim/lib/logs/execution/logger.ts, line 62-63 (link)logic: token fields still use old
prompt/completionnames instead ofinput/outputthe
calculateCostSummaryfunction inlogging-factory.tsnow returns models withinput/outputtoken fields, but this merge function still expectsprompt/completion, causing token data to be lost during model cost merging
28 files reviewed, 1 comment
|
merge has the new format ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
apps/sim/lib/logs/execution/logger.ts, line 62-63 (link)logic: still using old
prompt/completionkeys instead ofinput/output
28 files reviewed, 2 comments
… output object across providers (#2553) * improvement(usage-limit): update usage in real time, fix token output object * updated tokenBreakdown to tokens, standardized input/output/total token object type across providers * update remaining references * ack PR comment * remove singleton query client instance from hooks, leave only in zustand
Summary
Type of Change
Testing
Tested manually
Checklist