mirror of
https://github.com/vee1e/isscope.git
synced 2026-09-01 10:48:36 +00:00
The previous `callLocal` re-threw the raw browser `NetworkError`
("NetworkError when attempting to fetch resource" / "Failed to
fetch"), which is what happens when the browser blocks a cross-origin
request because the local server has not enabled CORS. Users running
LMStudio or older Ollama versions had no way to know that — the error
just said "network error" with no actionable hint.
- `callLocal` now catches the fetch `TypeError` and throws a
descriptive `Error` that names the endpoint and includes the exact
CORS fix for the detected server (LMStudio → "Local Server → ⚙ →
enable CORS", Ollama → set `OLLAMA_ORIGINS="*"`). The original
error is preserved via `Error.cause`.
- New `testLocalConnection` helper that hits `${endpoint}/models`
and returns either `{ ok, models }` or `{ ok, error }` with the
same CORS-aware error message. The Authorization header is sent when
an API key is configured.
- New `detectLocalServer` and `corsHelpText` helpers (port-based
detection for LMStudio 1234 / Ollama 11434).
- InputScreen now renders a "Test" button next to the Local Endpoint
field. Success shows the model list ("2 models available: llama3.2,
qwen2.5-coder:7b"); failure shows the CORS-aware error inline. The
label is now just "Local Endpoint" with the per-server URLs moved
to a hint line that explicitly mentions the required `/v1` path
(LMStudio users were previously typing `http://127.0.0.1:1234`
without `/v1`, which would 404 once CORS was fixed).
- Bump `tsconfig.json` `lib` from ES2020 to ES2022 so `Error.cause`
typechecks (added in ES2022; `target` stays at ES2020 for
compatibility).
- README: new "Local LLM provider (Ollama / LMStudio)" section with
startup commands, CORS instructions, and a troubleshooting line
pointing users to the in-app error message.
- 11 new tests for the local client (network error wrapping, test
connection success/failure, non-JSON response, server detection,
CORS help text). 4 new InputScreen tests for the provider UI and
Test button. 186/186 pass.
26 lines
670 B
JSON
26 lines
670 B
JSON
{
|
|
"compilerOptions": {
|
|
"target": "ES2020",
|
|
"useDefineForClassFields": true,
|
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
"module": "ESNext",
|
|
"skipLibCheck": true,
|
|
"moduleResolution": "bundler",
|
|
"allowImportingTsExtensions": true,
|
|
"isolatedModules": true,
|
|
"moduleDetection": "force",
|
|
"noEmit": true,
|
|
"jsx": "react-jsx",
|
|
"strict": true,
|
|
"noUnusedLocals": false,
|
|
"noUnusedParameters": false,
|
|
"noFallthroughCasesInSwitch": true,
|
|
"forceConsistentCasingInFileNames": true,
|
|
"resolveJsonModule": true,
|
|
"baseUrl": ".",
|
|
"paths": {
|
|
"@/*": ["src/*"]
|
|
}
|
|
},
|
|
"include": ["src", "vite-env.d.ts"]
|
|
}
|