Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions apps/memos-local-plugin/server/routes/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ async function probeEmbedding(req: TestRequest): Promise<number> {
case "openai_compatible": {
if (!endpoint) throw new Error("endpoint is required for openai_compatible");
const base = endpoint.replace(/\/+$/, "");
const url = base.endsWith("/v1")
? `${base}/embeddings`
: `${base}/v1/embeddings`;
const url = base.endsWith("/embeddings")
? base
: base.endsWith("/v1")
? `${base}/embeddings`
: `${base}/v1/embeddings`;
const r = await fetchJson(url, {
method: "POST",
headers: { ...authHeader(apiKey), "Content-Type": "application/json" },
Expand Down Expand Up @@ -263,9 +265,11 @@ async function probeChat(req: TestRequest): Promise<number> {
case "openai_compatible": {
if (!endpoint) throw new Error("endpoint is required for openai_compatible");
const base = endpoint.replace(/\/+$/, "");
const url = base.endsWith("/v1")
? `${base}/chat/completions`
: `${base}/v1/chat/completions`;
const url = base.endsWith("/chat/completions")
? base
: base.endsWith("/v1")
? `${base}/chat/completions`
: `${base}/v1/chat/completions`;
const r = await fetchJson(url, {
method: "POST",
headers: { ...authHeader(apiKey), "Content-Type": "application/json" },
Expand Down