Files
stack/workers/fleet-provider-dto-fix-prompt.txt

52 lines
2.4 KiB
Plaintext

Fix the fleet-settings "Add Provider" form in ~/src/mosaic-stack so it submits the correct field names to the API.
## Background
The Add Provider UI form (apps/web) sends these fields to POST /api/llm-providers:
- type (should be: providerType)
- baseUrl (should be nested inside config.endpoint)
- models (should be nested inside config.models)
- displayName (correct)
- apiKey (should be nested inside config.apiKey)
The API DTO (apps/api/src/llm/dto/provider-admin.dto.ts) expects:
{
providerType: "ollama" | "openai" | "claude",
displayName: string,
config: {
endpoint?: string, // the base URL
apiKey?: string,
models?: string[], // list of model IDs
timeout?: number
},
isDefault?: boolean,
isEnabled?: boolean
}
## Files to Change
- apps/web — find the Add Provider form/dialog component (search for "Add Provider" or "baseUrl" or "providerType")
- Fix the form submission to map fields correctly before POSTing
## Process
1. git checkout main && git pull --ff-only origin main
2. Create branch: fix/fleet-provider-form-dto
3. Find the form component — search: grep -r "baseUrl\|Add Provider\|providerType" apps/web/src --include="*.tsx" --include="*.ts" -l
4. Fix field mapping in the form submit handler:
- type → providerType
- baseUrl → config.endpoint
- models (textarea, newline-separated) → config.models (string array, split by newline, trim, filter empty)
- apiKey → config.apiKey
5. Also fix the models input: if it's a textarea with one model per line, split on newline before submitting
## Completion Requirements (MANDATORY)
1. Run: pnpm turbo lint typecheck --filter=@mosaic/web
2. Run: pnpm --filter @mosaic/web test -- --run (if tests exist)
3. Review: confirm form submit payload matches CreateLlmProviderDto exactly
4. Commit: "fix(web): correct Add Provider form field mapping to match API DTO"
5. Push and create PR:
~/.config/mosaic/tools/git/pr-create.sh \
-t "fix(web): correct Add Provider form DTO field mapping" \
-b "The Add Provider form was sending top-level fields (type, baseUrl, models) that do not match the API DTO. Fixed to send providerType and nest endpoint/apiKey/models inside config object. Models textarea is now split by newline into a string array."
When completely finished, run:
openclaw system event --text "Done: fleet-provider form DTO fix PR ready" --mode now