Skip to content

Commit 913e66c

Browse files
Copilotmadkoding
andauthored
fix: normalize WS URL trailing slash; fix ollama-cloud requires_api_key
- api.ts: strip trailing slashes from baseUrl in getStatusWebSocketUrl() to prevent double-slash paths (e.g. ws://host//ws/status) - config.rs: requires_api_key for Ollama now returns true whenever api_key.is_some() (cloud mode) so validate() reliably rejects empty API keys for ollama-cloud configurations Agent-Logs-Url: https://github.com/madkoding/fractalmind/sessions/29135fcd-d127-4638-af3b-a2125ab5d5e4 Co-authored-by: madkoding <333442+madkoding@users.noreply.github.com>
1 parent 7878455 commit 913e66c

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/models/llm/config.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ impl ModelProvider {
6262
/// Verifica si el proveedor requiere API key
6363
pub fn requires_api_key(&self) -> bool {
6464
match self {
65-
ModelProvider::Ollama { api_key, .. } => {
66-
api_key.as_ref().is_some_and(|k| !k.is_empty())
67-
}
65+
// Cloud Ollama (api_key: Some) always requires a non-empty key
66+
ModelProvider::Ollama { api_key, .. } => api_key.is_some(),
6867
ModelProvider::OpenAI { .. } => true,
6968
ModelProvider::Anthropic { .. } => true,
7069
ModelProvider::HuggingFace { .. } => true,

ui/src/services/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class ApiClient {
256256

257257
getStatusWebSocketUrl(): string {
258258
const wsProtocol = this.baseUrl.startsWith('https://') ? 'wss://' : 'ws://';
259-
const normalizedBase = this.baseUrl.replace(/^https?:\/\//, '');
259+
const normalizedBase = this.baseUrl.replace(/^https?:\/\//, '').replace(/\/+$/, '');
260260
return `${wsProtocol}${normalizedBase}/ws/status`;
261261
}
262262

0 commit comments

Comments
 (0)