Skip to content

feat: model total credits#26942

Merged
CodingOnStar merged 22 commits intomainfrom
feat/model-total-credits
Jan 4, 2026
Merged

feat: model total credits#26942
CodingOnStar merged 22 commits intomainfrom
feat/model-total-credits

Conversation

@CodingOnStar
Copy link
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
@CodingOnStar CodingOnStar changed the title Feat/model total credits model total credits Dec 16, 2025
@CodingOnStar CodingOnStar changed the title model total credits feat: model total credits Dec 16, 2025
@CodingOnStar CodingOnStar marked this pull request as ready for review January 4, 2026 03:27
Copilot AI review requested due to automatic review settings January 4, 2026 03:27
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. 💪 enhancement New feature or request labels Jan 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces model total credits tracking functionality to the Dify platform. The changes add support for tracking trial credits usage across multiple LLM providers (OpenAI, Anthropic, Gemini, xAI, DeepSeek, and Tongyi) with a unified quota display panel.

Key Changes:

  • Added credit tracking fields to workspace model (trial_credits, trial_credits_used, next_credit_reset_date)
  • Redesigned quota panel to show consolidated credits with provider-specific status indicators
  • Added support for 4 new LLM providers (Gemini, xAI/Grok, DeepSeek, Tongyi) with corresponding icons
  • Updated i18n strings across English, Chinese, and Japanese locales

Reviewed changes

Copilot reviewed 33 out of 39 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
web/models/common.ts Added three new fields to ICurrentWorkspace for credit tracking
web/i18n/zh-Hans/common.json Added new translation keys for model quota display and reset date
web/i18n/zh-Hans/billing.json Updated tooltip text to include new supported providers
web/i18n/ja-JP/common.json Added Japanese translations for new quota-related strings
web/i18n/ja-JP/billing.json Updated Japanese tooltip for message credits
web/i18n/en-US/common.json Added English translations for quota panel features
web/i18n/en-US/billing.json Updated English tooltip to list all supported providers
web/context/app-context.tsx Added isValidatingCurrentWorkspace flag and initialized new credit fields
web/app/components/plugins/provider-card.tsx Simplified callback function syntax
web/app/components/header/account-setting/model-provider-page/utils.ts Converted provider list to enum and added model name mappings
web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx Complete redesign to show unified credit quota with provider icons
web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx Removed per-provider quota display (moved to unified panel)
web/app/components/header/account-setting/model-provider-page/index.tsx Added unified quota panel component and workspace refresh effect
web/app/components/billing/apps-full-in-dialog/index.spec.tsx Updated test context to include new credit fields
web/app/components/base/icons/* Added new icon components for Gemini, Grok, DeepSeek, Tongyi, OpenAI Small, and Anthropic Short

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 4, 2026
@CodingOnStar CodingOnStar merged commit 84cbf05 into main Jan 4, 2026
14 checks passed
@CodingOnStar CodingOnStar deleted the feat/model-total-credits branch January 4, 2026 07:26
@CodingOnStar CodingOnStar restored the feat/model-total-credits branch January 4, 2026 09:51
CodingOnStar added a commit that referenced this pull request Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

4 participants