$ show llt22/talkio
Talkio is a local-first desktop (Windows/macOS/Linux via Tauri 2) and Android application for multi-AI group chat. Unlike a conventional ChatGPT wrapper, it orchestrates conversations where multiple AI models — OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, plus DeepSeek/Groq/Ollama via compatible endpoints — converse together in one thread, each bound to a configurable persona/identity with its own system prompt and model selection. Core features include streaming SSE generation, an MCP (Model Context Protocol) client with both stdio subprocess (desktop) and custom streamable-HTTP transports, a tool-call loop supporting iterative tool execution, automatic conversation context compression, chat branching/regeneration, file attachment parsing (PDF/Word/Excel/images), and export to Markdown/PDF. All data is local: conversations persist in SQLite via the Tauri SQL plugin, while providers, identities, MCP servers, and settings live in localStorage.
The LLM identified 5 files worth highlighting for reuse:
A factory that maps multiple AI provider API formats (OpenAI Chat Completions, OpenAI Responses, Anthropic Messages) to a single ProviderAdapter interface emitting normalized chunks. The trio of adapters (chat-completions.ts, responses.ts, anthropic-messages.ts) plus a common types.ts define request building, streaming consumption, and tool-call abstraction. This is directly extractable into any AI application needing multi-provider support without vendor lock-in.
A hand-rolled SSE parser that consumes OpenAI Chat Completions streaming responses and emits typed StreamDelta events (text, reasoning, tool calls, usage) in a vendor-neutral shape. It handles raw chunk parsing, [DONE] framing, and error propagation. Together with anthropic-messages-sse.ts and openai-responses-sse.ts, this forms a complete normalized streaming layer reusable in any chat client.
A custom StreamableHTTPClientTransport implementation for the MCP SDK that works inside the Tauri/browser sandbox where the official transport may not function. It negotiates SSE sessions, maintains the read/write stream lifecycle, and handles JSON-RPC batching and reconnection. This is non-obvious integration work that any MCP-enabling app could reuse.
A self-contained module for compressing long AI conversations: it estimates token usage (with distinct heuristics for English vs CJK text), decides when compression is needed, calls an LLM to produce a summary, and preserves the summary for subsequent API calls. No internal imports beyond shared types — it can be dropped into any LLM chat application that needs context-window management.
Parses <file path="..."> tags from AI model output and writes content to a workspace directory, with explicit path-traversal guards that reject absolute paths and ../ escapes, plus overwrite confirmation. This is a security-conscious implementation of the 'model writes files' pattern increasingly needed by agentic chat tools.