From 7bf9160b96dae3a201a2f36713524cf3e720ca2d Mon Sep 17 00:00:00 2001 From: dezoito Date: Sat, 23 Mar 2024 13:22:05 -0300 Subject: [PATCH] Added fixed 30s timeout for inference calls (this should be configurable in settings --- bun.lockb | Bin 145610 -> 145610 bytes src-tauri/src/commands.rs | 39 ++++++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/bun.lockb b/bun.lockb index bdbe7430a0e84db4f5b495f777826986e34391ad..8c103313037984ee21028b497043f8d49cb0e5ce 100755 GIT binary patch delta 4121 zcmX^0k>k`yjtwS1>#wphFfcMeKo1j?fkd$Z*&yN4(##Z)@J}Fzmw}-H#6}lm0SN*D zh=!>Hv0)e{22%qRuZJr{5~QP8JwpRFi$Ok4&&f{$$%U~qFbF_>Om(q(dRT(Tj(VE< z4v)o9d+QrOK}_{vC2TR&-Z)bFarZOGy&2`te#{`Kn_eUE>0~@W?j1B9!9# zyu`eGQ27-s&cMJ24c@HGl1z|`9c2)~OCzy*dRT(T4rnPyBj4e%7!s{n_4EsBtd7Z{ zLma~`p6*eL4bV@lexNLd+6%23&_iMR0&ZX~ zTfz-YLi8jA>REt!fdhy^^f6yV)qySs$}CA}610BWc2g+ioy|5~Iph7{J2#crp z2mtfg1OZ?kBaZ+^GPr@r(2~l)zzIx0piEJcSXu;Xc!6nPDFk`yjtwS1Cu@kQOimDE5hyLqOkn_mpG*u4ybKHtlNH587+EG8N(lqWkCFP5 z6Phf**g#AKq+xQ&FOkWiP0ny}m^?adAf^dczvK_9dIK>*u=td}2yp{3Ua*+SKZuxt z7$=zD0_CHd4dO%9Och~7n1f9nvY3GwE6CjGE=)j8;Z2SNJ%Owl#x@WW2OF}56=;a6 z7%+5zCf;FX)F9hLn90brftWVf;1n*P!RX-)4cqBUxCwgRl$8Y-yBw1Zjg`UXUExL1 zV#>n^l%5>Jz#s~W{J result, + Err(_) => { + let err_msg = format!("Request timed out after {} seconds", timeout.as_secs()); + println!("{}", err_msg); + return Err(Error::StringError(err_msg)); + } + }; // println!("---------------------------------------------"); // dbg!(&res); // println!("---------------------------------------------"); - Ok(res) + // sets the base path for storing logs + // see https://github.com/tauri-apps/tauri/discussions/5557 + let app_data_dir = app_handle + .path_resolver() + .app_data_dir() + .unwrap_or_else(|| panic!("Failed to get application data directory")); + let app_data_dir_str = app_data_dir.to_string_lossy(); + + // Log the experiment if it's successful + match res { + Ok(generation_response) => { + log_experiment(&config, ¶ms, &generation_response, &app_data_dir_str).await?; + Ok(generation_response) + } + Err(err) => Err(Error::StringError(err.to_string())), + } } #[tauri::command]