This project is a full-stack chatbot SPA built on the EdgeOne Pages + Cloud Functions template.
It follows the EdgeOne template structure and adds:
The app keeps the standard EdgeOne cloud-function path:
On EdgeOne Pages, this function is exposed under /express.
Implemented routes:
All tokens and endpoints are read from environment variables.
Required:
Optional:
Use .env.example as the reference file.
Install dependencies:
npm install
Run Next.js locally:
npm run dev
If you run with EdgeOne local runtime, use your usual EdgeOne command (for example edgeone pages dev) so cloud functions are available under /express.
POST /express/chat
{
"question": "这个仓库怎么部署到 EdgeOne?",
"history": [
{ "role": "user", "content": "上一条问题" },
{ "role": "assistant", "content": "上一条回答" }
]
}
POST /express/chat/stream
Request body is the same as /express/chat.
SSE events:
Response:
{
"ok": true,
"answer": "...",
"sources": [
{
"score": 0.86,
"path": "docs/deploy.md",
"url": "https://...",
"name": "deploy"
}
]
}