diff --git a/.changeset/strange-lamps-live.md b/.changeset/strange-lamps-live.md new file mode 100644 index 0000000000..e311b69038 --- /dev/null +++ b/.changeset/strange-lamps-live.md @@ -0,0 +1,5 @@ +--- +"@scow/ai": patch +--- + +修复 AI 应用的工作目录和挂载点重复时报错 diff --git a/apps/ai/src/app/(auth)/jobs/[clusterId]/LaunchAppForm.tsx b/apps/ai/src/app/(auth)/jobs/[clusterId]/LaunchAppForm.tsx index 58a9569a1e..ea19affa7b 100644 --- a/apps/ai/src/app/(auth)/jobs/[clusterId]/LaunchAppForm.tsx +++ b/apps/ai/src/app/(auth)/jobs/[clusterId]/LaunchAppForm.tsx @@ -351,6 +351,13 @@ export const LaunchAppForm = (props: Props) => { name={["customFields", item.name]} rules={rules} initialValue={initialValue} + {...(item.name === "workingDir" ? { + tooltip: ( + <> + 工作目录的路径会自动添加为挂载点 + + ), + } : {})} > {inputItem} @@ -748,6 +755,12 @@ export const LaunchAppForm = (props: Props) => { if (otherMountPoints.includes(currentValueNormalized)) { return Promise.reject(new Error("挂载点地址不能重复")); } + + const workingDirectory = form.getFieldValue("customFields").workingDir?.toString(); + if (workingDirectory && workingDirectory.replace(/\/+$/, "") === currentValueNormalized) { + return Promise.reject(new Error("该路径已指定为工作目录,无需再设置为挂载点")); + } + return Promise.resolve(); }, }),