上传代码

This commit is contained in:
2025-08-18 14:20:34 +08:00
commit 527fd07910
2408 changed files with 427370 additions and 0 deletions

View File

@ -0,0 +1,130 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场https://ext.dcloud.net.cn上很多三方插件均使用了这些样式变量
* 如果你是插件开发者建议你使用scss预处理并在插件代码中直接使用这些变量无需 import 这个文件方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者插件使用者你可以通过修改这些变量来定制自己的插件主题实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.chat.data-v-c1c9ab6a {
height: 100vh;
display: flex;
flex-direction: column;
}
.chat .scroll-view.data-v-c1c9ab6a {
flex: 1;
background-color: #F6F6F6;
}
.chat .scroll-view .chat-body.data-v-c1c9ab6a {
padding: 20rpx;
}
.chat .scroll-view .chat-body .item.data-v-c1c9ab6a {
display: flex;
margin: 20rpx 0;
}
.chat .scroll-view .chat-body .item.self.data-v-c1c9ab6a {
justify-content: flex-end;
}
.chat .scroll-view .chat-body .item.self .content.data-v-c1c9ab6a {
background-color: #4095e5;
color: white;
}
.chat .scroll-view .chat-body .item.self .content.data-v-c1c9ab6a::after {
border-left-color: #4095e5 !important;
}
.chat .scroll-view .chat-body .item .avatar.data-v-c1c9ab6a {
width: 80rpx;
height: 80rpx;
border-radius: 8rpx;
background: #ddd url("https://pic2.zhimg.com/v2-45e3ca228438d1e4c3e98e38c8f8e4a4_r.jpg?source=1940ef5c") center/cover;
}
.chat .scroll-view .chat-body .item .avatarAI.data-v-c1c9ab6a {
width: 80rpx;
height: 80rpx;
border-radius: 8rpx;
background: #ddd url("https://www.weilanai.com/wp-content/uploads/2023/05/eee.png") center/cover;
}
.chat .scroll-view .chat-body .item .content.data-v-c1c9ab6a {
max-width: 70%;
padding: 20rpx;
border-radius: 10rpx;
position: relative;
margin: 0 20rpx;
word-break: break-word;
}
.chat .scroll-view .chat-body .item .content.data-v-c1c9ab6a::after {
content: "";
position: absolute;
top: 20rpx;
width: 0;
height: 0;
border: 12rpx solid transparent;
}
.chat .scroll-view .chat-body .item .content.left.data-v-c1c9ab6a {
background: white;
}
.chat .scroll-view .chat-body .item .content.left.data-v-c1c9ab6a::after {
left: -24rpx;
border-right-color: white;
}
.chat .scroll-view .chat-body .item .content.right.data-v-c1c9ab6a {
background: #4095e5;
color: white;
}
.chat .scroll-view .chat-body .item .content.right.data-v-c1c9ab6a::after {
right: -24rpx;
border-left-color: #4095e5;
}
.chat .scroll-view .chat-body .item .content .debug-info.data-v-c1c9ab6a {
margin-top: 20rpx;
padding: 10rpx;
background: #f0f0f0;
border-radius: 8rpx;
font-size: 24rpx;
color: #666;
white-space: pre-wrap;
}
.chat .chat-bottom.data-v-c1c9ab6a {
padding: 20rpx;
background: #EDEDED;
border-top: 1rpx solid #ddd;
}
.chat .chat-bottom .send-msg.data-v-c1c9ab6a {
display: flex;
align-items: center;
gap: 20rpx;
}
.chat .chat-bottom .send-msg textarea.data-v-c1c9ab6a {
flex: 1;
min-height: 80rpx;
max-height: 200rpx;
padding: 16rpx;
background: white;
border-radius: 8rpx;
font-size: 28rpx;
}
.chat .chat-bottom .send-msg .send-btn.data-v-c1c9ab6a {
width: 120rpx;
height: 80rpx;
line-height: 80rpx;
background: #4095e5;
color: white;
border-radius: 8rpx;
}

View File

@ -0,0 +1 @@
<view class="chat data-v-c1c9ab6a"><scroll-view style="{{'height:' + b}}" scroll-y="true" scroll-top="{{c}}" class="scroll-view data-v-c1c9ab6a"><view class="chat-body data-v-c1c9ab6a"><view a:for="{{a}}" a:for-item="item" a:key="e" class="data-v-c1c9ab6a"><view a:if="{{item.a}}" class="item self data-v-c1c9ab6a"><view class="content right data-v-c1c9ab6a">{{item.b}}</view><view class="avatar data-v-c1c9ab6a"></view></view><view a:if="{{item.c}}" class="item Ai data-v-c1c9ab6a"><view class="avatarAI data-v-c1c9ab6a"></view><view class="content left data-v-c1c9ab6a">{{item.d}}</view></view></view></view></scroll-view><view class="chat-bottom data-v-c1c9ab6a"><view class="send-msg data-v-c1c9ab6a"><textarea class="data-v-c1c9ab6a" placeholder="请输入您的问题" maxlength="300" show-confirm-bar="{{false}}" auto-height onConfirm="{{d}}" value="{{e}}" onInput="{{f}}"></textarea><button onTap="{{g}}" class="send-btn data-v-c1c9ab6a">发送</button></view></view></view>

View File

@ -0,0 +1,114 @@
"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);

View File

@ -0,0 +1,4 @@
{
"defaultTitle": "DeepSeek",
"usingComponents": {}
}