Update OpenAI.ts

This commit is contained in:
Anoyi 2024-11-19 17:26:50 +08:00 • committed by GitHub
parent 7b6d80a621
commit acf832aab2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -288,8 +288,7 @@ class OpenAI extends BaseLLM {
suffix: string,
options: CompletionOptions,
): AsyncGenerator<string> {
const url = this.apiBase?.includes("api.siliconflow.cn") ? "completions" : "fim/completions"
const endpoint = new URL(url, this.apiBase);
const endpoint = this.apiBase?.includes("completions") ? new URL(this.apiBase) : new URL("fim/completions", this.apiBase);
const resp = await this.fetch(endpoint, {
method: "POST",
body: JSON.stringify({