feat: add ali qwen models#596
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands Alibaba (Ali) Qwen model support by adding many new builtin model definitions (including Qwen 3 / VL / Omni variants) and introducing an input_media usage/price condition flag so pricing can differentiate pure-text vs multimodal requests across backend logic and the web UI.
Changes:
- Add
input_mediaas a first-class conditional pricing and usage-context signal (core + web), including display and editing support in the UI. - Extend Ali adaptor to derive
InputMedia/InputVideo/OutputAudiousage context from both usage tokens and request bodies, and apply sensible defaults for pricing selection. - Greatly expand
core/relay/adaptor/ali/constants.gowith additional Qwen/Qwen-VL/Qwen-Omni model configs and update/validate their conditional pricing.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/validation/model.ts | Extends zod validation for price conditions to accept input_media. |
| web/src/types/model.ts | Adds input_media to the PriceCondition TypeScript type. |
| web/src/types/log.ts | Adds input_media to the log usage-context type for UI rendering. |
| web/src/feature/model/components/ModelTable.tsx | Wires an “edit from builtin” path into the model dialog flow. |
| web/src/feature/model/components/BuiltinModelsDialog.tsx | Adds per-row actions (create/edit/import) for builtin models and introduces row-level import state. |
| web/src/feature/log/components/ExpandedLogContent.tsx | Displays input_media in expanded log usage context. |
| web/src/components/price/PriceFormFields.tsx | Adds an Input Has Media selector to conditional pricing form fields. |
| web/src/components/price/PriceDisplay.tsx | Includes input_media in conditional-price summaries. |
| web/public/locales/zh/translation.json | Adds i18n strings for builtin-model actions and inputMedia labels (ZH). |
| web/public/locales/en/translation.json | Adds i18n strings for builtin-model actions and inputMedia labels (EN). |
| core/relay/adaptor/ali/constants.go | Adds/updates a large set of Ali Qwen model definitions and conditional prices (incl. InputMedia / OutputAudio cases). |
| core/relay/adaptor/ali/constants_test.go | Adds validation for all Ali model conditional prices and tests Omni media/audio pricing behavior and request detection. |
| core/relay/adaptor/ali/chat.go | Populates Ali chat UsageContext fields (input media/video + output audio), with fallbacks from request body and defaults for pricing. |
| core/model/usage.go | Adds InputMedia to PriceCondition/UsageContext and integrates it into matching, specificity, fallback, and validation logic. |
| core/model/usage_test.go | Adds unit coverage for selecting/validating conditional prices involving InputMedia. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| className="h-7 px-2 text-xs" | ||
| onClick={(event) => { | ||
| event.stopPropagation(); | ||
| onEditFromBuiltin(model); |
Comment on lines
+293
to
+297
| const handleAddBuiltin = async (row: BuiltinModelRow) => { | ||
| const rowKey = getBuiltinModelRowKey(row); | ||
| setSavingRowKey(rowKey); | ||
|
|
||
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.