Zportal Wiki VectorDB Chat
Multi-provider AI chat with RAG (Wiki KB + VectorDB) for the Z.ai portal.
Architecture
| Component |
Port |
File |
Purpose |
| wiki-vector-chat |
8770 |
wiki-vector-chat.py |
FastAPI chat backend — multi-provider LLM, RAG pipeline, SSE streaming |
| wiki-api |
8097 |
wiki-api.py |
KB keyword search over wiki-kb.json (1,301 Q&A entries) |
| vector-db-service |
8099 |
vector-db-service.py |
TF-IDF vector search on Discord/Reddit messages |
| Frontend |
static |
zportal-chat.html |
Odysseus-style chat UI at /zportal/chat |
| wiki-chat-server |
8098 |
wiki-chat-server.py |
Legacy Z.ai GLM-4 proxy (being replaced) |
| wiki-chat-proxy |
— |
wiki-chat-proxy.py |
Legacy chat proxy helper |
Features
- Multi-provider LLM — OpenAI, Anthropic, Ollama, OpenRouter, Groq, custom endpoints
- RAG pipeline — Dual-source context from Wiki KB + VectorDB with per-session toggles
- Chat modes — Chat, Code, Brainstorm with mode-specific system prompts
- Session history — localStorage persistence, switch between sessions, auto-save
- Save to Wiki — Save AI answers as new Q&A entries in the Wiki KB
- Message actions — Copy, Redo, Save-to-Wiki buttons on AI responses
- Markdown rendering — Bold, italic, code blocks, lists in AI replies
- SSE streaming — Server-Sent Events for real-time token streaming
- Provider management — CRUD for custom providers, preset forking with API keys
- Odysseus UI — Tokyo Night palette, sidebar, chat bubbles, model picker
Provider Presets
| ID |
Name |
Format |
| zai-coding |
Z.ai Coding Plan |
OpenAI |
| openadapter |
OpenAdapter |
OpenAI |
| openrouter |
OpenRouter |
OpenRouter |
| crofai |
Crof.AI |
OpenAI |
| opencode-zen |
Opencode Zen |
OpenAI |
Nginx Config
Systemd
API Endpoints
| Method |
Path |
Description |
| POST |
/chat/message |
Main chat (SSE stream) |
| POST |
/chat/tunnel |
Server-side token chat |
| POST |
/chat/save-to-wiki |
Save Q&A to wiki KB |
| GET |
/providers |
List all providers |
| GET |
/providers/presets |
Built-in presets |
| POST |
/providers/save |
Save/edit custom provider |
| DELETE |
/providers/{id} |
Remove custom provider |
| GET |
/health |
Health check |