Bunch of cleaning

This commit is contained in:
jif-oai
2026-01-06 20:05:04 +00:00
parent dc76e8fbe4
commit cc6179ec83
4 changed files with 18 additions and 6 deletions

View File

@@ -507,7 +507,7 @@ impl App {
}
fn open_new_conversation_prompt(&mut self) {
let (initial_prompt, initial_images) = self.chat_widget.take_composer_draft();
let (initial_prompt, initial_images) = self.chat_widget.composer_draft();
let tx = self.app_event_tx.clone();
let initial_prompt = Arc::new(initial_prompt);
@@ -998,6 +998,7 @@ impl App {
return Ok(true);
}
};
self.chat_widget.set_composer_text(String::new());
let conversation_id = created.conversation_id;
if !self.conversation_order.contains(&conversation_id) {

View File

@@ -414,6 +414,13 @@ impl ChatComposer {
images.into_iter().map(|img| img.path).collect()
}
pub(crate) fn attached_image_paths(&self) -> Vec<PathBuf> {
self.attached_images
.iter()
.map(|img| img.path.clone())
.collect()
}
pub(crate) fn flush_paste_burst_if_due(&mut self) -> bool {
self.handle_paste_burst_flush(Instant::now())
}

View File

@@ -549,6 +549,10 @@ impl BottomPane {
self.composer.take_recent_submission_images()
}
pub(crate) fn composer_attached_image_paths(&self) -> Vec<PathBuf> {
self.composer.attached_image_paths()
}
fn as_renderable(&'_ self) -> RenderableItem<'_> {
if let Some(view) = self.active_view() {
RenderableItem::Borrowed(view)

View File

@@ -3559,11 +3559,11 @@ impl ChatWidget {
.unwrap_or_default()
}
pub(crate) fn take_composer_draft(&mut self) -> (String, Vec<PathBuf>) {
let text = self.bottom_pane.composer_text();
let images = self.bottom_pane.take_recent_submission_images();
self.bottom_pane.set_composer_text(String::new());
(text, images)
pub(crate) fn composer_draft(&self) -> (String, Vec<PathBuf>) {
(
self.bottom_pane.composer_text(),
self.bottom_pane.composer_attached_image_paths(),
)
}
pub(crate) fn conversation_id(&self) -> Option<ConversationId> {