|
|
@@ -2,7 +2,7 @@
|
|
|
import {
|
|
|
ApiPath,
|
|
|
Baidu,
|
|
|
- DEFAULT_API_HOST,
|
|
|
+ BAIDU_BASE_URL,
|
|
|
REQUEST_TIMEOUT_MS,
|
|
|
} from "@/app/constant";
|
|
|
import { useAccessStore, useAppConfig, useChatStore } from "@/app/store";
|
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
} from "@fortaine/fetch-event-source";
|
|
|
import { prettyObject } from "@/app/utils/format";
|
|
|
import { getClientConfig } from "@/app/config/client";
|
|
|
-import { getMessageTextContent, isVisionModel } from "@/app/utils";
|
|
|
+import { getMessageTextContent } from "@/app/utils";
|
|
|
|
|
|
export interface OpenAIListModelResponse {
|
|
|
object: string;
|
|
|
@@ -58,7 +58,8 @@ export class ErnieApi implements LLMApi {
|
|
|
|
|
|
if (baseUrl.length === 0) {
|
|
|
const isApp = !!getClientConfig()?.isApp;
|
|
|
- baseUrl = isApp ? DEFAULT_API_HOST + "/api/proxy/baidu" : ApiPath.Baidu;
|
|
|
+ // do not use proxy for baidubce api
|
|
|
+ baseUrl = isApp ? BAIDU_BASE_URL : ApiPath.Baidu;
|
|
|
}
|
|
|
|
|
|
if (baseUrl.endsWith("/")) {
|
|
|
@@ -78,10 +79,9 @@ export class ErnieApi implements LLMApi {
|
|
|
}
|
|
|
|
|
|
async chat(options: ChatOptions) {
|
|
|
- const visionModel = isVisionModel(options.config.model);
|
|
|
const messages = options.messages.map((v) => ({
|
|
|
role: v.role,
|
|
|
- content: visionModel ? v.content : getMessageTextContent(v),
|
|
|
+ content: getMessageTextContent(v),
|
|
|
}));
|
|
|
|
|
|
const modelConfig = {
|