mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 05:09:09 +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[]> {
|
override async listModels(): Promise<OpenAI.Models.Model[]> {
|
||||||
try {
|
try {
|
||||||
const sdk = await this.getSdkInstance()
|
const sdk = await this.getSdkInstance()
|
||||||
const response = await sdk.models.list()
|
|
||||||
if (this.provider.id === 'github') {
|
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
|
// @ts-ignore key is not typed
|
||||||
return response?.body
|
return response?.body
|
||||||
.map((model) => ({
|
.map((model) => ({
|
||||||
@ -111,6 +115,7 @@ export abstract class OpenAIBaseClient<
|
|||||||
}))
|
}))
|
||||||
.filter(isSupportedModel)
|
.filter(isSupportedModel)
|
||||||
}
|
}
|
||||||
|
const response = await sdk.models.list()
|
||||||
if (this.provider.id === 'together') {
|
if (this.provider.id === 'together') {
|
||||||
// @ts-ignore key is not typed
|
// @ts-ignore key is not typed
|
||||||
return response?.body.map((model) => ({
|
return response?.body.map((model) => ({
|
||||||
|
|||||||
@ -298,7 +298,7 @@ export const SYSTEM_PROVIDERS_CONFIG: Record<SystemProviderId, SystemProvider> =
|
|||||||
name: 'Github Models',
|
name: 'Github Models',
|
||||||
type: 'openai',
|
type: 'openai',
|
||||||
apiKey: '',
|
apiKey: '',
|
||||||
apiHost: 'https://models.inference.ai.azure.com/',
|
apiHost: 'https://models.github.ai/inference',
|
||||||
models: SYSTEM_MODELS.github,
|
models: SYSTEM_MODELS.github,
|
||||||
isSystem: true,
|
isSystem: true,
|
||||||
enabled: false
|
enabled: false
|
||||||
@ -818,7 +818,7 @@ export const PROVIDER_URLS: Record<SystemProviderId, ProviderUrls> = {
|
|||||||
},
|
},
|
||||||
github: {
|
github: {
|
||||||
api: {
|
api: {
|
||||||
url: 'https://models.inference.ai.azure.com/'
|
url: 'https://models.github.ai/'
|
||||||
},
|
},
|
||||||
websites: {
|
websites: {
|
||||||
official: 'https://github.com/marketplace/models',
|
official: 'https://github.com/marketplace/models',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user