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,30 +6,8 @@ from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
from haiku.rag.client import HaikuRAG
|
import textual_image.widget # noqa: F401 - import early for renderer detection
|
||||||
from haiku.rag.config import get_config
|
from ag_ui.core import (
|
||||||
from haiku.rag.skills.rag import AGENT_PREAMBLE, RAGState
|
|
||||||
from haiku.skills.agent import (
|
|
||||||
SkillToolset,
|
|
||||||
run_agui_stream,
|
|
||||||
)
|
|
||||||
from haiku.skills.models import Skill
|
|
||||||
from haiku.skills.prompts import build_system_prompt
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from textual.app import ComposeResult
|
|
||||||
|
|
||||||
try:
|
|
||||||
import logfire
|
|
||||||
|
|
||||||
logfire.configure(send_to_logfire="if-token-present", console=False)
|
|
||||||
logfire.instrument_pydantic_ai()
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
try:
|
|
||||||
import textual_image.widget # noqa: F401 - import early for renderer detection
|
|
||||||
from ag_ui.core import (
|
|
||||||
ActivitySnapshotEvent,
|
ActivitySnapshotEvent,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
EventType,
|
EventType,
|
||||||
|
|
@ -41,22 +18,36 @@ try:
|
||||||
ToolCallEndEvent,
|
ToolCallEndEvent,
|
||||||
ToolCallStartEvent,
|
ToolCallStartEvent,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
)
|
)
|
||||||
from jsonpatch import JsonPatch
|
from jsonpatch import JsonPatch
|
||||||
from pydantic_ai import Agent
|
from pydantic_ai import Agent
|
||||||
from pydantic_ai.ag_ui import AGUIAdapter
|
from pydantic_ai.ag_ui import AGUIAdapter
|
||||||
from textual.app import App, SystemCommand
|
from textual.app import App, SystemCommand
|
||||||
from textual.binding import Binding
|
from textual.binding import Binding
|
||||||
from textual.widgets import Footer, Header, Input
|
from textual.widgets import Footer, Header, Input
|
||||||
from textual.worker import Worker
|
from textual.worker import Worker
|
||||||
|
|
||||||
from haiku.rag.chat.widgets.chat_history import ChatHistory, CitationWidget
|
from haiku.rag.chat.widgets.chat_history import ChatHistory, CitationWidget
|
||||||
|
from haiku.rag.client import HaikuRAG
|
||||||
|
from haiku.rag.config import get_config
|
||||||
|
from haiku.rag.skills.rag import AGENT_PREAMBLE, RAGState
|
||||||
|
from haiku.skills.agent import (
|
||||||
|
SkillToolset,
|
||||||
|
run_agui_stream,
|
||||||
|
)
|
||||||
|
from haiku.skills.models import Skill
|
||||||
|
from haiku.skills.prompts import build_system_prompt
|
||||||
|
|
||||||
TEXTUAL_AVAILABLE = True
|
try:
|
||||||
|
import logfire
|
||||||
|
|
||||||
|
logfire.configure(send_to_logfire="if-token-present", console=False)
|
||||||
|
logfire.instrument_pydantic_ai()
|
||||||
except ImportError:
|
except ImportError:
|
||||||
TEXTUAL_AVAILABLE = False
|
pass
|
||||||
App = object # type: ignore
|
|
||||||
SystemCommand = object # type: ignore
|
if TYPE_CHECKING:
|
||||||
|
from textual.app import ComposeResult
|
||||||
|
|
||||||
|
|
||||||
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