Add Phase 3: LLM integration with Ollama streaming and preflight checks

Wire the REPL to a local Ollama instance via streaming HTTP (SSE).
LLMClient handles async streaming chat, StreamHandler renders live
Markdown via Rich and accumulates tool call fragments. Startup now
runs a preflight check that verifies Ollama is reachable and the
configured model is pulled, exiting with a clear message on failure.
Also adds .gitignore and updates config to use qwen3.5.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 07:27:56 -05:00
parent 5aff2183d6
commit adbb442ce5
2 changed files with 60 additions and 0 deletions

View File

@@ -55,6 +55,12 @@ def parse_args() -> argparse.Namespace:
return parser.parse_args()
async def _preflight(config: AppConfig) -> None:
"""Check that Ollama is reachable and the configured model is available."""
async with LLMClient(config.llm) as client:
await client.preflight_check()
async def _run_repl(
ctx: SessionContext,
config: AppConfig,
@@ -171,6 +177,18 @@ def main() -> None:
if args.verbose:
print_info("Verbose mode enabled")
# Preflight: check Ollama is reachable and model exists
try:
asyncio.run(_preflight(config))
except LLMConnectionError as e:
print_error(str(e))
sys.exit(1)
except LLMError as e:
print_error(str(e))
sys.exit(1)
print_success("Ollama connected, model ready.")
# Create session and start REPL
ctx = SessionContext(config)
logger.info("startup_complete")