@hej / sigit / commits / 484fce7

Switch default model to Qwen 3 8B and clean up code

paydii committed Apr 25, 2026 at 08:03 UTC 484fce782dedb177064c71f9443cdeb29e61994b
3 files changed +24 -26
src/chat.rs
+8 -1
@@ -311,6 +311,13 @@ struct ModelOption {
311 }
312
313 const SIGIT_MODELS: &[ModelOption] = &[
314 + ModelOption {
315 + name: "Qwen 3 8B (Q4_K_M)",
316 + description: "~5 GB",
317 + tool_calling: true,
318 + max_tokens: 4096,
319 + config_fn: GgufModelConfig::qwen3_8b,
320 + },
321 ModelOption {
322 name: "Qwen 3 4B (Q4_K_M)",
323 description: "~2.7 GB",
@@ -999,7 +1006,7 @@ pub async fn run_with<B: ratatui::backend::Backend>(
1006 engine: Arc<ChatEngine>,
1007 load_rx: std_mpsc::Receiver<Result<(), String>>,
1008 ) -> Result<()> {
1002 - let config = GgufModelConfig::qwen3_4b();
1009 + let config = GgufModelConfig::qwen3_8b();
1010 let model_name = config.display_name.clone();
1011 event_loop(terminal, engine, load_rx, model_name).await
1012 }
src/main.rs
+14 -23
@@ -215,15 +215,6 @@ impl SiGitAgent {
215 session_cwd: std::sync::Mutex::new(None),
216 }
217 }
218 -
219 - /// Return the session working directory, falling back to the process cwd.
220 - fn cwd(&self) -> PathBuf {
221 - self.session_cwd
222 - .lock()
223 - .ok()
224 - .and_then(|guard| guard.clone())
225 - .unwrap_or_else(|| std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")))
226 - }
218 }
219
220 #[async_trait::async_trait(?Send)]
@@ -280,10 +271,10 @@ impl Agent for SiGitAgent {
271
272 // Set the process cwd so tool calls using relative paths land in the
273 // correct project directory.
283 - if args.cwd.is_dir() {
284 - if let Err(err) = std::env::set_current_dir(&args.cwd) {
285 - log::warn!("could not set cwd to {}: {err}", args.cwd.display());
286 - }
274 + if args.cwd.is_dir()
275 + && let Err(err) = std::env::set_current_dir(&args.cwd)
276 + {
277 + log::warn!("could not set cwd to {}: {err}", args.cwd.display());
278 }
279
280 // Clear conversation history — siGit doesn't persist sessions, so a
@@ -323,10 +314,10 @@ impl Agent for SiGitAgent {
314 if let Ok(mut guard) = self.session_cwd.lock() {
315 *guard = Some(args.cwd.clone());
316 }
326 - if args.cwd.is_dir() {
327 - if let Err(err) = std::env::set_current_dir(&args.cwd) {
328 - log::warn!("could not set cwd to {}: {err}", args.cwd.display());
329 - }
317 + if args.cwd.is_dir()
318 + && let Err(err) = std::env::set_current_dir(&args.cwd)
319 + {
320 + log::warn!("could not set cwd to {}: {err}", args.cwd.display());
321 }
322
323 // siGit doesn't persist history, so a fork is effectively a fresh
@@ -365,10 +356,10 @@ impl Agent for SiGitAgent {
356 if let Ok(mut guard) = self.session_cwd.lock() {
357 *guard = Some(args.cwd.clone());
358 }
368 - if args.cwd.is_dir() {
369 - if let Err(err) = std::env::set_current_dir(&args.cwd) {
370 - log::warn!("could not set cwd to {}: {err}", args.cwd.display());
371 - }
359 + if args.cwd.is_dir()
360 + && let Err(err) = std::env::set_current_dir(&args.cwd)
361 + {
362 + log::warn!("could not set cwd to {}: {err}", args.cwd.display());
363 }
364
365 // Clear history — the model is already loaded.
@@ -718,7 +709,7 @@ fn init_logging(is_tty: bool) {
709 #[cfg(unix)]
710 async fn run_interactive(tty: std::fs::File, mut cleanup_tty: std::fs::File) -> anyhow::Result<()> {
711 let engine = Arc::new(ChatEngine::new());
721 - let config = GgufModelConfig::qwen3_4b();
712 + let config = GgufModelConfig::qwen3_8b();
713 let sampling = SamplingConfig {
714 max_tokens: Some(4096),
715 ..SamplingConfig::default()
@@ -777,7 +768,7 @@ async fn run_acp_server() -> anyhow::Result<()> {
768 log::info!("loading model (this may take a minute on first run)...");
769
770 let engine = Arc::new(ChatEngine::new());
780 - let config = GgufModelConfig::qwen3_4b();
771 + let config = GgufModelConfig::qwen3_8b();
772 let sampling = SamplingConfig {
773 max_tokens: Some(4096),
774 ..SamplingConfig::default()
src/tools.rs
+2 -2
@@ -526,7 +526,7 @@ fn search_file(path: &Path, re: &Regex, matches: &mut Vec<String>) {
526 }
527 }
528
529 -/// ── read_website ─────────────────────────────────────────────────────────────
529 +// ── read_website ─────────────────────────────────────────────────────────────
530
531 fn exec_read_website(arguments: &str) -> String {
532 let args: Value = match serde_json::from_str(arguments) {
@@ -642,7 +642,7 @@ fn exec_read_website(arguments: &str) -> String {
642 output
643 }
644
645 -/// ── create_directory ─────────────────────────────────────────────────────────
645 +// ── create_directory ─────────────────────────────────────────────────────────
646
647 /// Create a directory and any missing parent directories.
648 fn exec_create_directory(arguments: &str) -> String {