Skip to content

feat: model total credits#30727

Merged
CodingOnStar merged 26 commits intomainfrom
feat/model-total-credits
Jan 8, 2026
Merged

feat: model total credits#30727
CodingOnStar merged 26 commits intomainfrom
feat/model-total-credits

Conversation

@CodingOnStar
Copy link
Contributor

Summary

add new model total credit pool

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 make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods
CodingOnStar and others added 23 commits October 11, 2025 14:02
…nd improve type safety in quota panel component
…n model provider page and credential panel
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CodingOnStar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new system for managing and displaying 'total credits' within the application, primarily impacting the model provider settings page. It integrates new icons for a broader range of LLM providers, updates the core workspace data structure to track trial credits and their usage, and refactors the UI to present a clear, consolidated view of available credits and supported models. These changes aim to enhance the user experience by providing better visibility into credit consumption and streamlining the process of configuring and utilizing various language models, especially in cloud environments.

Highlights

  • New LLM Provider Icons: Added new SVG icons and their corresponding React components and JSON data for several LLM providers, including Tongyi, Anthropic Short Light, Deepseek, Gemini, Grok, and various OpenAI variants (Small, Blue, Teal, Violet). These new icons are now exported from the central LLM icon index.
  • Total Credits Model Implementation: Introduced a new 'total credits' model by updating the ICurrentWorkspace type to include trial_credits, trial_credits_used, and next_credit_reset_date. The AppContext was also updated to reflect these new fields and track the validation status of the current workspace.
  • Refactored Model Provider Quota Display: The model provider settings page (web/app/components/header/account-setting/model-provider-page/index.tsx) now features a consolidated QuotaPanel component, which displays total credits, used credits, and the next reset date. This panel also shows icons for supported LLM providers and integrates with the marketplace for installing missing providers. The individual QuotaPanel from each provider card has been removed.
  • Conditional UI for Cloud Edition: Adjusted the rendering of the priority selector in the credential panel and the overall QuotaPanel to be conditional on IS_CLOUD_EDITION, ensuring these features are specific to cloud deployments.
  • Internationalization Updates: Updated translation files (en-US, ja-JP, zh-Hans) to include new text related to the total credits model, new LLM providers in credit descriptions, and specific messages for model provider card states (e.g., supported, not supported, using API key).

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new total credit pool for various models, refactoring the model provider page to display this information centrally. It also adds several new icons for providers like Tongyi, Gemini, and Grok. The implementation looks solid, with a new QuotaPanel component that shows the total credits and allows users to install missing model providers. I have a few suggestions to improve code quality and correctness.

@CodingOnStar CodingOnStar marked this pull request as ready for review January 8, 2026 05:36
@CodingOnStar CodingOnStar requested a review from iamjoel as a code owner January 8, 2026 05:36
Copilot AI review requested due to automatic review settings January 8, 2026 05:36
@CodingOnStar CodingOnStar requested a review from zxhlyh as a code owner January 8, 2026 05:36
@CodingOnStar CodingOnStar requested a review from zhsama as a code owner January 8, 2026 05:36
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Jan 8, 2026
@dosubot dosubot bot added the 💪 enhancement New feature or request label Jan 8, 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 PR adds a unified total credit pool system for multiple LLM providers (OpenAI, Anthropic, Gemini, xAI, DeepSeek, and Tongyi). The changes include new workspace properties for tracking credits, a redesigned quota panel component that displays credits with provider icons, and updated translations across multiple languages.

Key Changes:

  • Added credit tracking fields to workspace model (trial_credits, trial_credits_used, next_credit_reset_date)
  • Completely refactored QuotaPanel from per-provider display to unified credit pool with provider icon indicators
  • Updated translations to reflect the new multi-provider credit system
  • Added new LLM provider icons (Gemini, xAI/Grok, DeepSeek, Tongyi, and variants of OpenAI and Anthropic icons)

Reviewed changes

Copilot reviewed 40 out of 46 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
web/models/common.ts Added three new fields to ICurrentWorkspace for credit tracking
web/context/app-context.tsx Added isValidatingCurrentWorkspace state and default credit values
web/app/components/header/account-setting/model-provider-page/utils.ts Refactored to use enum for provider constants and added model name mappings
web/app/components/header/account-setting/model-provider-page/provider-added-card/quota-panel.tsx Complete rewrite from per-provider quota display to unified credit pool with provider icons
web/app/components/header/account-setting/model-provider-page/provider-added-card/index.tsx Removed individual QuotaPanel rendering, renamed showQuota to showModelProvider
web/app/components/header/account-setting/model-provider-page/provider-added-card/credential-panel.tsx Wrapped priority selector with IS_CLOUD_EDITION check
web/app/components/header/account-setting/model-provider-page/index.tsx Added QuotaPanel at page level with IS_CLOUD_EDITION guard and workspace revalidation
web/i18n/*.json Updated translations for credit system across en-US, zh-Hans, ja-JP
web/app/components/base/icons/src/public/llm/* Added new LLM provider icon assets and exports
web/app/components/billing/apps-full-in-dialog/index.spec.tsx Added new credit fields to test mock data
web/app/components/plugins/provider-card.tsx Simplified onSuccess callback
web/app/components/base/icons/src/public/tracing/* Fixed ref type and JSON structure in icon files

💡 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 8, 2026
@CodingOnStar CodingOnStar merged commit cd1af04 into main Jan 8, 2026
14 checks passed
@CodingOnStar CodingOnStar deleted the feat/model-total-credits branch January 8, 2026 06:11
CodingOnStar added a commit that referenced this pull request Jan 20, 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