Fix broken textual detection in chat & inspect
This commit is contained in:
parent
f46b8195ed
commit
5eb250af05
2 changed files with 33 additions and 50 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
# pyright: reportPossiblyUnboundVariable=false
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import uuid
|
import uuid
|
||||||
|
|
@ -7,6 +6,28 @@ from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
import textual_image.widget # noqa: F401 - import early for renderer detection
|
||||||
|
from ag_ui.core import (
|
||||||
|
ActivitySnapshotEvent,
|
||||||
|
AssistantMessage,
|
||||||
|
EventType,
|
||||||
|
RunAgentInput,
|
||||||
|
StateDeltaEvent,
|
||||||
|
TextMessageContentEvent,
|
||||||
|
ToolCallArgsEvent,
|
||||||
|
ToolCallEndEvent,
|
||||||
|
ToolCallStartEvent,
|
||||||
|
UserMessage,
|
||||||
|
)
|
||||||
|
from jsonpatch import JsonPatch
|
||||||
|
from pydantic_ai import Agent
|
||||||
|
from pydantic_ai.ag_ui import AGUIAdapter
|
||||||
|
from textual.app import App, SystemCommand
|
||||||
|
from textual.binding import Binding
|
||||||
|
from textual.widgets import Footer, Header, Input
|
||||||
|
from textual.worker import Worker
|
||||||
|
|
||||||
|
from haiku.rag.chat.widgets.chat_history import ChatHistory, CitationWidget
|
||||||
from haiku.rag.client import HaikuRAG
|
from haiku.rag.client import HaikuRAG
|
||||||
from haiku.rag.config import get_config
|
from haiku.rag.config import get_config
|
||||||
from haiku.rag.skills.rag import AGENT_PREAMBLE, RAGState
|
from haiku.rag.skills.rag import AGENT_PREAMBLE, RAGState
|
||||||
|
|
@ -17,9 +38,6 @@ from haiku.skills.agent import (
|
||||||
from haiku.skills.models import Skill
|
from haiku.skills.models import Skill
|
||||||
from haiku.skills.prompts import build_system_prompt
|
from haiku.skills.prompts import build_system_prompt
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from textual.app import ComposeResult
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import logfire
|
import logfire
|
||||||
|
|
||||||
|
|
@ -28,35 +46,8 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
if TYPE_CHECKING:
|
||||||
import textual_image.widget # noqa: F401 - import early for renderer detection
|
from textual.app import ComposeResult
|
||||||
from ag_ui.core import (
|
|
||||||
ActivitySnapshotEvent,
|
|
||||||
AssistantMessage,
|
|
||||||
EventType,
|
|
||||||
RunAgentInput,
|
|
||||||
StateDeltaEvent,
|
|
||||||
TextMessageContentEvent,
|
|
||||||
ToolCallArgsEvent,
|
|
||||||
ToolCallEndEvent,
|
|
||||||
ToolCallStartEvent,
|
|
||||||
UserMessage,
|
|
||||||
)
|
|
||||||
from jsonpatch import JsonPatch
|
|
||||||
from pydantic_ai import Agent
|
|
||||||
from pydantic_ai.ag_ui import AGUIAdapter
|
|
||||||
from textual.app import App, SystemCommand
|
|
||||||
from textual.binding import Binding
|
|
||||||
from textual.widgets import Footer, Header, Input
|
|
||||||
from textual.worker import Worker
|
|
||||||
|
|
||||||
from haiku.rag.chat.widgets.chat_history import ChatHistory, CitationWidget
|
|
||||||
|
|
||||||
TEXTUAL_AVAILABLE = True
|
|
||||||
except ImportError:
|
|
||||||
TEXTUAL_AVAILABLE = False
|
|
||||||
App = object # type: ignore
|
|
||||||
SystemCommand = object # type: ignore
|
|
||||||
|
|
||||||
|
|
||||||
RAG_STATE_NAMESPACE = "rag"
|
RAG_STATE_NAMESPACE = "rag"
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,22 @@
|
||||||
# pyright: reportPossiblyUnboundVariable=false
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from textual.app import App
|
||||||
|
from textual.binding import Binding
|
||||||
|
from textual.screen import Screen
|
||||||
|
from textual.widgets import Footer, Header
|
||||||
|
|
||||||
from haiku.rag.client import HaikuRAG
|
from haiku.rag.client import HaikuRAG
|
||||||
from haiku.rag.config import get_config
|
from haiku.rag.config import get_config
|
||||||
|
from haiku.rag.inspector.widgets.chunk_list import ChunkList
|
||||||
|
from haiku.rag.inspector.widgets.detail_view import DetailView
|
||||||
|
from haiku.rag.inspector.widgets.document_list import DocumentList
|
||||||
|
from haiku.rag.inspector.widgets.search_modal import SearchModal
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from textual.app import ComposeResult
|
from textual.app import ComposeResult
|
||||||
|
|
||||||
try:
|
|
||||||
from textual.app import App
|
|
||||||
from textual.binding import Binding
|
|
||||||
from textual.screen import Screen
|
|
||||||
from textual.widgets import Footer, Header
|
|
||||||
|
|
||||||
from haiku.rag.inspector.widgets.chunk_list import ChunkList
|
|
||||||
from haiku.rag.inspector.widgets.detail_view import DetailView
|
|
||||||
from haiku.rag.inspector.widgets.document_list import DocumentList
|
|
||||||
from haiku.rag.inspector.widgets.search_modal import SearchModal
|
|
||||||
|
|
||||||
TEXTUAL_AVAILABLE = True
|
|
||||||
except ImportError:
|
|
||||||
TEXTUAL_AVAILABLE = False
|
|
||||||
App = object # type: ignore
|
|
||||||
|
|
||||||
|
|
||||||
class InspectorApp(App):
|
class InspectorApp(App):
|
||||||
"""Textual TUI for inspecting LanceDB data."""
|
"""Textual TUI for inspecting LanceDB data."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue