mirror of
https://github.com/cita-777/metapi.git
synced 2026-10-31 03:02:19 +08:00
- Updated modelTesterSession tests to serialize assistant history as output_text and removed mime_type from input_file. - Introduced new tests for stats proxy logs routes, covering paginated log retrieval and detailed log views with parsed billing details. - Added server-driven tests for ProxyLogs component to validate API interactions and UI rendering based on server data.
2.3 KiB
2.3 KiB
Contributing
Thanks for contributing to Metapi.
Local Setup
- Install dependencies:
npm install
- Create a local environment file:
Copy-Item .env.example .env
cp .env.example .env
- Initialize the default SQLite database:
npm run db:migrate
Common Commands
App development
npm run dev
npm run dev:server
restart.bat
npm run devstarts the Fastify server and Vite together.npm run dev:serverruns only the backend watcher.restart.batis the Windows-friendly restart entrypoint; it forwards toscripts\dev\restart.bat, clears stale listeners, and startsnpm run dev.
Docs
npm run docs:dev
npm run docs:build
npm run docs:preview
Desktop
npm run dev:desktop
npm run build:desktop
npm run dist:desktop
npm run package:desktop
npm run dev:desktop expects the backend on http://127.0.0.1:4000 and the Vite frontend on http://127.0.0.1:5173.
Test, build, and smoke checks
npm test
npm run test:watch
npm run build
npm run build:web
npm run build:server
npm run smoke:db
npm run smoke:db:sqlite
npm run smoke:db:mysql -- --db-url mysql://user:pass@host:3306/db
npm run smoke:db:postgres -- --db-url postgres://user:pass@host:5432/db
Windows Notes
- Prefer
Copy-Itemor Explorer copy/paste overcpif you are working in PowerShell orcmd.exe. - If a previous dev process keeps ports busy, use
restart.batinstead of manually hunting PIDs. - If dependencies or
.cmdshims look broken after a Node.js upgrade, rerunnpm installbefore assuming the scripts are wrong.
Pull Request Guidelines
- Keep PRs focused and small.
- Add or update tests for behavior changes.
- Update docs when user-facing behavior, commands, ports, or configuration change.
- Run the checks that match your change set before opening a PR:
- docs only:
npm run docs:build - app code:
npm testand the relevantnpm run build:* - runtime DB work: one of the
npm run smoke:db*commands
- docs only:
- Avoid committing runtime data (
data/) or temporary files (tmp/).
Commit Messages
Use concise messages with clear scope, for example:
feat: add token route health guardfix: handle empty model list in dashboarddocs: clarify docker env setup