Update UI and prompts
This commit is contained in:
+47
-38
@@ -3,7 +3,7 @@ from typing import List, Optional, Union
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Container, Horizontal, Vertical
|
||||
from textual.widgets import Button, DataTable, Footer, Input, Label, Static
|
||||
from textual.widgets import Button, DataTable, Footer, Input, Label, ListView, Static
|
||||
|
||||
from src.llm.models import CharacterStateUpdate, ExtractionResult, LoreUpdate
|
||||
from src.persistence.characters import update_character_state
|
||||
@@ -12,18 +12,16 @@ from src.persistence.lore import update_lore
|
||||
|
||||
class ConfirmationApp(App):
|
||||
CSS = """
|
||||
Screen {
|
||||
layout: horizontal;
|
||||
#main-container {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#top-pane {
|
||||
height: 70%;
|
||||
}
|
||||
|
||||
#left-pane {
|
||||
width: 30%;
|
||||
border: solid;
|
||||
padding: 1;
|
||||
}
|
||||
|
||||
#middle-pane {
|
||||
width: 30%;
|
||||
width: 60%;
|
||||
border: solid;
|
||||
padding: 1;
|
||||
}
|
||||
@@ -35,6 +33,12 @@ class ConfirmationApp(App):
|
||||
layout: vertical;
|
||||
}
|
||||
|
||||
#middle-pane {
|
||||
height: 30%;
|
||||
border: solid;
|
||||
padding: 1;
|
||||
}
|
||||
|
||||
#details-container {
|
||||
height: auto;
|
||||
margin-bottom: 1;
|
||||
@@ -84,35 +88,38 @@ class ConfirmationApp(App):
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Container(
|
||||
Horizontal(
|
||||
Vertical(
|
||||
DataTable(id="update-table"),
|
||||
id="left-pane",
|
||||
Vertical(
|
||||
Horizontal(
|
||||
Vertical(
|
||||
DataTable(id="update-table"),
|
||||
id="left-pane",
|
||||
),
|
||||
Vertical(
|
||||
Vertical(
|
||||
Label("Details:", id="details-label"),
|
||||
Static("No update selected", id="details-text"),
|
||||
id="details-container",
|
||||
),
|
||||
Vertical(
|
||||
Label("Edit Value:"),
|
||||
Input(id="edit-input"),
|
||||
Button("Save Edit", id="save-edit"),
|
||||
id="edit-container",
|
||||
),
|
||||
Horizontal(
|
||||
Button("Accept", id="btn-accept"),
|
||||
Button("Reject", id="btn-reject"),
|
||||
Button("Edit", id="btn-edit"),
|
||||
id="actions-container",
|
||||
),
|
||||
id="right-pane",
|
||||
),
|
||||
),
|
||||
Vertical(
|
||||
Static("No context available", id="context-pane"),
|
||||
Horizontal(
|
||||
ListView(id="context-pane"),
|
||||
id="middle-pane",
|
||||
),
|
||||
Vertical(
|
||||
Vertical(
|
||||
Label("Details:", id="details-label"),
|
||||
Static("No update selected", id="details-text"),
|
||||
id="details-container",
|
||||
),
|
||||
Vertical(
|
||||
Label("Edit Value:"),
|
||||
Input(id="edit-input"),
|
||||
Button("Save Edit", id="save-edit"),
|
||||
id="edit-container",
|
||||
),
|
||||
Horizontal(
|
||||
Button("Accept", id="btn-accept"),
|
||||
Button("Reject", id="btn-reject"),
|
||||
Button("Edit", id="btn-edit"),
|
||||
id="actions-container",
|
||||
),
|
||||
id="right-pane",
|
||||
),
|
||||
id="main-container",
|
||||
),
|
||||
Footer(),
|
||||
)
|
||||
@@ -169,11 +176,13 @@ class ConfirmationApp(App):
|
||||
while True:
|
||||
try:
|
||||
update = await self.context_queue.get()
|
||||
context_pane = self.query_one("#context-pane", Static)
|
||||
context_pane = self.query_one("#context-pane", ListView)
|
||||
|
||||
# Format the update for display
|
||||
display_text = f"Query: {update.query}\nSource: {update.source}\n\n{update.snippet}"
|
||||
context_pane.update(display_text)
|
||||
|
||||
# Add a new Static widget to the ListView
|
||||
context_pane.mount(Static(display_text))
|
||||
|
||||
if hasattr(self.context_queue, "task_done"):
|
||||
self.context_queue.task_done()
|
||||
|
||||
Reference in New Issue
Block a user