mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 14:41:24 +08:00
Fix/cannot get dimension (#11879)
* fix: use ModernAiProvider for embedding dimensions * fix(ollama) * Update src/renderer/src/aiCore/legacy/clients/openai/OpenAIBaseClient.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: defi-failure <159208748+defi-failure@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
dc0c47c64d
commit
5bd550bfb4
@ -88,7 +88,11 @@ export abstract class OpenAIBaseClient<
|
||||
}
|
||||
|
||||
override async getEmbeddingDimensions(model: Model): Promise<number> {
|
||||
const sdk = await this.getSdkInstance()
|
||||
let sdk: OpenAI = await this.getSdkInstance()
|
||||
if (isOllamaProvider(this.provider)) {
|
||||
const embedBaseUrl = `${this.provider.apiHost.replace(/(\/(api|v1))\/?$/, '')}/v1`
|
||||
sdk = sdk.withOptions({ baseURL: embedBaseUrl })
|
||||
}
|
||||
|
||||
const data = await sdk.embeddings.create({
|
||||
model: model.id,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user