fix(memos-local-plugin): handle full endpoint paths in openai_compatible probe#1663
Open
liuhaibin0528 wants to merge 1 commit intoMemTensor:mainfrom
Open
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When configuring
openai_compatibleprovider with an endpoint that already includes the full API path (e.g. Zhipu AI / GLM models):The probe function would append another
/v1/chat/completionssegment, resulting in a malformed URL: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/completionsor/embeddings) before appending. The URL resolution now handles three cases:/chat/completions→ use as-is/v1→ append/chat/completions/v1/chat/completionsThe same fix was applied symmetrically to both
probeChatandprobeEmbedding.Files Changed
apps/memos-local-plugin/server/routes/models.tsBackward Compatibility
Fully backward compatible — existing endpoint formats (
/v1or base URL) continue to work as before. This only adds support for the already-full-path case.