feat(tests): enhance modelTesterSession tests and add proxy logs tests

- 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.
This commit is contained in:
cita
2026-03-09 13:48:39 +08:00
parent 3dcf45851f
commit 136a038538
28 changed files with 1631 additions and 727 deletions
+58 -7
View File
@@ -2,7 +2,7 @@
Thanks for contributing to Metapi.
## Development Setup
## Local Setup
1. Install dependencies:
@@ -10,33 +10,84 @@ Thanks for contributing to Metapi.
npm install
```
2. Copy environment template:
2. Create a local environment file:
```powershell
Copy-Item .env.example .env
```
```bash
cp .env.example .env
```
3. Run migration and start development:
3. Initialize the default SQLite database:
```bash
npm run db:migrate
npm run dev
```
## Quality Checks
## Common Commands
Run before opening a PR:
### App development
```bash
npm run dev
npm run dev:server
restart.bat
```
- `npm run dev` starts the Fastify server and Vite together.
- `npm run dev:server` runs only the backend watcher.
- `restart.bat` is the Windows-friendly restart entrypoint; it forwards to `scripts\dev\restart.bat`, clears stale listeners, and starts `npm run dev`.
### Docs
```bash
npm run docs:dev
npm run docs:build
npm run docs:preview
```
### Desktop
```bash
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
```bash
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-Item` or Explorer copy/paste over `cp` if you are working in PowerShell or `cmd.exe`.
- If a previous dev process keeps ports busy, use `restart.bat` instead of manually hunting PIDs.
- If dependencies or `.cmd` shims look broken after a Node.js upgrade, rerun `npm install` before 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/config 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 test` and the relevant `npm run build:*`
- runtime DB work: one of the `npm run smoke:db*` commands
- Avoid committing runtime data (`data/`) or temporary files (`tmp/`).
## Commit Messages