|
|
@@ -7,7 +7,7 @@
|
|
|
* ({user.dir}/.agentscope/users/{用户ID}/skills),与案件无关,不落库
|
|
|
*/
|
|
|
import { defHttp } from '@/core/utils/http/axios';
|
|
|
-import { AI_ADMIN_PATH } from '../utils/constants';
|
|
|
+import { resolveApiUrl } from '../utils/constants';
|
|
|
import { aiHttp } from './http';
|
|
|
import type { AgentTool, SaveSkillParams, Skill, SkillDetail, SkillFileContent } from './types';
|
|
|
|
|
|
@@ -46,10 +46,14 @@ export function readSkillFile(name: string, path: string): Promise<SkillFileCont
|
|
|
* <p>走 `defHttp.uploadFile`:它负责把 FormData 的 content-type 设成 multipart,
|
|
|
* 直接传 FormData 会被实例默认的 form-urlencoded 头覆盖。`overwrite` 作为表单字段下发,
|
|
|
* 后端用 `@RequestParam` 接收(同名技能默认不覆盖,避免误删用户改过的技能)。
|
|
|
+ *
|
|
|
+ * <p>URL 必须用 {@link resolveApiUrl} 拼全路径:uploadFile 直接走 axiosInstance.request,
|
|
|
+ * 绕过了 beforeRequestHook,不会自动补 urlPrefix(/js),只传 /a/... 会打到
|
|
|
+ * {apiUrl}/a/**,被 Tomcat 按 context-path(/js/a) 之外的路由直接 404(知识库与附件上传同款写法)。
|
|
|
*/
|
|
|
export async function installSkillZip(file: File, overwrite = false): Promise<Skill> {
|
|
|
const res: any = await defHttp.uploadFile<Skill>(
|
|
|
- { url: `${AI_ADMIN_PATH}/capability/skills/install` },
|
|
|
+ { url: resolveApiUrl('/capability/skills/install') },
|
|
|
{ name: 'file', file, filename: file.name, ...(overwrite ? { overwrite: 'true' } : {}) },
|
|
|
);
|
|
|
// uploadFile 的返回类型标的是 AxiosResponse,实际经响应拦截器已按 isTransformResponse 拆包。
|