一键导入
server-dev
Implement or modify a Chatnificent server (DevServer, Starlette, FastAPI, etc.)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implement or modify a Chatnificent server (DevServer, Starlette, FastAPI, etc.)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Deploy the Chatnificent website (examples/showcase.py) to the Linode production server. Use when the user asks to deploy, ship, push to prod, or release the website. Runs the push-already-done → pull → reload → verify loop.
Implement or extend Chatnificent pillars (LLM, Store, Engine, Auth, Tools, etc.)
Create an example Chatnificent app to be showcased in the /examples directory.
| name | server-dev |
| description | Implement or modify a Chatnificent server (DevServer, Starlette, FastAPI, etc.) |
Use this skill when implementing a new server, modifying endpoint behavior, or working on the HTTP/SSE transport layer.
Every Chatnificent server implementation must expose these endpoints. DevServer is the reference implementation — StarletteServer, FastAPIServer, and any custom server must produce identical behavior for the same inputs.
This contract is provisional. It reflects DevServer's current behavior and will be refined as async server implementations (Starlette, FastAPI) are built. The e2e and parity tests are the authoritative spec.
| Method | Path | Request Body | Response | Notes |
|---|---|---|---|---|
| GET | / | — | HTML page (layout.render_page()) | Serves the chat UI |
| GET | /{user_id}/{convo_id} | — | HTML page with <script>window.__CHATNIFICENT_CONVO__="{convo_id}"</script> injected | Pre-loads conversation |
| GET | /api/conversations | — | {"conversations": [{"id": "...", "title": "..."}]} | Titles derived from first user message, truncated to 30 chars + "…" |
| GET | /api/conversations/{id} | — | {"id": "...", "messages": [...], "path": "..."} | Messages filtered through layout.render_messages(). 404 if not found |
| POST | /api/chat | {"message": "...", "conversation_id": "..."} | JSON or SSE stream (see below) | Dispatches based on llm.default_params["stream"] |
{
"response": "assistant text",
"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}],
"conversation_id": "abc123",
"path": "/<user_id>/<convo_id>"
}
Errors: {"error": "message"} with HTTP 400 or 500.
Content-Type: text/event-stream. Each event is data: {json}\n\n.
| Event | data Payload | Purpose |
|---|---|---|
delta | "token text" (string) | Streamed content token |
status | "Calling tool: ..." (string) | Agentic loop status |
done | {"conversation_id": "...", "path": "..."} (object) | Stream complete |
error | "error message" (string) | Error during processing |
| Property | Value |
|---|---|
| Cookie name | chatnificent_session |
| Cookie attributes | Path=/; SameSite=Lax (when mounted under a root_path, Path=<root_path>/) |
| Session resolution | auth.get_current_user_id(session_id=<cookie_value>) |
| Set-Cookie | Only on new sessions (_new_session=True) |
auth.get_current_user_id(session_id=...) — never bare get_current_user_id()url.parse(path), path building via url.build_conversation_path(user_id, convo_id)render_page() for HTML, render_messages() for message filtering, render_conversations() for sidebar datahandle_message() (non-streaming) or handle_message_stream() (SSE) — server checks llm.default_params.get("stream", False)