fix(ai): issue where the default baseURL for LLM provider is undefined (#6367)

This commit is contained in:
YANG QIA 2025-03-05 22:19:44 +08:00 committed by GitHub
parent ea64d975ed
commit 7404e57d4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 3 deletions

View File

@ -12,7 +12,9 @@ import { LLMProvider } from './provider';
import { LLMProviderOptions } from '../manager/ai-manager';
export class DeepSeekProvider extends LLMProvider {
baseURL = 'https://api.deepseek.com';
get baseURL() {
return 'https://api.deepseek.com';
}
createModel() {
const { baseURL, apiKey } = this.serviceOptions || {};

View File

@ -11,7 +11,9 @@ import { ChatOpenAI } from '@langchain/openai';
import { LLMProvider } from './provider';
export class OpenAIProvider extends LLMProvider {
baseURL = 'https://api.openai.com/v1';
get baseURL() {
return 'https://api.openai.com/v1';
}
createModel() {
const { baseURL, apiKey } = this.serviceOptions || {};

View File

@ -13,7 +13,6 @@ import { parseMessages } from './handlers/parse-messages';
import { Application } from '@nocobase/server';
export abstract class LLMProvider {
baseURL?: string;
serviceOptions: Record<string, any>;
modelOptions: Record<string, any>;
messages: any[];
@ -22,6 +21,10 @@ export abstract class LLMProvider {
abstract createModel(): BaseChatModel;
get baseURL() {
return null;
}
constructor(opts: {
app: Application;
serviceOptions: any;