feat: add Z.ai GLM partner and fix apiKeyUrl priority
- Add Z.ai GLM as official partner with promotion support - Fix apiKeyUrl not being prioritized for cn_official and aggregator categories - Now apiKeyUrl (with promotion parameters) takes precedence over websiteUrl for cn_official, aggregator, and third_party categories
This commit is contained in:
@@ -49,10 +49,15 @@ export function useApiKeyLink({
|
||||
const getWebsiteUrl = useMemo(() => {
|
||||
if (currentPresetEntry) {
|
||||
const preset = currentPresetEntry.preset;
|
||||
// 第三方供应商优先使用 apiKeyUrl
|
||||
return preset.category === "third_party"
|
||||
? preset.apiKeyUrl || preset.websiteUrl || ""
|
||||
: preset.websiteUrl || "";
|
||||
// 对于 cn_official、aggregator、third_party,优先使用 apiKeyUrl(可能包含推广参数)
|
||||
if (
|
||||
preset.category === "cn_official" ||
|
||||
preset.category === "aggregator" ||
|
||||
preset.category === "third_party"
|
||||
) {
|
||||
return preset.apiKeyUrl || preset.websiteUrl || "";
|
||||
}
|
||||
return preset.websiteUrl || "";
|
||||
}
|
||||
return formWebsiteUrl || "";
|
||||
}, [currentPresetEntry, formWebsiteUrl]);
|
||||
|
||||
@@ -87,7 +87,25 @@ export const providerPresets: ProviderPreset[] = [
|
||||
},
|
||||
},
|
||||
category: "cn_official",
|
||||
isPartner: true, // 商业合作伙伴
|
||||
isPartner: true, // 合作伙伴
|
||||
partnerPromotionKey: "zhipu", // 促销信息 i18n key
|
||||
},
|
||||
{
|
||||
name: "Z.ai GLM",
|
||||
websiteUrl: "https://z.ai",
|
||||
apiKeyUrl: "https://z.ai/subscribe?ic=8JVLJQFSKB",
|
||||
settingsConfig: {
|
||||
env: {
|
||||
ANTHROPIC_BASE_URL: "https://api.z.ai/api/anthropic",
|
||||
ANTHROPIC_AUTH_TOKEN: "",
|
||||
ANTHROPIC_MODEL: "glm-4.6",
|
||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-4.5-air",
|
||||
ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-4.6",
|
||||
ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-4.6",
|
||||
},
|
||||
},
|
||||
category: "cn_official",
|
||||
isPartner: true, // 合作伙伴
|
||||
partnerPromotionKey: "zhipu", // 促销信息 i18n key
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user