From 699e0a1f39de6cf4a804c898800d5c50206d3a77 Mon Sep 17 00:00:00 2001 From: trevyn <230691+trevyn@users.noreply.github.com> Date: Tue, 23 Jul 2024 09:56:48 +0400 Subject: [PATCH] cleanup and load primary document on launch --- src/main.rs | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/src/main.rs b/src/main.rs index 424d673..d516b74 100644 --- a/src/main.rs +++ b/src/main.rs @@ -356,19 +356,6 @@ impl eframe::App for App { .changed() .then(|| setting2.save()); - if ui.button("add window").clicked() { - WHEEL_WINDOWS.lock().unwrap().push(Default::default()); - }; - - for name in self.speaker_names.iter_mut() { - ui.horizontal(|ui| { - // ui.label(format!("Speaker {}", i + 1)); - ui.add(TextEdit::singleline(name).desired_width(f32::INFINITY)).changed().then(|| { - // self.speaker_names[i] = name.clone(); - }); - }); - } - ScrollArea::vertical().auto_shrink([false, false]).show(ui, |_ui| { // let size = [ui.available_width(), ui.spacing().interact_size.y.max(20.0)]; // for card in cards { @@ -381,19 +368,6 @@ impl eframe::App for App { }); }); - egui::Window::new("").show(ctx, |ui| { - if ui - .add( - TextEdit::multiline(&mut self.completion_prompt) - .font(FontId::new(20.0, FontFamily::Monospace)) - .desired_width(f32::INFINITY), - ) - .changed() - { - *COMPLETION_PROMPT.lock().unwrap() = self.completion_prompt.clone(); - } - }); - for (window_num, window) in WHEEL_WINDOWS.lock().unwrap().iter_mut().enumerate() { if window.request_close { window.open = false; @@ -664,6 +638,13 @@ async fn main() -> Result<(), Box> { self_update::self_update().await.ok(); + if let Some(document) = select!(Option "ORDER BY timestamp_ms DESC LIMIT 1")? { + WHEEL_WINDOWS.lock().unwrap().push(WheelWindow { + messages: vec![ChatMessage { role: User, content: document.content }], + ..Default::default() + }); + } + // Ok(()) // let rt = tokio::runtime::Runtime::new().expect("Unable to create Runtime");