Prepare repo for GitHub publication

- Add MIT LICENSE file
- Expand .gitignore with standard Rust/Linux entries
- Remove dangling symlinks (breadmancli, breadpadcli) and dev scratchpad (svgs.txt) from git tracking
- Replace unsafe unwrap() calls with expect() in breadman CLI (guarded by prior filter)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Breadway 2026-06-06 12:25:40 +08:00
parent feefdb81b9
commit 347508828f
34 changed files with 2825 additions and 771 deletions

View file

@ -70,10 +70,9 @@ impl OllamaClient {
.into_json()
.map_err(|e| anyhow::anyhow!("deserialize Ollama envelope: {}", e))?;
let classification: OllamaClassification = serde_json::from_str(&ollama_resp.response)
.map_err(|e| anyhow::anyhow!(
"parse Ollama classification JSON: {} — raw: {:?}",
e,
let classification: OllamaClassification = extract_json(&ollama_resp.response)
.ok_or_else(|| anyhow::anyhow!(
"no JSON object found in response — raw: {:?}",
&ollama_resp.response
))?;
@ -116,3 +115,12 @@ impl OllamaClient {
})
}
}
// Some backends (e.g. FastFlowLM) ignore `"format": "json"` and may wrap the
// JSON in prose. Find the first `{...}` span and parse that.
fn extract_json<T: serde::de::DeserializeOwned>(s: &str) -> Option<T> {
let start = s.find('{')?;
let end = s.rfind('}')?;
if end < start { return None; }
serde_json::from_str(&s[start..=end]).ok()
}