Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
api-serving【部署与运维】Guides ChatGLM2-6B FastAPI and OpenAI-compatible serving, request validation, conversation-history mapping, streaming SSE, and safe local deployment.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this route for the repo's HTTP services, curl/OpenAI client integration,
SSE streaming, endpoint contracts, or service troubleshooting. Use
chat-and-demos for local UI/CLI generation and
ptuning when the model is a prefix/full fine-tuned
checkpoint.
/ accepting prompt, optional history,
max_length, top_p, and temperature. It returns response, updated
history, status, and a timestamp.GET /v1/models plus
POST /v1/chat/completions. Use this for clients that already speak the
Chat Completions protocol. The repository supports normal JSON responses and
Server-Sent Event streaming.Read api-contracts.md before writing a client.
Read deployment.md before starting Uvicorn; the
service loads model weights once, keeps global model/tokenizer state, and
binds a listener. Run the bundled validators first:
python sub-skills/api-serving/scripts/validate_api_payload.py --json '{"prompt":"你好","history":[]}'
python sub-skills/api-serving/scripts/validate_openai_messages.py --json '{"model":"chatglm2-6b","messages":[{"role":"user","content":"你好"}]}'
.cuda() and assumes model weights fit on one or more
GPUs.fastapi, uvicorn, and sse-starlette for the OpenAI streaming
route in addition to the model runtime.finish_reason chunk and [DONE].allow_origins=["*"] as development defaults, not a
production security policy. Add authentication, origin restrictions, rate
limits, and timeouts outside this legacy sample.The source route introspection is safe and confirms /, /v1/models, and
/v1/chat/completions; it does not prove that a model can load. Use
troubleshooting.md for model, port, role,
SSE, and memory failures.