[Enhancement] Self-hosted reliability for long-running/local model requests#1291
Closed
joonsoome wants to merge 19 commits intokwaroran:mainfrom
Closed
[Enhancement] Self-hosted reliability for long-running/local model requests#1291joonsoome wants to merge 19 commits intokwaroran:mainfrom
joonsoome wants to merge 19 commits intokwaroran:mainfrom
Conversation
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.
Summary
This PR improves self-host reliability for long-running local-model requests in Node self-host deployments, while preserving default behavior when Local Network Mode is disabled.
What changed
1) Local Network routing for OpenAI-compatible requests
localNetworkModelocalNetworkTimeoutSecnetworkRoute?: 'auto' | 'local_network'requestTimeoutMs?: number/proxy2/proxy-stream-jobs+/proxy-stream-jobs/:jobId/ws), fallback to/proxy22) Proxy Job + WebSocket relay (Node self-host, streaming)
POST /proxy-stream-jobsDELETE /proxy-stream-jobs/:jobIdWS /proxy-stream-jobs/:jobId/wsjob_accepted,upstream_headers,chunk,error,done,ping)./proxy2path for fallback/regression safety.3) Trigger v2 LLM streaming fix
v2RunLLMto honorstreaming.4) UX/help update
Architecture
flowchart LR subgraph A["1. Local ON, Node self-host"] direction TB A1["Browser"] --> A2["Cloudflare Tunnel or reverse proxy"] --> A3["Risu Node self-host"] A3 --> A4["Streaming OpenAI: POST /proxy-stream-jobs + WS relay, fallback /proxy2"] A3 --> A5["Non-stream OpenAI: /proxy2"] A4 --> A6["LAN model, 192.168.x.x or localhost"] A5 --> A6 end subgraph B["2. Local OFF, Node self-host"] direction TB B1["Browser"] --> B2["Risu Node self-host frontend runtime"] B2 --> B3["Streaming OpenAI: browser fetch to target URL"] B2 --> B4["Non-stream OpenAI: /proxy2 default path"] B3 --> B5["Local URL may fail by browser private-network policy"] end subgraph C["3. Public web, risuai.xyz"] direction TB C1["Browser"] --> C2["hubURL/proxy2 path"] --> C3["Target URL"] C3 --> C4["Local Network ON: blocked immediately by policy"] C3 --> C5["Local Network OFF: may fail or timeout, origin cannot reach user LAN"] end A ~~~ B B ~~~ C