Skip to content

fix(memos-local-plugin): handle full endpoint paths in openai_compatible probe#1663

Open
liuhaibin0528 wants to merge 1 commit intoMemTensor:mainfrom
liuhaibin0528:fix/openai-compatible-endpoint-path-duplication
Open

fix(memos-local-plugin): handle full endpoint paths in openai_compatible probe#1663
liuhaibin0528 wants to merge 1 commit intoMemTensor:mainfrom
liuhaibin0528:fix/openai-compatible-endpoint-path-duplication

Conversation

@liuhaibin0528
Copy link
Copy Markdown

Problem

When configuring openai_compatible provider with an endpoint that already includes the full API path (e.g. Zhipu AI / GLM models):

endpoint: https://open.bigmodel.cn/api/paas/v4/chat/completions

The probe function would append another /v1/chat/completions segment, resulting in a malformed URL:

https://open.bigmodel.cn/api/paas/v4/chat/completions/v1/chat/completions

This causes the model test to fail for any provider whose endpoint already specifies the full path.

Solution

Check if the endpoint already ends with the target path (/chat/completions or /embeddings) before appending. The URL resolution now handles three cases:

  1. Endpoint ends with /chat/completions → use as-is
  2. Endpoint ends with /v1 → append /chat/completions
  3. Otherwise → append /v1/chat/completions

The same fix was applied symmetrically to both probeChat and probeEmbedding.

Files Changed

  • apps/memos-local-plugin/server/routes/models.ts

Backward Compatibility

Fully backward compatible — existing endpoint formats (/v1 or base URL) continue to work as before. This only adds support for the already-full-path case.

…ble probe

When the user provides an endpoint that already includes the full path
(e.g. https://open.bigmodel.cn/api/paas/v4/chat/completions for
Zhipu AI / GLM models), the probe would previously append another
/v1/chat/completions segment, resulting in a malformed URL.

This fix checks if the endpoint already ends with the target path
(/chat/completions or /embeddings) before appending, making the
probe compatible with endpoints that specify the full URL.

Affects both probeChat and probeEmbedding for openai_compatible provider.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant