mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-14 19:45:08 +08:00
fix(llm): switch slash-bearing modelId from path variable to query parameter (#177)
Closes #174 Model identifiers like 'Qwen/Qwen3-Embedding-8B' or 'Pro/deepseek-ai/DeepSeek-V3' carry forward slashes that Spring MVC decodes from %2F before path matching, so even with the frontend's encodeURIComponent the request never reaches the handler and 404s out. The two affected endpoints take modelId as a request param instead: DELETE /{providerId}/models/{modelId} -> DELETE /{providerId}/models?modelId=... POST /{providerId}/models/{modelId}/test -> POST /{providerId}/models/test?modelId=... modelApi.removeProviderModel / testModel in the UI follow suit, passing the id via axios params so axios handles the URL encoding consistently. providerId stays as a path variable — provider ids are kebab-case and never contain slashes.
This commit is contained in:
parent
461f81ccb5
commit
2e4f88c612
@ -156,10 +156,10 @@ public class ModelConfigController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "从 Provider 删除模型")
|
@Operation(summary = "从 Provider 删除模型")
|
||||||
@DeleteMapping("/{providerId}/models/{modelId}")
|
@DeleteMapping("/{providerId}/models")
|
||||||
@RequireWorkspaceRole("admin")
|
@RequireWorkspaceRole("admin")
|
||||||
public R<ProviderInfoDTO> removeProviderModel(@PathVariable String providerId,
|
public R<ProviderInfoDTO> removeProviderModel(@PathVariable String providerId,
|
||||||
@PathVariable String modelId) {
|
@RequestParam String modelId) {
|
||||||
return R.ok(modelProviderService.removeModel(providerId, modelId));
|
return R.ok(modelProviderService.removeModel(providerId, modelId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,10 +226,10 @@ public class ModelConfigController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "测试单个模型可用性")
|
@Operation(summary = "测试单个模型可用性")
|
||||||
@PostMapping("/{providerId}/models/{modelId}/test")
|
@PostMapping("/{providerId}/models/test")
|
||||||
@RequireWorkspaceRole("admin")
|
@RequireWorkspaceRole("admin")
|
||||||
public R<TestResult> testModel(@PathVariable String providerId,
|
public R<TestResult> testModel(@PathVariable String providerId,
|
||||||
@PathVariable String modelId) {
|
@RequestParam String modelId) {
|
||||||
return R.ok(modelDiscoveryService.testModel(providerId, modelId));
|
return R.ok(modelDiscoveryService.testModel(providerId, modelId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -494,7 +494,7 @@ export const modelApi = {
|
|||||||
addProviderModel: (providerId: string, data: any) =>
|
addProviderModel: (providerId: string, data: any) =>
|
||||||
http.post(`/models/${providerId}/models`, data),
|
http.post(`/models/${providerId}/models`, data),
|
||||||
removeProviderModel: (providerId: string, modelId: string) =>
|
removeProviderModel: (providerId: string, modelId: string) =>
|
||||||
http.delete(`/models/${providerId}/models/${encodeURIComponent(modelId)}`),
|
http.delete(`/models/${providerId}/models`, { params: { modelId } }),
|
||||||
getActive: () => http.get('/models/active'),
|
getActive: () => http.get('/models/active'),
|
||||||
setActive: (data: { providerId: string; model: string }) =>
|
setActive: (data: { providerId: string; model: string }) =>
|
||||||
http.put('/models/active', data),
|
http.put('/models/active', data),
|
||||||
@ -506,7 +506,7 @@ export const modelApi = {
|
|||||||
testConnection: (providerId: string) =>
|
testConnection: (providerId: string) =>
|
||||||
http.post(`/models/${providerId}/test-connection`),
|
http.post(`/models/${providerId}/test-connection`),
|
||||||
testModel: (providerId: string, modelId: string) =>
|
testModel: (providerId: string, modelId: string) =>
|
||||||
http.post(`/models/${providerId}/models/${encodeURIComponent(modelId)}/test`),
|
http.post(`/models/${providerId}/models/test`, null, { params: { modelId } }),
|
||||||
|
|
||||||
// ==================== RFC-074: enabled / catalog ====================
|
// ==================== RFC-074: enabled / catalog ====================
|
||||||
/** Full provider catalog including enabled=false rows; powers the Add Provider drawer. */
|
/** Full provider catalog including enabled=false rows; powers the Add Provider drawer. */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user