Skip to content

Commit 40e4412

Browse files
committed
fix: fix bug
1 parent c00ac3e commit 40e4412

File tree

1 file changed

+29
-25
lines changed
  • apps/miniprogram-agent-ui/miniprogram/components/agent-ui/chatFile

1 file changed

+29
-25
lines changed

apps/miniprogram-agent-ui/miniprogram/components/agent-ui/chatFile/index.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,36 @@ Component({
3434
success: async (res) => {
3535
const appBaseInfo = wx.getAppBaseInfo();
3636
const fileId = res.fileID;
37-
this.triggerEvent("changeChild", { tempId: this.data.fileData.tempId, status: "parsing" });
3837
console.log("当前版本", appBaseInfo.SDKVersion);
39-
commonRequest({
40-
path: `bots/${botId}/files`,
41-
data: {
42-
fileList: [
43-
{
44-
fileName: rawFileName || tempFileName,
45-
fileId,
46-
type: rawType,
47-
},
48-
],
49-
}, // any
50-
method: "POST",
51-
timeout: 60000,
52-
success: (res) => {
53-
console.log("resolve agent file res", res);
54-
this.triggerEvent("changeChild", { tempId: this.data.fileData.tempId, fileId, status: "parsed" });
55-
},
56-
fail: (e) => {
57-
console.log("e", e);
58-
this.triggerEvent("changeChild", { tempId: this.data.fileData.tempId, fileId, status: "parseFailed" });
59-
},
60-
complete: () => {},
61-
header: {},
62-
})
38+
if (botId.startsWith("ibot")) {
39+
this.triggerEvent("changeChild", { tempId: this.data.fileData.tempId, fileId, status: "parsed" });
40+
} else {
41+
this.triggerEvent("changeChild", { tempId: this.data.fileData.tempId, status: "parsing" });
42+
commonRequest({
43+
path: `bots/${botId}/files`,
44+
data: {
45+
fileList: [
46+
{
47+
fileName: rawFileName || tempFileName,
48+
fileId,
49+
type: rawType,
50+
},
51+
],
52+
}, // any
53+
method: "POST",
54+
timeout: 60000,
55+
success: (res) => {
56+
console.log("resolve agent file res", res);
57+
this.triggerEvent("changeChild", { tempId: this.data.fileData.tempId, fileId, status: "parsed" });
58+
},
59+
fail: (e) => {
60+
console.log("e", e);
61+
this.triggerEvent("changeChild", { tempId: this.data.fileData.tempId, fileId, status: "parseFailed" });
62+
},
63+
complete: () => {},
64+
header: {},
65+
});
66+
}
6367
},
6468
fail: (err) => {
6569
console.error("上传失败:", err);

0 commit comments

Comments
 (0)