Fix public access mode, introduce loading spinners, package fixes

This commit is contained in:
Alexander R.
2026-07-22 18:00:15 +00:00
parent 0b7259a011
commit b669d2e799
197 changed files with 698 additions and 20961 deletions
+21 -11
View File
@@ -5,7 +5,7 @@ from typing import List, Dict, Any
from textual.app import App, ComposeResult
from textual.containers import Container, Horizontal, VerticalScroll
from textual.widgets import Header, Footer, Static, OptionList, Button, Markdown, TextArea, Input
from textual.widgets import Header, Footer, Static, OptionList, Button, Markdown, TextArea, Input, LoadingIndicator
from textual.widgets.option_list import Option
from textual.binding import Binding
@@ -230,6 +230,12 @@ class TactiTermTUI(App):
overflow-y: auto;
}
#mentor-loading-indicator {
display: none;
height: 1fr;
content-align: center middle;
}
#mentor-input-title {
height: 1;
text-style: bold;
@@ -331,6 +337,7 @@ class TactiTermTUI(App):
yield Static("💡 Mentor", id="mentor-header")
with VerticalScroll(id="mentor-response-scroll"):
yield Markdown("Ask the mentor a question or click Check Answer...", id="mentor-response-display")
yield LoadingIndicator(id="mentor-loading-indicator")
yield Static("Ask Question (Enter: Send | Shift+Enter: Newline):", id="mentor-input-title")
yield MentorInputTextArea(id="mentor-question-input")
@@ -550,9 +557,8 @@ class TactiTermTUI(App):
main_box.add_class("sidebar-mentor-open")
q_input.text = ""
self.query_one("#mentor-response-display", Markdown).update(
"⏳ **Mentor is thinking and generating guidance...**\n\n*Analyzing your code, task requirements, and question...*"
)
self.query_one("#mentor-response-display", Markdown).display = False
self.query_one("#mentor-loading-indicator", LoadingIndicator).display = True
self.query_one("#status-bar", Static).update(
f"⏳ Consulting Mentor at {mentor.config.llm_base_url}..."
)
@@ -583,9 +589,8 @@ class TactiTermTUI(App):
"and give me feedback on my answer."
)
self.query_one("#mentor-response-display", Markdown).update(
"⏳ **Mentor is evaluating your solution against challenge requirements...**\n\n*Checking logic, requirements, and edge cases...*"
)
self.query_one("#mentor-response-display", Markdown).display = False
self.query_one("#mentor-loading-indicator", LoadingIndicator).display = True
self.query_one("#status-bar", Static).update("⏳ Consulting Mentor to check answer...")
self.run_worker(self._mentor_worker(challenge, code, check_question))
@@ -752,12 +757,17 @@ class TactiTermTUI(App):
self.load_challenges()
async def _mentor_worker(self, challenge: object, code: str, user_question: str) -> None:
res = await mentor.get_guidance_async(challenge, code, user_question=user_question)
response_text = res.get("mentor_response", "No response received.")
try:
res = await mentor.get_guidance_async(challenge, code, user_question=user_question)
response_text = res.get("mentor_response", "No response received.")
q_header = f"### Question / Evaluation:\n> {user_question}\n\n---\n\n" if user_question else ""
full_md = f"{q_header}{response_text}"
q_header = f"### Question / Evaluation:\n> {user_question}\n\n---\n\n" if user_question else ""
full_md = f"{q_header}{response_text}"
except Exception as e:
full_md = f"⚠️ Error consulting Mentor: {e}"
self.query_one("#mentor-loading-indicator", LoadingIndicator).display = False
self.query_one("#mentor-response-display", Markdown).display = True
self.query_one("#mentor-response-display", Markdown).update(full_md)
self.query_one("#status-bar", Static).update("Mentor response received — Press F1 to ask or F2 to check answer")