Files
opencatd-open/frontend
Sakurasan ef3025dd80 refactor: complete backend rewrite for multi-protocol proxy
Major rewrite of the Go backend to support:
- Three API format imports: openai, anthropic, compatible
- Three protocol conversions: Chat Completions, Responses, Messages
- Hub-and-spoke architecture with Chat as intermediate format

Deleted:
- opencat.go (old entry)
- store/, team/, pkg/team/, pkg/store/ (old data layer)
- internal/model/, internal/consts/ (old types)
- internal/service/team/, internal/controller/team/ (old handlers)
- llm/ (removed LLM client library, pure proxy mode)
- dist/, assets/ (old build artifacts)

Added:
- internal/store/ — 9 GORM models + multi-DB support
- internal/pkg/ — crypto (AES-GCM), apikey, jwt, ratelimit, resp, tokenizer
- internal/channel/ — channel selection, weighted LB, health checks
- internal/proxy/convert/ — 6 protocol conversion functions + SSE streaming
- internal/proxy/ — gateway with request dispatch and upstream selection
- internal/usage/ — async usage recorder with batch writes
- internal/api/ — management API (auth, users, keys, channels, models)
- Makefile for build/test/deploy

Fixed API to match frontend expectations:
- Login response wraps token in { data: { token } }
- GET /api/profile route added
- Profile response wraps user in { code, data }
- Role returned as number (10=admin, 1=user)
2026-08-30 11:49:31 +08:00
..
2025-04-20 02:03:13 +08:00
2025-04-16 18:14:53 +08:00

opencatd-open frontend

Vue 3 + TypeScript + Vite + Tailwind CSS 4 / daisyUI 5。

本地开发

前端通过 Vite dev server 开发(支持热更新),/api 请求代理到本地 Go 后端,无需每次重新构建嵌入:

# 方式一:一条命令并行启动前后端(后端 8080,前端 5173)
make dev

# 方式二:分开跑
make dev-backend    # go run ./cmd/openteam,PORT=8080
make dev-frontend   # cd frontend && pnpm dev

浏览器访问 http://localhost:5173 (localhost 属浏览器安全上下文,clipboard / Passkey 可直接用)。

环境变量:

变量 说明 默认
VITE_DEV_API_TARGET dev 代理的后端地址 http://localhost:8080
VITE_DEV_HTTPS 设为 true 时启用自签名 HTTPS dev server 关闭

构建与嵌入

make web 构建前端并把产物移入 cmd/openteam/dist(Go 通过 //go:embed all:dist 嵌入);make build 编译二进制。dist 目录仅含 .gitkeep 占位时后端也能正常编译,因此克隆后可直接 make dev-backend 起后端联调。

其他常用命令

pnpm dev         # 仅前端 dev server
pnpm typecheck   # vue-tsc 类型检查
pnpm build       # 类型检查 + 生产构建