Skip to content

G-Mie/interview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web AI Chatbox

项目一的实现落在当前仓库中:

  • 前端:React + TypeScript + Vite + Tailwind CSS
  • 后端:Python + FastAPI
  • 部署方式:FastAPI 提供 /api 接口,并在构建后直接托管 React 静态文件

端口选择

按照 /root/README.md 的映射规则:

  • 50600 -> 8800
  • 50601 -> 8801
  • 50602 -> 8802
  • 50603 -> 8803
  • 50604 -> 8804
  • 50605 -> 8805

当前实现默认使用第一组空闲映射:50600 -> 8800

如果需要再次确认,可运行:

python3 scripts/find_port.py

前端开发

cd frontend
npm install
npm run dev

默认前端开发端口是 5173,并自动代理 /apihttp://127.0.0.1:8800

后端开发

先安装 uv(若系统未自带):

python3 -m pip install --user uv

安装依赖并启动:

cd backend
/root/.local/bin/uv sync
/root/.local/bin/uv run uvicorn app.main:app --host 0.0.0.0 --port 8800 --reload

一体化运行

先构建前端:

cd frontend
npm install
npm run build

再启动后端:

cd backend
/root/.local/bin/uv sync
/root/.local/bin/uv run uvicorn app.main:app --host 0.0.0.0 --port 8800

此时可以通过:

  • 本机:http://127.0.0.1:8800
  • 公网映射:http://js2.blockelite.cn:50600

访问页面。

配置说明

后端会优先读取以下环境变量:

  • AI_CHATBOX_UPSTREAM_BASE_URL
  • AI_CHATBOX_UPSTREAM_API_KEY
  • AI_CHATBOX_UPSTREAM_MODEL

如果未显式配置,后端会自动从 /root/README.md 解析测试 API、API Key 和模型名称,以便当前面试环境可以直接运行。

About

it's about anji interview

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors