-
Notifications
You must be signed in to change notification settings - Fork 11.2k
扩展阿里云订阅计划支持 #4571
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
扩展阿里云订阅计划支持 #4571
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| 火山引擎 订阅计划: | ||
| 1、个人版、企业版 Coding Plan | ||
| BaseURL: | ||
| https://ark.cn-beijing.volces.com/api/coding/v3 (兼容OpenAI 协议) | ||
| https://ark.cn-beijing.volces.com/api/coding (兼容 Anthropic 接口协议) | ||
| 阿里云百炼 订阅计划: | ||
| 1、企业版 token plan: | ||
| BaseURL: | ||
| https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 (兼容OpenAI 协议) | ||
| https://token-plan.cn-beijing.maas.aliyuncs.com/apps/anthropic (兼容 Anthropic 接口协议) | ||
| 2、个人版 coding plan: | ||
| https://coding.dashscope.aliyuncs.com/v1 (兼容OpenAI 协议) | ||
| https://coding.dashscope.aliyuncs.com/apps/anthropic (兼容 Anthropic 接口协议) | ||
| 智普GLM 订阅计划: | ||
| 1、个人版 coding plan: | ||
| https://open.bigmodel.cn/api/coding/paas/v4 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -393,11 +393,24 @@ export function ChannelMutateDrawer({ | |||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| const { | ||||||||||||||||||||||||||||||||||||||||||||
| unlocked: aliApiEditUnlocked, | ||||||||||||||||||||||||||||||||||||||||||||
| handleClick: handleAliApiConfigSecretClick, | ||||||||||||||||||||||||||||||||||||||||||||
| reset: resetAliApiUnlock, | ||||||||||||||||||||||||||||||||||||||||||||
| } = useHiddenClickUnlock({ | ||||||||||||||||||||||||||||||||||||||||||||
| requiredClicks: 10, | ||||||||||||||||||||||||||||||||||||||||||||
| disabled: currentType !== 17, | ||||||||||||||||||||||||||||||||||||||||||||
| onUnlock: () => { | ||||||||||||||||||||||||||||||||||||||||||||
| toast.info(t('Ali custom API address editing unlocked')) | ||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||||
| if (!open) { | ||||||||||||||||||||||||||||||||||||||||||||
| resetDoubaoApiUnlock() | ||||||||||||||||||||||||||||||||||||||||||||
| resetAliApiUnlock() | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| }, [open, resetDoubaoApiUnlock]) | ||||||||||||||||||||||||||||||||||||||||||||
| }, [open, resetDoubaoApiUnlock, resetAliApiUnlock]) | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Helper computed values | ||||||||||||||||||||||||||||||||||||||||||||
| const isBatchMode = | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -616,6 +629,14 @@ export function ChannelMutateDrawer({ | |||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Type 17 (Ali) - set default base_url | ||||||||||||||||||||||||||||||||||||||||||||
| if (currentType === 17) { | ||||||||||||||||||||||||||||||||||||||||||||
| const currentBaseUrlValue = form.getValues('base_url') | ||||||||||||||||||||||||||||||||||||||||||||
| if (!currentBaseUrlValue || currentBaseUrlValue === '') { | ||||||||||||||||||||||||||||||||||||||||||||
| form.setValue('base_url', 'https://dashscope.aliyuncs.com') | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+632
to
+638
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normalize For type Suggested fix+const ALI_DEFAULT_BASE_URL = 'https://dashscope.aliyuncs.com'
+const ALI_PRESET_BASE_URLS = new Set([
+ ALI_DEFAULT_BASE_URL,
+ 'ali-token-plan',
+ 'ali-coding-plan',
+])
// Type 17 (Ali) - set default base_url
if (currentType === 17) {
- const currentBaseUrlValue = form.getValues('base_url')
- if (!currentBaseUrlValue || currentBaseUrlValue === '') {
- form.setValue('base_url', 'https://dashscope.aliyuncs.com')
- }
+ const currentBaseUrlValue = (form.getValues('base_url') || '').trim()
+ if (!currentBaseUrlValue || !ALI_PRESET_BASE_URLS.has(currentBaseUrlValue)) {
+ form.setValue('base_url', ALI_DEFAULT_BASE_URL)
+ }
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| // Type 18 (Xunfei) - set default other (version) | ||||||||||||||||||||||||||||||||||||||||||||
| if (currentType === 18) { | ||||||||||||||||||||||||||||||||||||||||||||
| const currentOther = form.getValues('other') | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1728,6 +1749,76 @@ export function ChannelMutateDrawer({ | |||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| {/* Ali/DashScope (type 17) */} | ||||||||||||||||||||||||||||||||||||||||||||
| {currentType === 17 && !aliApiEditUnlocked && ( | ||||||||||||||||||||||||||||||||||||||||||||
| <FormField | ||||||||||||||||||||||||||||||||||||||||||||
| control={form.control} | ||||||||||||||||||||||||||||||||||||||||||||
| name='base_url' | ||||||||||||||||||||||||||||||||||||||||||||
| render={({ field }) => ( | ||||||||||||||||||||||||||||||||||||||||||||
| <FormItem> | ||||||||||||||||||||||||||||||||||||||||||||
| <FormLabel | ||||||||||||||||||||||||||||||||||||||||||||
| className='cursor-pointer select-none' | ||||||||||||||||||||||||||||||||||||||||||||
| onClick={handleAliApiConfigSecretClick} | ||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1759
to
+1762
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the hidden unlock interaction keyboard-operable The unlock trigger is click-only on a label; keyboard users cannot perform this interaction. Suggested fix<FormLabel
- className='cursor-pointer select-none'
+ className='cursor-pointer select-none'
+ role='button'
+ tabIndex={0}
onClick={handleAliApiConfigSecretClick}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault()
+ handleAliApiConfigSecretClick()
+ }
+ }}
>As per coding guidelines "Ensure keyboard operability and logical focus order; use ARIA attributes (aria-label, aria-expanded, aria-hidden) when necessary". 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| {t('API Base URL *')} | ||||||||||||||||||||||||||||||||||||||||||||
| </FormLabel> | ||||||||||||||||||||||||||||||||||||||||||||
| <Select | ||||||||||||||||||||||||||||||||||||||||||||
| onValueChange={field.onChange} | ||||||||||||||||||||||||||||||||||||||||||||
| value={ | ||||||||||||||||||||||||||||||||||||||||||||
| field.value || 'https://dashscope.aliyuncs.com' | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||
| <FormControl> | ||||||||||||||||||||||||||||||||||||||||||||
| <SelectTrigger> | ||||||||||||||||||||||||||||||||||||||||||||
| <SelectValue /> | ||||||||||||||||||||||||||||||||||||||||||||
| </SelectTrigger> | ||||||||||||||||||||||||||||||||||||||||||||
| </FormControl> | ||||||||||||||||||||||||||||||||||||||||||||
| <SelectContent> | ||||||||||||||||||||||||||||||||||||||||||||
| <SelectItem value='https://dashscope.aliyuncs.com'> | ||||||||||||||||||||||||||||||||||||||||||||
| {t('https://dashscope.aliyuncs.com')} | ||||||||||||||||||||||||||||||||||||||||||||
| </SelectItem> | ||||||||||||||||||||||||||||||||||||||||||||
| <SelectItem value='ali-token-plan'> | ||||||||||||||||||||||||||||||||||||||||||||
| {t('Ali Token Plan')} | ||||||||||||||||||||||||||||||||||||||||||||
| </SelectItem> | ||||||||||||||||||||||||||||||||||||||||||||
| <SelectItem value='ali-coding-plan'> | ||||||||||||||||||||||||||||||||||||||||||||
| {t('Ali Coding Plan')} | ||||||||||||||||||||||||||||||||||||||||||||
| </SelectItem> | ||||||||||||||||||||||||||||||||||||||||||||
| </SelectContent> | ||||||||||||||||||||||||||||||||||||||||||||
| </Select> | ||||||||||||||||||||||||||||||||||||||||||||
| <FormDescription> | ||||||||||||||||||||||||||||||||||||||||||||
| {t('Select the API endpoint')} | ||||||||||||||||||||||||||||||||||||||||||||
| </FormDescription> | ||||||||||||||||||||||||||||||||||||||||||||
| <FormMessage /> | ||||||||||||||||||||||||||||||||||||||||||||
| </FormItem> | ||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| {/* Ali/DashScope (type 17) - Custom API URL (unlocked) */} | ||||||||||||||||||||||||||||||||||||||||||||
| {currentType === 17 && aliApiEditUnlocked && ( | ||||||||||||||||||||||||||||||||||||||||||||
| <FormField | ||||||||||||||||||||||||||||||||||||||||||||
| control={form.control} | ||||||||||||||||||||||||||||||||||||||||||||
| name='base_url' | ||||||||||||||||||||||||||||||||||||||||||||
| render={({ field }) => ( | ||||||||||||||||||||||||||||||||||||||||||||
| <FormItem> | ||||||||||||||||||||||||||||||||||||||||||||
| <FormLabel>{t('API Base URL *')}</FormLabel> | ||||||||||||||||||||||||||||||||||||||||||||
| <FormControl> | ||||||||||||||||||||||||||||||||||||||||||||
| <Input | ||||||||||||||||||||||||||||||||||||||||||||
| placeholder={t( | ||||||||||||||||||||||||||||||||||||||||||||
| 'e.g., https://dashscope.aliyuncs.com' | ||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||
| {...field} | ||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||
| </FormControl> | ||||||||||||||||||||||||||||||||||||||||||||
| <FormDescription> | ||||||||||||||||||||||||||||||||||||||||||||
| {t('Enter custom API endpoint URL')} | ||||||||||||||||||||||||||||||||||||||||||||
| </FormDescription> | ||||||||||||||||||||||||||||||||||||||||||||
| <FormMessage /> | ||||||||||||||||||||||||||||||||||||||||||||
| </FormItem> | ||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| {/* Coze (type 49) */} | ||||||||||||||||||||||||||||||||||||||||||||
| {currentType === 49 && ( | ||||||||||||||||||||||||||||||||||||||||||||
| <FormField | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1752,7 +1843,7 @@ export function ChannelMutateDrawer({ | |||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| {/* General base_url for other types */} | ||||||||||||||||||||||||||||||||||||||||||||
| {![3, 8, 22, 36, 45].includes(currentType) && ( | ||||||||||||||||||||||||||||||||||||||||||||
| {![3, 8, 17, 22, 36, 45].includes(currentType) && ( | ||||||||||||||||||||||||||||||||||||||||||||
| <FormField | ||||||||||||||||||||||||||||||||||||||||||||
| control={form.control} | ||||||||||||||||||||||||||||||||||||||||||||
| name='base_url' | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
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.
Keep special-plan routing mode-aware.
This early return sends every non-Claude special-plan request to
/chat/completions, so embeddings, completions, responses, and any image relay that reaches this path will hit the wrong upstream endpoint onceChannelBaseUrlisali-token-planorali-coding-plan. Move theOpenAIBaseURLoverride inside theRelayModeswitch so each mode still maps to its own OpenAI-compatible path.Suggested direction
🤖 Prompt for AI Agents