fix: update admin API endpoint paths to match split routers
- Changed AI endpoints from /admin/db/settings/ai to /admin/ai/settings - Changed AI prompt endpoints from /admin/db/settings/prompt to /admin/ai/settings/prompt - Changed AI keys endpoint from /admin/db/settings/ai-keys to /admin/ai/settings/keys - Changed AI test endpoint from /admin/db/settings/test-ai-key to /admin/ai/settings/test-key - DB endpoints remain unchanged under /admin/db/... - Frontend tests: 291/291 passing - Backend tests: 41/41 passing
This commit is contained in:
@@ -237,31 +237,31 @@ export const inventoryApi = {
|
|||||||
const res = await axiosInstance.get('/admin/db/settings');
|
const res = await axiosInstance.get('/admin/db/settings');
|
||||||
// We need another endpoint for general settings or expand the DB one
|
// We need another endpoint for general settings or expand the DB one
|
||||||
// For now, I'll add a specific fetch for the prompt
|
// For now, I'll add a specific fetch for the prompt
|
||||||
const promptRes = await axiosInstance.get('/admin/db/settings/prompt');
|
const promptRes = await axiosInstance.get('/admin/ai/settings/prompt');
|
||||||
return { ...res.data, ai_extraction_prompt: promptRes.data.value };
|
return { ...res.data, ai_extraction_prompt: promptRes.data.value };
|
||||||
},
|
},
|
||||||
getAiPrompt: async () => {
|
getAiPrompt: async () => {
|
||||||
const res = await axiosInstance.get('/admin/db/settings/prompt');
|
const res = await axiosInstance.get('/admin/ai/settings/prompt');
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
updateAiPrompt: async (prompt: string) => {
|
updateAiPrompt: async (prompt: string) => {
|
||||||
const res = await axiosInstance.post('/admin/db/settings/prompt', { value: prompt });
|
const res = await axiosInstance.post('/admin/ai/settings/prompt', { value: prompt });
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
getAiConfig: async () => {
|
getAiConfig: async () => {
|
||||||
const res = await axiosInstance.get('/admin/db/settings/ai');
|
const res = await axiosInstance.get('/admin/ai/settings');
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
updateAiProvider: async (provider: string) => {
|
updateAiProvider: async (provider: string) => {
|
||||||
const res = await axiosInstance.post('/admin/db/settings/ai', { provider });
|
const res = await axiosInstance.post('/admin/ai/settings', { provider });
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
updateAiKeys: async (keys: { gemini_api_key?: string, claude_api_key?: string }) => {
|
updateAiKeys: async (keys: { gemini_api_key?: string, claude_api_key?: string }) => {
|
||||||
const res = await axiosInstance.post('/admin/db/settings/ai-keys', keys);
|
const res = await axiosInstance.post('/admin/ai/settings/keys', keys);
|
||||||
return res.data;
|
return res.data;
|
||||||
},
|
},
|
||||||
testAiKey: async (provider: string, key: string) => {
|
testAiKey: async (provider: string, key: string) => {
|
||||||
const res = await axiosInstance.post('/admin/db/settings/test-ai-key', { provider, key });
|
const res = await axiosInstance.post('/admin/ai/settings/test-key', { provider, key });
|
||||||
return res.data;
|
return res.data;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user