-
Notifications
You must be signed in to change notification settings - Fork 931
fix: normalize Ollama base URL to include /v1 to prevent 410 errors #803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1386,6 +1386,23 @@ export const useChatStore = create<ChatState>((set, get) => ({ | |
| } | ||
| } | ||
|
|
||
| // Guard: during an active send, don't let a history poll replace the local | ||
| // conversation with fewer messages from the gateway. This can happen when | ||
| // the gateway is reconnecting after a brief disconnect or hasn't fully | ||
| // persisted the conversation yet. Without this guard, the history poll | ||
| // causes chat history to vanish mid-conversation (issue #709). | ||
| { | ||
| const preApplyState = get(); | ||
| if ( | ||
| preApplyState.sending && | ||
| preApplyState.lastUserMessageAt && | ||
| finalMessages.length < preApplyState.messages.length && | ||
| preApplyState.messages.length > 1 | ||
|
Comment on lines
+1397
to
+1400
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This length-based guard can discard newer gateway history in long sessions because Useful? React with 👍 / 👎. |
||
| ) { | ||
| finalMessages = preApplyState.messages; | ||
| } | ||
| } | ||
|
|
||
| set({ messages: finalMessages, thinkingLevel, loading: false }); | ||
|
|
||
| // Extract first user message text as a session label for display in the toolbar. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new Ollama branch ignores
apiProtocoland only strips chat-completions suffixes before appending/v1. If an Ollama account is configured withopenai-responsesoranthropic-messagesand a user provides an endpoint URL like.../v1/responsesor.../v1/messages, this logic produces malformed URLs such as.../v1/responses/v1, causing runtime calls to fail. Previously the unregistered-provider path trimmed protocol-specific suffixes; this change regresses that behavior for non-default Ollama protocol selections.Useful? React with 👍 / 👎.