How watanabe3tipapa/sarashina-mercury works
Sarashina Mercury is a browser-based PWA for using Sarashina models. Users configure a key and preferences, then enter chat, translation, RAG, or Guard through routed pages; those pages call the API client, which streams or returns results for display. Chat history is persisted locally, and optional input/output safety checks share Guard. README documents a Worker proxy for CORS, but its relationship to the client is configuration-based; the worker forwards requests and does not store keys. Connections below follow excerpts and README; unsampled feature internals are represented by their documented page capabilities.
Main entry points: App.tsx App routes · useSettingsStore.ts Settings state · sarashina.ts Sarashina client · ChatPage.tsx Streaming chat
Components 19
Application shell
- App routes
src/App.tsx - Error boundary
src/components/ErrorBoundary.tsx
User workflows
- Settings
src/features/settings/SettingsPage.tsx - Streaming chat
src/features/chat/ChatPage.tsx - Translation editor
src/features/tools/TranslatePage.tsx - RAG search
src/features/tools/RAGPage.tsx - Guard checker
src/features/tools/GuardPage.tsx - Guard notice
src/components/GuardNotice.tsx - Parallel editor
src/components/editor/EditorPane.tsx - Source citations
src/components/SourceCitation.tsx
Local state
- Settings state
src/store/useSettingsStore.ts - Conversation state
src/store/useChatStore.ts - IndexedDB history
src/lib/db/conversations.ts - Theme behavior
src/lib/theme.ts - Token pricing
src/lib/tokens.ts
Model access
- Sarashina client
src/lib/api/sarashina.ts - CORS proxy
worker/src/index.ts
Other components
- User
- Sarashina API
Connections 29
- User → App routes: opens app
README.md - App routes → Streaming chat: routes to
src/App.tsx - App routes → Settings: routes to
src/App.tsx - App routes → Translation editor: routes to
src/App.tsx - App routes → RAG search: routes to
src/App.tsx - App routes → Guard checker: routes to
src/App.tsx - App routes → Error boundary: wrapped by
src/main.tsx - Streaming chat → Settings state: reads settings
src/features/chat/ChatPage.tsx - Settings → Settings state: updates settings
src/features/settings/SettingsPage.tsx - Translation editor → Settings state: reads settings
src/features/tools/TranslatePage.tsx - RAG search → Settings state: reads settings
src/features/tools/RAGPage.tsx - Guard checker → Settings state: reads settings
src/features/tools/GuardPage.tsx - Settings state → Theme behavior: stores preference
src/store/useSettingsStore.ts - Settings state → Token pricing: loads pricing
src/store/useSettingsStore.ts - Streaming chat → Conversation state: manages conversations
src/features/chat/ChatPage.tsx - Conversation state → IndexedDB history: reads and writes
src/store/useChatStore.ts - Streaming chat → Sarashina client: streams chat and checks
src/features/chat/ChatPage.tsx - Translation editor → Sarashina client: translates and checks
src/features/tools/TranslatePage.tsx - RAG search → Sarashina client: reranks, answers, checks
src/features/tools/RAGPage.tsx - Guard checker → Sarashina client: checks text
src/features/tools/GuardPage.tsx - Sarashina client → Sarashina API: sends model requests
src/lib/api/sarashina.ts - Translation editor → Parallel editor: edits paired text
src/features/tools/TranslatePage.tsx - RAG search → Source citations: shows sources
README.md - Streaming chat → Guard notice: renders verdict
src/features/chat/ChatPage.tsx - Translation editor → Guard notice: renders verdict
src/features/tools/TranslatePage.tsx - RAG search → Guard notice: renders verdict
src/features/tools/RAGPage.tsx - Guard checker → Guard notice: renders verdict
src/features/tools/GuardPage.tsx - Sarashina client → CORS proxy: may target configured proxy
README.md - CORS proxy → Sarashina API: forwards requests
README.md