Skip to content

feat(logs): add token consumption to app dashboard and usage records - #7733

Open
ChanZany wants to merge 1 commit into
labring:mainfrom
ChanZany:feat/add-token-statistics-in-setting-usages
Open

feat(logs): add token consumption to app dashboard and usage records#7733
ChanZany wants to merge 1 commit into
labring:mainfrom
ChanZany:feat/add-token-statistics-in-setting-usages

Conversation

@ChanZany

Copy link
Copy Markdown

feat(logs): add token consumption to app dashboard and usage records

Neither MongoDB app chat logs nor the wallet usage endpoints carried token
usage, so the cumulative token card and the token trend charts rendered as
zeros in both the app dashboard and the usage dashboard.

Engine

  • collect the root node inputTokens/outputTokens into
    NodeResponseWriteSummary and $inc totalInputTokens/totalOutputTokens on
    app_chat_logs, matching the existing totalPoints semantics
  • extend AppChatLogSchema and the chat log mongoose schema accordingly

Contracts

  • add token fields to the app log data points, the total-data response, the
    wallet usage dashboard item and UsageListItem; seed fakeChartData with
    zeroed token keys so the non-Plus preview still type-checks

FastGPT UI

  • add the cumulative "Token consumption" card and the token trend chart to
    the app chat log dashboard
  • add total/input/output token columns to the usage table and a token chart
    to the usage dashboard
  • register the tokens icon, support allowDecimals in LineChartComponent and
    add the en/zh-CN/zh-Hant i18n keys

Tests

  • assert token collection in the saveChat, nodeResponseStorage,
    nodeResponseSink, outLink runtime, debugChat and scheduleTrigger suites

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant