默认为流式输出

This commit is contained in:
zhonghua.li
2026-04-04 09:43:01 +08:00
parent 99a71cdc69
commit 99c087e8f4
3 changed files with 8 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@@ -468,7 +468,7 @@ const _sfc_main = {
},
sendByNormal(payload) {
const url = common_config.getApiUrl("/api/aiQaItem/askAI");
common_request.post(url, payload).then((res) => {
common_request.post(url, payload, { timeout: 12e4 }).then((res) => {
common_vendor.index.hideLoading();
const body = res && res.data ? res.data : null;
const success = body && body.success === true;
@@ -486,7 +486,7 @@ const _sfc_main = {
this.chatMessages.push({ role: "ai", text: this.normalizeText(rawAnswer) });
}).catch((err) => {
common_vendor.index.hideLoading();
common_vendor.index.__f__("error", "at pages-subpackage/ai_qa/general_qa/general_qa.vue:696", "[general_qa] askAI error:", err);
common_vendor.index.__f__("error", "at pages-subpackage/ai_qa/general_qa/general_qa.vue:697", "[general_qa] askAI error:", err);
this.chatMessages.push({ role: "ai", text: (err == null ? void 0 : err.errMsg) || "调用失败,请重试" });
}).finally(() => {
this.sending = false;
@@ -514,7 +514,7 @@ const _sfc_main = {
}
},
fail: (err) => {
common_vendor.index.__f__("error", "at pages-subpackage/ai_qa/general_qa/general_qa.vue:793", "[general_qa] askAIStream error:", err);
common_vendor.index.__f__("error", "at pages-subpackage/ai_qa/general_qa/general_qa.vue:794", "[general_qa] askAIStream error:", err);
const idx = this.streamAiMsgIndex;
if (idx >= 0 && this.chatMessages[idx]) {
const raw = String(this.chatMessages[idx].text || "").trim();
@@ -547,7 +547,7 @@ const _sfc_main = {
this.streamBuffer += chunk;
this.flushStreamBuffer(false);
} catch (e) {
common_vendor.index.__f__("error", "at pages-subpackage/ai_qa/general_qa/general_qa.vue:834", "[general_qa] stream chunk parse error:", e);
common_vendor.index.__f__("error", "at pages-subpackage/ai_qa/general_qa/general_qa.vue:835", "[general_qa] stream chunk parse error:", e);
}
});
} else {