Add LLM input logging and UI log pane
- Add log_queue to PipelineOrchestrator and log LLM inputs to UI - Use entity_name for lore update logs instead of topic - Pass log_queue into ConfirmationApp to display logs in UI - Introduce a log pane and left/right pane layout in the UI - Poll and render log messages via a new poll_log_updates worker - Run log polling with Textual workers to avoid GC issues - Fix ListView insertion by wrapping ListItem in a list - Relax RAG similarity threshold from 0.7 to 0.5
This commit is contained in:
@@ -53,6 +53,7 @@ class PipelineOrchestrator:
|
||||
self.ui_to_llm_queue = asyncio.Queue()
|
||||
self.clean_to_llm_queue = asyncio.Queue()
|
||||
self.llm_to_ui_queue = asyncio.Queue()
|
||||
self.log_queue = asyncio.Queue()
|
||||
|
||||
self.is_running = False
|
||||
|
||||
@@ -202,6 +203,9 @@ class PipelineOrchestrator:
|
||||
# RAG Retrieval for context
|
||||
context = await asyncio.to_thread(self.rag_manager.retrieve, text)
|
||||
|
||||
# Log the text sent to the LLM for UI affordance
|
||||
await self.log_queue.put(f"[{speaker}] {text}")
|
||||
|
||||
# Structured extraction using the processor
|
||||
extraction_result = await asyncio.to_thread(
|
||||
self.processor.extract_structured_data,
|
||||
@@ -212,7 +216,7 @@ class PipelineOrchestrator:
|
||||
# Persistence: Lore Updates
|
||||
for lore_update in extraction_result.lore_updates:
|
||||
await asyncio.to_thread(update_lore, lore_update)
|
||||
logger.info(f"LLM Worker: Lore updated: {lore_update.topic}")
|
||||
logger.info(f"LLM Worker: Lore updated: {lore_update.entity_name}")
|
||||
|
||||
# Persistence: Character State Updates
|
||||
for char_update in extraction_result.character_updates:
|
||||
@@ -271,6 +275,7 @@ class PipelineOrchestrator:
|
||||
app = ConfirmationApp(
|
||||
ui_to_llm_queue=self.ui_to_llm_queue,
|
||||
llm_to_ui_queue=self.llm_to_ui_queue,
|
||||
log_queue=self.log_queue,
|
||||
)
|
||||
await app.run_async()
|
||||
self.stop()
|
||||
|
||||
Reference in New Issue
Block a user