"use strict"; const common_vendor = require("../../common/vendor.js"); const _sfc_main = { data() { return { inputText: "", scrollTop: 0, msgList: [], windowHeight: common_vendor.index.getSystemInfoSync().windowHeight }; }, methods: { async sendQuestion() { var _a, _b, _c, _d, _e; if (!this.inputText.trim()) { common_vendor.index.showToast({ title: "请输入有效内容", icon: "none" }); return; } this.msgList.push({ role: "user", content: this.inputText, debug: "" }); const userInput = this.inputText; this.inputText = ""; this.scrollToBottom(); try { this.msgList.push({ role: "assistant", content: "思考中...", debug: "" }); this.scrollToBottom(); const startTime = Date.now(); const modelPath = "ft:LoRA/Qwen/Qwen2.5-72B-Instruct:23atw8mola:text:xaeoufvgbimowspuxirx-ckpt_step_12"; const res = await common_vendor.index.request({ url: "https://api.siliconflow.cn/v1/chat/completions", method: "POST", header: { "Content-Type": "application/json", "Authorization": "Bearer sk-rbbgeretfnwjpnmqyzutorjfwvzysnuykeowudkhuaeuokdm" }, data: { model: modelPath, messages: [{ role: "user", content: userInput }], temperature: 0.7, response_format: { type: "text" } } }); this.msgList.pop(); const debugInfo = [ `[请求耗时] ${Date.now() - startTime}ms`, `[响应状态码] ${res.statusCode}`, `[模型路径] ${modelPath}` ].join("\n"); if (res.statusCode === 200) { const answer = ((_d = (_c = (_b = (_a = res.data) == null ? void 0 : _a.choices) == null ? void 0 : _b[0]) == null ? void 0 : _c.message) == null ? void 0 : _d.content) || "接收到异常响应格式"; this.msgList.push({ role: "assistant", content: answer, debug: debugInfo }); } else { this.msgList.push({ role: "assistant", content: `请求失败:${((_e = res.data) == null ? void 0 : _e.message) || "未知错误"}`, debug: debugInfo }); } } catch (error) { this.msgList.pop(); this.msgList.push({ role: "assistant", content: `网络异常:${error.errMsg || error.message}`, debug: error.stack || error }); } this.scrollToBottom(); }, scrollToBottom() { this.$nextTick(() => { this.scrollTop = Math.random() * 1e6; }); } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return { a: common_vendor.f($data.msgList, (item, index, i0) => { return common_vendor.e({ a: item.role === "user" }, item.role === "user" ? { b: common_vendor.t(item.content) } : {}, { c: item.role === "assistant" }, item.role === "assistant" ? { d: common_vendor.t(item.content) } : {}, { e: index }); }), b: `${$data.windowHeight - 120}rpx`, c: $data.scrollTop, d: common_vendor.o((...args) => $options.sendQuestion && $options.sendQuestion(...args)), e: $data.inputText, f: common_vendor.o(($event) => $data.inputText = $event.detail.value), g: common_vendor.o((...args) => $options.sendQuestion && $options.sendQuestion(...args)) }; } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-c1c9ab6a"]]); my.createPage(MiniProgramPage);