mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix: read config from file for reload and improve provider validation
- Change reloadConfig to read from opencode.json file instead of HTTP API - Add logging for OpenCode PATCH responses to aid debugging - Make providerId optional in schema with custom validation when needed - Update test to mock fs.readFile instead of fetch
This commit is contained in:
1 parent
1f55bcdfc2
commit
8cfc6c0a17
5 files changed
+24
-35
No files matched your search
@@ -86,7 +86,7 @@ function jsonObjectField(label: string) {
|
||||
}
|
||||
|
||||
const modelFormSchema = z.object({
|
||||
providerId: z.string().min(1, 'Provider is required'),
|
||||
providerId: z.string(),
|
||||
modelId: z.string().min(1, 'Model ID is required').regex(/^[a-zA-Z0-9._-]+$/, 'Must use only letters, numbers, dots, hyphens, and underscores'),
|
||||
backingModelId: z.string(),
|
||||
providerModelProviderId: z.string(),
|
||||
@@ -124,6 +124,10 @@ const modelFormSchema = z.object({
|
||||
if (data.newProviderType === 'npm' && !data.newProviderNpm?.trim()) {
|
||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'NPM package is required for npm providers', path: ['newProviderNpm'] })
|
||||
}
|
||||
} else {
|
||||
if (!data.providerId?.trim()) {
|
||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'Provider is required', path: ['providerId'] })
|
||||
}
|
||||
}
|
||||
|
||||
for (const [field, label] of [
|
||||
|
||||
Reference in new issue
Block a user