feat: complete revolution architecture modernization
- Decoupled robust frontend into an Astro framework in `frontend/`. - Replaced direct WebSocket broadcast with Smart Routing to distribute workload only to idle capable nodes, preventing 503 errors and duplicate responses. - Rewrote WASM panic points (`unwrap()` handling) into panic-safe match blocks in qwen_coder.rs preventing Node Web Workers from crashing. - Integrated robust dynamic Three.js 3D visualization. - Resolved mermaid and THREE.js frontend hydration issues.
This commit is contained in:
@@ -320,7 +320,11 @@ pub async fn run_coder_inference(prompt: String, ws: Rc<RefCell<WebSocket>>, use
|
||||
if let Ok(text) = cached.tokenizer.decode(&[next_token], true) {
|
||||
generated_text.push_str(&text);
|
||||
let mut chunk = serde_json::json!({ "type": "llm_chunk", "token": text, "prompt": prompt, "model": "Qwen2.5-Coder" });
|
||||
if let Some(ref tid) = task_id { chunk.as_object_mut().unwrap().insert("task_id".to_string(), serde_json::json!(tid)); }
|
||||
if let Some(ref tid) = task_id {
|
||||
if let Some(obj) = chunk.as_object_mut() {
|
||||
obj.insert("task_id".to_string(), serde_json::json!(tid));
|
||||
}
|
||||
}
|
||||
let _ = ws.borrow().send_with_str(&chunk.to_string());
|
||||
}
|
||||
all_generated.push(next_token);
|
||||
@@ -362,7 +366,11 @@ pub async fn run_coder_inference(prompt: String, ws: Rc<RefCell<WebSocket>>, use
|
||||
}
|
||||
|
||||
let mut chunk = serde_json::json!({ "type": "llm_chunk", "token": text, "prompt": prompt, "model": "Qwen2.5-Coder" });
|
||||
if let Some(ref tid) = task_id { chunk.as_object_mut().unwrap().insert("task_id".to_string(), serde_json::json!(tid)); }
|
||||
if let Some(ref tid) = task_id {
|
||||
if let Some(obj) = chunk.as_object_mut() {
|
||||
obj.insert("task_id".to_string(), serde_json::json!(tid));
|
||||
}
|
||||
}
|
||||
let _ = ws.borrow().send_with_str(&chunk.to_string());
|
||||
}
|
||||
all_generated.push(next_token);
|
||||
@@ -391,7 +399,9 @@ pub async fn run_coder_inference(prompt: String, ws: Rc<RefCell<WebSocket>>, use
|
||||
"load_time_ms": (load_time * 100.0).round() / 100.0,
|
||||
});
|
||||
if let Some(tid) = task_id {
|
||||
done.as_object_mut().unwrap().insert("task_id".to_string(), serde_json::json!(tid));
|
||||
if let Some(obj) = done.as_object_mut() {
|
||||
obj.insert("task_id".to_string(), serde_json::json!(tid));
|
||||
}
|
||||
}
|
||||
let _ = ws.borrow().send_with_str(&done.to_string());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user