mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
fix(providers): update GitHub Models api url (#9003)
* fix(providers): 更新 GitHub Models 的 API 地址和基础路径 修复 GitHub Models 的 API 地址配置错误,并调整基础路径以适配其特殊接口结构 * Update providers.ts --------- Co-authored-by: Pleasure1234 <3196812536@qq.com>
This commit is contained in:
parent
6c5088f071
commit
33128195fe
@ -99,8 +99,12 @@ export abstract class OpenAIBaseClient<
|
||||
override async listModels(): Promise<OpenAI.Models.Model[]> {
|
||||
try {
|
||||
const sdk = await this.getSdkInstance()
|
||||
const response = await sdk.models.list()
|
||||
if (this.provider.id === 'github') {
|
||||
// GitHub Models 其 models 和 chat completions 两个接口的 baseUrl 不一样
|
||||
const baseUrl = 'https://models.github.ai/catalog/'
|
||||
const newSdk = sdk.withOptions({ baseURL: baseUrl })
|
||||
const response = await newSdk.models.list()
|
||||
|
||||
// @ts-ignore key is not typed
|
||||
return response?.body
|
||||
.map((model) => ({
|
||||
@ -111,6 +115,7 @@ export abstract class OpenAIBaseClient<
|
||||
}))
|
||||
.filter(isSupportedModel)
|
||||
}
|
||||
const response = await sdk.models.list()
|
||||
if (this.provider.id === 'together') {
|
||||
// @ts-ignore key is not typed
|
||||
return response?.body.map((model) => ({
|
||||
|
||||
@ -298,7 +298,7 @@ export const SYSTEM_PROVIDERS_CONFIG: Record<SystemProviderId, SystemProvider> =
|
||||
name: 'Github Models',
|
||||
type: 'openai',
|
||||
apiKey: '',
|
||||
apiHost: 'https://models.inference.ai.azure.com/',
|
||||
apiHost: 'https://models.github.ai/inference',
|
||||
models: SYSTEM_MODELS.github,
|
||||
isSystem: true,
|
||||
enabled: false
|
||||
@ -818,7 +818,7 @@ export const PROVIDER_URLS: Record<SystemProviderId, ProviderUrls> = {
|
||||
},
|
||||
github: {
|
||||
api: {
|
||||
url: 'https://models.inference.ai.azure.com/'
|
||||
url: 'https://models.github.ai/'
|
||||
},
|
||||
websites: {
|
||||
official: 'https://github.com/marketplace/models',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user