优化消息渲染中的上传文件。不过滤表单工具yxd_tool_name": "sendFrom",气泡渲染表单工具。
This commit is contained in:
@@ -755,6 +755,94 @@
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
/* sendFrom 工具表单卡片 */
|
||||
.chat-content-assistant .tool-form-card {
|
||||
margin: -8rpx -12rpx;
|
||||
}
|
||||
|
||||
.tool-form-card {
|
||||
background: #f8f9fc;
|
||||
border-radius: 20rpx;
|
||||
padding: 32rpx 24rpx;
|
||||
border: 1rpx solid #e8ecf2;
|
||||
}
|
||||
|
||||
.tool-form-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.tool-form-desc {
|
||||
font-size: 28rpx;
|
||||
color: #909399;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.tool-form-fields {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.tool-form-text {
|
||||
font-size: 28rpx;
|
||||
color: #606266;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.tool-form-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.tool-form-label {
|
||||
font-size: 28rpx;
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tool-form-input {
|
||||
font-size: 28rpx;
|
||||
color: #303133;
|
||||
padding: 40rpx 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
border: 1rpx solid #e4e7ed;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tool-form-textarea {
|
||||
font-size: 28rpx;
|
||||
color: #303133;
|
||||
padding: 18rpx 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
border: 1rpx solid #e4e7ed;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
min-height: 100rpx;
|
||||
}
|
||||
|
||||
.tool-form-submit {
|
||||
margin-top: 24rpx;
|
||||
padding: 18rpx 0;
|
||||
text-align: center;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 14rpx;
|
||||
}
|
||||
|
||||
.tool-form-submitted {
|
||||
background: #c0c4cc;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
||||
/* ==========聊天输入容器部分========== */
|
||||
.chat-interactive-container {
|
||||
|
||||
@@ -140,8 +140,8 @@
|
||||
</view>
|
||||
<!-- 与AI的对话内容展示 -->
|
||||
<template v-for="(message, index) in currentMessages" :key="index">
|
||||
<view v-if="ChatType === 0 && message.role !== 'tool'" class="chat-message" :id="'msg-' + index"
|
||||
:class="{'message-user':message.role==='user'}">
|
||||
<view v-if="ChatType === 0 && (message.role !== 'tool' || message.yxd_tool_name === 'sendFrom')" class="chat-message" :id="'msg-' + index"
|
||||
:class="{'message-user':message.role==='user'}">
|
||||
<!-- <view class="chat-avatar" :class="{'chat-avatar-user':message.role==='user'}">
|
||||
<image v-if="message.role === 'user' && UserData?.avatar" :src="UserData.avatar"
|
||||
class="friend-avatar" mode="aspectFill"></image>
|
||||
@@ -156,39 +156,82 @@
|
||||
<!-- <view v-if="message.role ==='assistant'" class="iconfont icon-Robot"></view> -->
|
||||
<!-- <view v-if="message.role ==='user'" class="iconfont icon-yonghuziliao"></view> -->
|
||||
</view>
|
||||
<view class="chat-content"
|
||||
:class="{'chat-content-user':message.role==='user', 'chat-content-assistant':message.role==='assistant'}"
|
||||
@click="handleChatContentClick($event, message)"
|
||||
v-if="(message.content && String(message.content).trim() !== '') || message._streaming">
|
||||
<!-- 流式加载中:显示跳动的点 -->
|
||||
<view
|
||||
v-if="message._streaming && (!message.content || String(message.content).trim() === '')"
|
||||
class="bubble-loading-dots">
|
||||
<view class="bubble-dot"></view>
|
||||
<view class="bubble-dot"></view>
|
||||
<view class="bubble-dot"></view>
|
||||
</view>
|
||||
<!-- 文本内容 -->
|
||||
<view v-if="parseFileInfo(message.content).textContent"
|
||||
v-html="pareseMarkdown(parseFileInfo(message.content).textContent)"></view>
|
||||
<!-- 文件卡片列表 -->
|
||||
<view v-if="parseFileInfo(message.content).files.length > 0" class="message-file-list">
|
||||
<view v-for="(file, idx) in parseFileInfo(message.content).files" :key="idx"
|
||||
class="file-item">
|
||||
<!-- 图片:jpg/png/gif/webp 等 -->
|
||||
<image
|
||||
v-if="['jpg','jpeg','png','gif','webp','bmp'].includes(file.extendName.toLowerCase())"
|
||||
:src="file.url" mode="widthFix" class="message-image"
|
||||
@click="previewImage(file.url)"></image>
|
||||
<!-- 普通文件:doc/xlsx/zip/pdf 等 -->
|
||||
<view v-else class="message-file" @click="openFile(file.url)">
|
||||
<view class="file-icon">📄</view>
|
||||
<view class="file-name">{{ file.name }}</view>
|
||||
<view class="file-size">{{ formatFileSize(file.fileSize) }}</view>
|
||||
</view>
|
||||
<view class="chat-content"
|
||||
:class="{'chat-content-user':message.role==='user', 'chat-content-assistant':message.role==='assistant' || message.role==='tool'}"
|
||||
@click="handleChatContentClick($event, message)"
|
||||
v-if="(message.content && String(message.content).trim() !== '') || message._streaming || (message.yxd_files && message.yxd_files.length > 0) || (message.role === 'tool' && message.yxd_tool_name === 'sendFrom')">
|
||||
<!-- 流式加载中:显示跳动的点 -->
|
||||
<view
|
||||
v-if="message._streaming && (!message.content || String(message.content).trim() === '')"
|
||||
class="bubble-loading-dots">
|
||||
<view class="bubble-dot"></view>
|
||||
<view class="bubble-dot"></view>
|
||||
<view class="bubble-dot"></view>
|
||||
</view>
|
||||
<!-- 文本内容(非 tool 消息) -->
|
||||
<view v-if="message.role !== 'tool' && parseFileInfo(message.content).textContent"
|
||||
v-html="pareseMarkdown(parseFileInfo(message.content).textContent)"></view>
|
||||
<!-- 文件卡片列表(非 tool 消息) -->
|
||||
<view v-if="message.role !== 'tool' && parseFileInfo(message.content).files.length > 0" class="message-file-list">
|
||||
<view v-for="(file, idx) in parseFileInfo(message.content).files" :key="idx"
|
||||
class="file-item">
|
||||
<!-- 图片:jpg/png/gif/webp 等 -->
|
||||
<image
|
||||
v-if="['jpg','jpeg','png','gif','webp','bmp'].includes(file.extendName.toLowerCase())"
|
||||
:src="file.url" mode="widthFix" class="message-image"
|
||||
@click="previewImage(file.url)"></image>
|
||||
<!-- 普通文件:doc/xlsx/zip/pdf 等 -->
|
||||
<view v-else class="message-file" @click="openFile(file.url)">
|
||||
<view class="file-icon">📄</view>
|
||||
<view class="file-name">{{ file.name }}</view>
|
||||
<view class="file-size">{{ formatFileSize(file.fileSize) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 用户上传文件列表(yxd_files,消息 content 为空时展示) -->
|
||||
<view v-if="message.role === 'user' && message.yxd_files && message.yxd_files.length > 0" class="message-file-list">
|
||||
<view v-for="(fileName, idx) in message.yxd_files" :key="idx" class="file-item">
|
||||
<view class="message-file">
|
||||
<view class="file-icon">📄</view>
|
||||
<view class="file-name">{{ fileName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- sendFrom 工具消息:可交互表单 -->
|
||||
<template v-if="message.role === 'tool' && message.yxd_tool_name === 'sendFrom'">
|
||||
<view v-if="getToolFormData(message)" class="tool-form-card">
|
||||
<view class="tool-form-title">📋 {{ getToolFormData(message).title || '表单' }}</view>
|
||||
<view v-if="getToolFormData(message).description" class="tool-form-desc">{{ getToolFormData(message).description }}</view>
|
||||
<view class="tool-form-fields">
|
||||
<template v-for="(comp, ci) in getToolFormData(message).components" :key="ci">
|
||||
<!-- 纯文本 -->
|
||||
<view v-if="comp.type === 'text'" class="tool-form-text">{{ comp.content }}</view>
|
||||
<!-- 多行输入 -->
|
||||
<view v-else-if="comp.type === 'textarea'" class="tool-form-field">
|
||||
<view class="tool-form-label">{{ comp.label }}<text v-if="comp.required" style="color:#e74c3c"> *</text></view>
|
||||
<textarea class="tool-form-textarea" :placeholder="comp.placeholder || ''"
|
||||
:disabled="getToolFormData(message)._disabled || (toolFormValues[getToolFormData(message).formId] || {})._submitted"
|
||||
:value="(toolFormValues[getToolFormData(message).formId] || {})[comp.name] || ''"
|
||||
@input="e => { const f = ensureToolForm(getToolFormData(message)); f[comp.name] = e.detail.value }"
|
||||
auto-height />
|
||||
</view>
|
||||
<!-- 单行输入(默认) -->
|
||||
<view v-else class="tool-form-field">
|
||||
<view class="tool-form-label">{{ comp.label }}<text v-if="comp.required" style="color:#e74c3c"> *</text></view>
|
||||
<input class="tool-form-input" :placeholder="comp.placeholder || ''"
|
||||
:disabled="(toolFormValues[getToolFormData(message).formId] || {})._submitted"
|
||||
:value="(toolFormValues[getToolFormData(message).formId] || {})[comp.name] || ''"
|
||||
@input="e => { const f = ensureToolForm(getToolFormData(message)); f[comp.name] = e.detail.value }" />
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<view class="tool-form-submit" :class="{ 'tool-form-submitted': (toolFormValues[getToolFormData(message).formId] || {})._submitted }"
|
||||
@click="submitToolForm(getToolFormData(message))">
|
||||
{{ (toolFormValues[getToolFormData(message).formId] || {})._submitted ? '已提交' : (getToolFormData(message).submitText || '提交') }}
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 与好友的对话内容展示 -->
|
||||
@@ -349,6 +392,7 @@
|
||||
getCurrentInstance,
|
||||
nextTick,
|
||||
onMounted,
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
@@ -691,6 +735,49 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener.
|
||||
}
|
||||
}
|
||||
|
||||
// 解析 sendFrom 工具消息的 JSON content,返回原始对象供模板使用
|
||||
const getToolFormData = (message) => {
|
||||
if (!message || !message.content) return null
|
||||
try {
|
||||
const data = typeof message.content === 'string' ? JSON.parse(message.content) : message.content
|
||||
if (!data || (!data.type && !data.components)) return null
|
||||
return data
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化表单值(惰性初始化,首次访问时创建)
|
||||
const ensureToolForm = (formData) => {
|
||||
if (!formData || !formData.formId) return {}
|
||||
if (!toolFormValues[formData.formId]) {
|
||||
const fields = { _submitted: false }
|
||||
;(formData.components || []).forEach(c => {
|
||||
if (c.name) fields[c.name] = ''
|
||||
})
|
||||
toolFormValues[formData.formId] = reactive(fields)
|
||||
}
|
||||
return toolFormValues[formData.formId]
|
||||
}
|
||||
|
||||
// 提交工具表单
|
||||
const submitToolForm = (formData) => {
|
||||
if (!formData || !formData.formId) return
|
||||
const values = toolFormValues[formData.formId]
|
||||
if (!values) return
|
||||
// 检查必填项
|
||||
const missing = (formData.components || [])
|
||||
.filter(c => c.required && c.name && !values[c.name])
|
||||
.map(c => c.label)
|
||||
if (missing.length > 0) {
|
||||
uni.showToast({ title: `请填写:${missing.join('、')}`, icon: 'none' })
|
||||
return
|
||||
}
|
||||
values._submitted = true
|
||||
console.log('表单提交:', formData.formId, { ...values, _submitted: undefined })
|
||||
uni.showToast({ title: '提交成功', icon: 'success' })
|
||||
// TODO: 调用 API 提交表单数据
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1688,6 +1775,8 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener.
|
||||
const scrollToView = ref('')
|
||||
const bottomToggle = ref(false)
|
||||
const scrollAnimationEnabled = ref(true) // 控制 scroll-with-animation,加载更多时关闭避免可见滑动
|
||||
// 工具表单交互状态:key 为 formId,value 为 { fieldName: value, _submitted: bool }
|
||||
const toolFormValues = reactive({})
|
||||
// 加载状态和分页相关变量
|
||||
const isLoadingMore = ref(false) // 是否正在加载更多
|
||||
const isAILoadingMore = ref(false) // AI 会话是否正在加载更多(滚动到顶部触发)
|
||||
|
||||
286
unpackage/dist/dev/app-plus/app-service.js
vendored
286
unpackage/dist/dev/app-plus/app-service.js
vendored
@@ -154,7 +154,7 @@ if (uni.restoreGlobal) {
|
||||
uni.setStorageSync("workspace_id", messagesInfo.workspace_id);
|
||||
}
|
||||
const filtered = (messagesInfo.messages || []).filter(
|
||||
(m) => m.role !== "tool"
|
||||
(m) => m.role !== "tool" || m.yxd_tool_name === "sendFrom"
|
||||
);
|
||||
resolve(filtered);
|
||||
} else {
|
||||
@@ -5811,7 +5811,7 @@ This will fail in production.`);
|
||||
if (friendSocketStore.isConnected)
|
||||
return;
|
||||
if (!userToken.value || !UserId.value) {
|
||||
formatAppLog("warn", "at pages/Chat/Chat.vue:409", "Token或UserId未准备好");
|
||||
formatAppLog("warn", "at pages/Chat/Chat.vue:453", "Token或UserId未准备好");
|
||||
return;
|
||||
}
|
||||
friendSocketStore.connect({
|
||||
@@ -6008,7 +6008,7 @@ This will fail in production.`);
|
||||
});
|
||||
return html;
|
||||
} catch (e2) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:617", "解析失败", e2);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:661", "解析失败", e2);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
@@ -6059,13 +6059,53 @@ This will fail in production.`);
|
||||
files
|
||||
};
|
||||
} catch (e2) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:686", "解析文件信息失败:", e2);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:730", "解析文件信息失败:", e2);
|
||||
return {
|
||||
textContent: content,
|
||||
files: []
|
||||
};
|
||||
}
|
||||
};
|
||||
const getToolFormData = (message) => {
|
||||
if (!message || !message.content)
|
||||
return null;
|
||||
try {
|
||||
const data = typeof message.content === "string" ? JSON.parse(message.content) : message.content;
|
||||
if (!data || !data.type && !data.components)
|
||||
return null;
|
||||
return data;
|
||||
} catch (e2) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
const ensureToolForm = (formData) => {
|
||||
if (!formData || !formData.formId)
|
||||
return {};
|
||||
if (!toolFormValues[formData.formId]) {
|
||||
const fields = { _submitted: false };
|
||||
(formData.components || []).forEach((c) => {
|
||||
if (c.name)
|
||||
fields[c.name] = "";
|
||||
});
|
||||
toolFormValues[formData.formId] = vue.reactive(fields);
|
||||
}
|
||||
return toolFormValues[formData.formId];
|
||||
};
|
||||
const submitToolForm = (formData) => {
|
||||
if (!formData || !formData.formId)
|
||||
return;
|
||||
const values = toolFormValues[formData.formId];
|
||||
if (!values)
|
||||
return;
|
||||
const missing = (formData.components || []).filter((c) => c.required && c.name && !values[c.name]).map((c) => c.label);
|
||||
if (missing.length > 0) {
|
||||
uni.showToast({ title: `请填写:${missing.join("、")}`, icon: "none" });
|
||||
return;
|
||||
}
|
||||
values._submitted = true;
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:777", "表单提交:", formData.formId, { ...values, _submitted: void 0 });
|
||||
uni.showToast({ title: "提交成功", icon: "success" });
|
||||
};
|
||||
const selectNormalChat = async () => {
|
||||
try {
|
||||
const chars = "0123456789abcdef";
|
||||
@@ -6099,7 +6139,7 @@ This will fail in production.`);
|
||||
currentSessionId.value = conversationId;
|
||||
uni.setStorageSync("currentSessionId", conversationId);
|
||||
} catch (error) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:735", "新建普通会话失败:", error);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:822", "新建普通会话失败:", error);
|
||||
uni.showToast({
|
||||
title: "创建会话失败,请重试",
|
||||
icon: "none"
|
||||
@@ -6126,7 +6166,7 @@ This will fail in production.`);
|
||||
uni.showToast({ title: "获取智能体列表失败", icon: "none" });
|
||||
}
|
||||
} catch (error) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:767", "获取智能体列表失败:", error);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:854", "获取智能体列表失败:", error);
|
||||
uni.showToast({ title: "获取智能体列表失败,请重试", icon: "none" });
|
||||
} finally {
|
||||
agentLoading.value = false;
|
||||
@@ -6153,7 +6193,7 @@ This will fail in production.`);
|
||||
uni.showToast({ title: `已创建「${result.title || agent.title}」会话`, icon: "success" });
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:798", "创建智能体会话失败:", error);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:885", "创建智能体会话失败:", error);
|
||||
uni.showToast({ title: typeof error === "string" ? error : "创建失败,请重试", icon: "none" });
|
||||
}
|
||||
};
|
||||
@@ -6242,7 +6282,7 @@ This will fail in production.`);
|
||||
};
|
||||
const previewFileArray = vue.ref([]);
|
||||
const uploadPhoto = () => {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:915", "点击了拍照上传");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1002", "点击了拍照上传");
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sourceType: ["camera", "album"],
|
||||
@@ -6265,7 +6305,7 @@ This will fail in production.`);
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:933", "选择图片失败", err);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1020", "选择图片失败", err);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -6274,12 +6314,12 @@ This will fail in production.`);
|
||||
};
|
||||
const fileList = vue.ref([]);
|
||||
const uploadFile = () => {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:944", "点击了上传文件");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1031", "点击了上传文件");
|
||||
chooseFile({
|
||||
count: 5,
|
||||
type: "all",
|
||||
success: (res) => {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:949", "成功了");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1036", "成功了");
|
||||
fileList.value = res.tempFiles;
|
||||
previewFileArray.value.push(...res.tempFiles);
|
||||
uni.showToast({
|
||||
@@ -6288,7 +6328,7 @@ This will fail in production.`);
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:960", "选择失败:", err);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1047", "选择失败:", err);
|
||||
uni.showToast({
|
||||
title: "选择失败",
|
||||
icon: "error"
|
||||
@@ -6527,7 +6567,7 @@ This will fail in production.`);
|
||||
previewFileArray.value = [];
|
||||
} catch (err) {
|
||||
uni.hideLoading();
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1235", "文件上传失败:", err);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1322", "文件上传失败:", err);
|
||||
uni.showToast({
|
||||
title: "文件上传失败,请重试",
|
||||
icon: "error"
|
||||
@@ -6661,15 +6701,15 @@ This will fail in production.`);
|
||||
}
|
||||
};
|
||||
const stopConversation = async () => {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1405", "中断对话 - 当前会话ID:", currentSessionId.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1492", "中断对话 - 当前会话ID:", currentSessionId.value);
|
||||
try {
|
||||
await socketStore.send({
|
||||
type: "stop",
|
||||
conversation_id: currentSessionId.value
|
||||
});
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1411", "中断指令已发送成功");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1498", "中断指令已发送成功");
|
||||
} catch (err) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1413", "中断指令发送失败:", err);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1500", "中断指令发送失败:", err);
|
||||
}
|
||||
if (streamingMessageId.value) {
|
||||
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
|
||||
@@ -6688,9 +6728,9 @@ This will fail in production.`);
|
||||
});
|
||||
};
|
||||
vue.watch(() => socketStore.isThinking, async (newVal, oldVal) => {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1438", "isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1525", "isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString);
|
||||
if (!oldVal && newVal) {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1441", "AI开始回复(跨设备同步),锁定输入框");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1528", "AI开始回复(跨设备同步),锁定输入框");
|
||||
isThinking.value = true;
|
||||
if (!isSelfSent.value) {
|
||||
await takeConversationMessages();
|
||||
@@ -6707,7 +6747,7 @@ This will fail in production.`);
|
||||
return;
|
||||
}
|
||||
if (oldVal && !newVal) {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1460", "AI回复结束(正常/中断),解锁并刷新消息列表");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1547", "AI回复结束(正常/中断),解锁并刷新消息列表");
|
||||
await takeConversationMessages();
|
||||
if (streamingMessageId.value) {
|
||||
allmessages.value = allmessages.value.filter((m) => m._id !== streamingMessageId.value);
|
||||
@@ -6778,15 +6818,15 @@ This will fail in production.`);
|
||||
UserData.value = await getUserInfo(userToken.value);
|
||||
UserId.value = UserData.value._id;
|
||||
UserAvatar.value = UserData.value.avatar || "";
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1547", "用户信息已加载:", UserId.value, UserAvatar.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1634", "用户信息已加载:", UserId.value, UserAvatar.value);
|
||||
} catch (error) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1549", "获取用户信息失败:", error);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1636", "获取用户信息失败:", error);
|
||||
}
|
||||
};
|
||||
const takeUserConversations = async () => {
|
||||
try {
|
||||
userToken.value = getToken();
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1557", "token:", userToken.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1644", "token:", userToken.value);
|
||||
UserConversations.value = await getUserConversations(userToken.value) || [];
|
||||
const savedSessionId = getCurrentSessionId();
|
||||
if (savedSessionId && UserConversations.value.some((c) => c._id === savedSessionId)) {
|
||||
@@ -6796,7 +6836,7 @@ This will fail in production.`);
|
||||
} else {
|
||||
currentSessionId.value = "";
|
||||
}
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1569", "保存会话id:", currentSessionId.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1656", "保存会话id:", currentSessionId.value);
|
||||
uni.setStorageSync("currentSessionId", currentSessionId.value);
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
@@ -6808,17 +6848,17 @@ This will fail in production.`);
|
||||
const FriendInfoList = vue.ref([]);
|
||||
const takeFriendList = async () => {
|
||||
try {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1584", "开始获取好友列表");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1671", "开始获取好友列表");
|
||||
const friendList = await getChatFriend(UserId.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1587", "friendList:", friendList);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1674", "friendList:", friendList);
|
||||
if (friendList && friendList.length) {
|
||||
FriendInfoList.value = await takeUserAvatar(friendList);
|
||||
} else {
|
||||
FriendInfoList.value = [];
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1592", "好友列表为空");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1679", "好友列表为空");
|
||||
}
|
||||
} catch (error) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1595", "获取好友列表失败:", error);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1682", "获取好友列表失败:", error);
|
||||
FriendInfoList.value = [];
|
||||
} finally {
|
||||
UserConversations.value = FriendInfoList.value;
|
||||
@@ -6845,17 +6885,17 @@ This will fail in production.`);
|
||||
};
|
||||
});
|
||||
} catch (err) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1625", "获取好友头像失败", err);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1712", "获取好友头像失败", err);
|
||||
return friendList;
|
||||
}
|
||||
};
|
||||
const GroupList = vue.ref([]);
|
||||
const takeGroupList = async () => {
|
||||
try {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1635", "开始获取群聊列表");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1722", "开始获取群聊列表");
|
||||
GroupList.value = await getGroup(UserId.value);
|
||||
} catch (error) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1640", "获取群聊列表失败:", error);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1727", "获取群聊列表失败:", error);
|
||||
GroupList.value = [];
|
||||
} finally {
|
||||
UserConversations.value = GroupList.value;
|
||||
@@ -6867,22 +6907,22 @@ This will fail in production.`);
|
||||
return [];
|
||||
try {
|
||||
const memberIds = memberList.map((item) => item.groupContactId);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1654", "请求头像的ID列表:", memberIds);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1741", "请求头像的ID列表:", memberIds);
|
||||
const memberAvatarList = await getUserAvatar(userToken.value, memberIds);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1656", "头像接口返回数据:", memberAvatarList);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1743", "头像接口返回数据:", memberAvatarList);
|
||||
const userMap = new Map(memberAvatarList.map((user) => [user.user_id, user]) || []);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1659", "userMap的keys:", Array.from(userMap.keys()));
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1746", "userMap的keys:", Array.from(userMap.keys()));
|
||||
return memberList.map((member) => {
|
||||
const memberId = member.groupContactId;
|
||||
const userInfo = userMap.get(memberId);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1664", `查找 ${memberId} 的头像:`, userInfo);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1751", `查找 ${memberId} 的头像:`, userInfo);
|
||||
return {
|
||||
...member,
|
||||
avatar: (userInfo == null ? void 0 : userInfo.avatar) || null
|
||||
};
|
||||
});
|
||||
} catch (err) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1671", "获取群成员头像失败", err);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1758", "获取群成员头像失败", err);
|
||||
return memberList;
|
||||
}
|
||||
};
|
||||
@@ -6896,6 +6936,7 @@ This will fail in production.`);
|
||||
const scrollToView = vue.ref("");
|
||||
const bottomToggle = vue.ref(false);
|
||||
const scrollAnimationEnabled = vue.ref(true);
|
||||
const toolFormValues = vue.reactive({});
|
||||
const isLoadingMore = vue.ref(false);
|
||||
const isAILoadingMore = vue.ref(false);
|
||||
const aiPageNumber = vue.ref(0);
|
||||
@@ -6948,12 +6989,12 @@ This will fail in production.`);
|
||||
hasMoreGroupMessages.value = true;
|
||||
const rawMessages = await getGroupMessages(currentSessionId.value, pageSize$1, 0) || [];
|
||||
allmessages.value = rawMessages;
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1761", "群聊消息:", allmessages.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1850", "群聊消息:", allmessages.value);
|
||||
const memberList = await getGroupMemberList(currentSessionId.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1764", "获取到的群成员列表:", memberList);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1853", "获取到的群成员列表:", memberList);
|
||||
if (memberList && memberList.length) {
|
||||
groupMemberList.value = await takeGroupMemberAvatar(memberList);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1767", "群成员列表(带头像):", groupMemberList.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1856", "群成员列表(带头像):", groupMemberList.value);
|
||||
} else {
|
||||
groupMemberList.value = [];
|
||||
}
|
||||
@@ -6995,7 +7036,7 @@ This will fail in production.`);
|
||||
hasMoreAIMessages.value = false;
|
||||
}
|
||||
} catch (e2) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1832", "加载更多消息失败:", e2);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1921", "加载更多消息失败:", e2);
|
||||
uni.showToast({ title: "加载更多失败", icon: "none" });
|
||||
} finally {
|
||||
isAILoadingMore.value = false;
|
||||
@@ -7020,7 +7061,7 @@ This will fail in production.`);
|
||||
hasMoreFriendMessages.value = false;
|
||||
}
|
||||
} catch (e2) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1860", "加载更多好友消息失败:", e2);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1949", "加载更多好友消息失败:", e2);
|
||||
uni.showToast({ title: "加载更多失败", icon: "none" });
|
||||
} finally {
|
||||
isFriendLoadingMore.value = false;
|
||||
@@ -7045,7 +7086,7 @@ This will fail in production.`);
|
||||
hasMoreGroupMessages.value = false;
|
||||
}
|
||||
} catch (e2) {
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1888", "加载更多群聊消息失败:", e2);
|
||||
formatAppLog("error", "at pages/Chat/Chat.vue:1977", "加载更多群聊消息失败:", e2);
|
||||
uni.showToast({ title: "加载更多失败", icon: "none" });
|
||||
} finally {
|
||||
isGroupLoadingMore.value = false;
|
||||
@@ -7061,9 +7102,9 @@ This will fail in production.`);
|
||||
}
|
||||
};
|
||||
vue.watch(() => friendSocketStore.MessageReceived, (newId) => {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1909", "收到了好友消息");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1998", "收到了好友消息");
|
||||
if (newId) {
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1911", "ChatType:", ChatType.value);
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:2000", "ChatType:", ChatType.value);
|
||||
switch (ChatType.value) {
|
||||
case 0:
|
||||
takeConversationMessages();
|
||||
@@ -7078,7 +7119,7 @@ This will fail in production.`);
|
||||
friendSocketStore.MessageReceived = false;
|
||||
break;
|
||||
default:
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:1927", "default 分支");
|
||||
formatAppLog("log", "at pages/Chat/Chat.vue:2016", "default 分支");
|
||||
friendSocketStore.MessageReceived = false;
|
||||
break;
|
||||
}
|
||||
@@ -7168,11 +7209,11 @@ This will fail in production.`);
|
||||
onUnload(() => {
|
||||
socketStore.disconnect();
|
||||
});
|
||||
const __returned__ = { friendSocketStore, handleFriendConnect, socketStore, ChatType, wyxdWorkspaceId, wyxdFilePath, wyxdFileName, wyxdUserToken, hasWyxdFile, convertMarkdownTable, renderTable, escapeLoneUnderscores, isDownloadLink, renderDownloadBtn, supportedExtensions, extPattern, pareseMarkdown, sanitizeContent, previewImage, openFile: openFile$1, formatFileSize: formatFileSize2, parseFileInfo, selectNormalChat, showNewChatModal, closeNewChatModal, showAgentModal, agentList, agentLoading, selectAgentChat, closeAgentModal, handleAgentSelect, isChatSidebar, handleChatSidebar, goWorkSpace, goWyxdViewer, goCloudDatabase, logOut, handleRefresh, previewFileArray, uploadPhoto, deleteImage, fileList, uploadFile, handleConnect, isThinking, isSelfSent, isUploading, isLoadingMessages, uploadedFiles, streamingMessageId, showMessageModal, detailLinks, handleChatContentClick, extractLinks, extractFileNameFromUrl, getFileTypeInfo, showMessageDetail, closeMessageDetail, downloadToast, get downloadToastTimer() {
|
||||
const __returned__ = { friendSocketStore, handleFriendConnect, socketStore, ChatType, wyxdWorkspaceId, wyxdFilePath, wyxdFileName, wyxdUserToken, hasWyxdFile, convertMarkdownTable, renderTable, escapeLoneUnderscores, isDownloadLink, renderDownloadBtn, supportedExtensions, extPattern, pareseMarkdown, sanitizeContent, previewImage, openFile: openFile$1, formatFileSize: formatFileSize2, parseFileInfo, getToolFormData, ensureToolForm, submitToolForm, selectNormalChat, showNewChatModal, closeNewChatModal, showAgentModal, agentList, agentLoading, selectAgentChat, closeAgentModal, handleAgentSelect, isChatSidebar, handleChatSidebar, goWorkSpace, goWyxdViewer, goCloudDatabase, logOut, handleRefresh, previewFileArray, uploadPhoto, deleteImage, fileList, uploadFile, handleConnect, isThinking, isSelfSent, isUploading, isLoadingMessages, uploadedFiles, streamingMessageId, showMessageModal, detailLinks, handleChatContentClick, extractLinks, extractFileNameFromUrl, getFileTypeInfo, showMessageDetail, closeMessageDetail, downloadToast, get downloadToastTimer() {
|
||||
return downloadToastTimer;
|
||||
}, set downloadToastTimer(v) {
|
||||
downloadToastTimer = v;
|
||||
}, showDownloadToast, hideDownloadToast, openLink, downloadAndHandle, sendMessage, sendFriendMessage, sendGroupMessage, sendAIMessage, stopConversation, textMessage, UserConversations, currentSessionId, userToken, UserId, UserAvatar, UserData, takeUserInfo, takeUserConversations, FriendInfoList, takeFriendList, takeTalkUserAvatar, takeUserAvatar, GroupList, takeGroupList, groupMemberList, takeGroupMemberAvatar, getGroupMemberAvatarById, allmessages, scrollToView, bottomToggle, scrollAnimationEnabled, isLoadingMore, isAILoadingMore, aiPageNumber, hasMoreAIMessages, currentPage, pageSize: pageSize$1, isFriendLoadingMore, friendPageNumber, hasMoreFriendMessages, isGroupLoadingMore, groupPageNumber, hasMoreGroupMessages, groupSize, currentMessages, takeConversationMessages, takeFriendMessages, takeGroupMessages, onScrollToUpper, loadMoreAIMessages, loadMoreFriendMessages, loadMoreGroupMessages, onScroll, scrollToBottom, computed: vue.computed, getCurrentInstance: vue.getCurrentInstance, nextTick: vue.nextTick, onMounted: vue.onMounted, ref: vue.ref, watch: vue.watch, get onLoad() {
|
||||
}, showDownloadToast, hideDownloadToast, openLink, downloadAndHandle, sendMessage, sendFriendMessage, sendGroupMessage, sendAIMessage, stopConversation, textMessage, UserConversations, currentSessionId, userToken, UserId, UserAvatar, UserData, takeUserInfo, takeUserConversations, FriendInfoList, takeFriendList, takeTalkUserAvatar, takeUserAvatar, GroupList, takeGroupList, groupMemberList, takeGroupMemberAvatar, getGroupMemberAvatarById, allmessages, scrollToView, bottomToggle, scrollAnimationEnabled, toolFormValues, isLoadingMore, isAILoadingMore, aiPageNumber, hasMoreAIMessages, currentPage, pageSize: pageSize$1, isFriendLoadingMore, friendPageNumber, hasMoreFriendMessages, isGroupLoadingMore, groupPageNumber, hasMoreGroupMessages, groupSize, currentMessages, takeConversationMessages, takeFriendMessages, takeGroupMessages, onScrollToUpper, loadMoreAIMessages, loadMoreFriendMessages, loadMoreGroupMessages, onScroll, scrollToBottom, computed: vue.computed, getCurrentInstance: vue.getCurrentInstance, nextTick: vue.nextTick, onMounted: vue.onMounted, reactive: vue.reactive, ref: vue.ref, watch: vue.watch, get onLoad() {
|
||||
return onLoad;
|
||||
}, get onShow() {
|
||||
return onShow;
|
||||
@@ -7534,7 +7575,7 @@ This will fail in production.`);
|
||||
vue.Fragment,
|
||||
{ key: index },
|
||||
[
|
||||
$setup.ChatType === 0 && message.role !== "tool" ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
$setup.ChatType === 0 && (message.role !== "tool" || message.yxd_tool_name === "sendFrom") ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: 0,
|
||||
class: vue.normalizeClass(["chat-message", { "message-user": message.role === "user" }]),
|
||||
id: "msg-" + index
|
||||
@@ -7559,9 +7600,9 @@ This will fail in production.`);
|
||||
2
|
||||
/* CLASS */
|
||||
)) : vue.createCommentVNode("v-if", true),
|
||||
message.content && String(message.content).trim() !== "" || message._streaming ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
message.content && String(message.content).trim() !== "" || message._streaming || message.yxd_files && message.yxd_files.length > 0 || message.role === "tool" && message.yxd_tool_name === "sendFrom" ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: 1,
|
||||
class: vue.normalizeClass(["chat-content", { "chat-content-user": message.role === "user", "chat-content-assistant": message.role === "assistant" }]),
|
||||
class: vue.normalizeClass(["chat-content", { "chat-content-user": message.role === "user", "chat-content-assistant": message.role === "assistant" || message.role === "tool" }]),
|
||||
onClick: ($event) => $setup.handleChatContentClick($event, message)
|
||||
}, [
|
||||
message._streaming && (!message.content || String(message.content).trim() === "") ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
@@ -7572,11 +7613,11 @@ This will fail in production.`);
|
||||
vue.createElementVNode("view", { class: "bubble-dot" }),
|
||||
vue.createElementVNode("view", { class: "bubble-dot" })
|
||||
])) : vue.createCommentVNode("v-if", true),
|
||||
$setup.parseFileInfo(message.content).textContent ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
message.role !== "tool" && $setup.parseFileInfo(message.content).textContent ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: 1,
|
||||
innerHTML: $setup.pareseMarkdown($setup.parseFileInfo(message.content).textContent)
|
||||
}, null, 8, ["innerHTML"])) : vue.createCommentVNode("v-if", true),
|
||||
$setup.parseFileInfo(message.content).files.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
message.role !== "tool" && $setup.parseFileInfo(message.content).files.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: 2,
|
||||
class: "message-file-list"
|
||||
}, [
|
||||
@@ -7620,7 +7661,148 @@ This will fail in production.`);
|
||||
128
|
||||
/* KEYED_FRAGMENT */
|
||||
))
|
||||
])) : vue.createCommentVNode("v-if", true)
|
||||
])) : vue.createCommentVNode("v-if", true),
|
||||
message.role === "user" && message.yxd_files && message.yxd_files.length > 0 ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: 3,
|
||||
class: "message-file-list"
|
||||
}, [
|
||||
(vue.openBlock(true), vue.createElementBlock(
|
||||
vue.Fragment,
|
||||
null,
|
||||
vue.renderList(message.yxd_files, (fileName, idx) => {
|
||||
return vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: idx,
|
||||
class: "file-item"
|
||||
}, [
|
||||
vue.createElementVNode("view", { class: "message-file" }, [
|
||||
vue.createElementVNode("view", { class: "file-icon" }, "📄"),
|
||||
vue.createElementVNode(
|
||||
"view",
|
||||
{ class: "file-name" },
|
||||
vue.toDisplayString(fileName),
|
||||
1
|
||||
/* TEXT */
|
||||
)
|
||||
])
|
||||
]);
|
||||
}),
|
||||
128
|
||||
/* KEYED_FRAGMENT */
|
||||
))
|
||||
])) : vue.createCommentVNode("v-if", true),
|
||||
message.role === "tool" && message.yxd_tool_name === "sendFrom" ? (vue.openBlock(), vue.createElementBlock(
|
||||
vue.Fragment,
|
||||
{ key: 4 },
|
||||
[
|
||||
$setup.getToolFormData(message) ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: 0,
|
||||
class: "tool-form-card"
|
||||
}, [
|
||||
vue.createElementVNode(
|
||||
"view",
|
||||
{ class: "tool-form-title" },
|
||||
"📋 " + vue.toDisplayString($setup.getToolFormData(message).title || "表单"),
|
||||
1
|
||||
/* TEXT */
|
||||
),
|
||||
$setup.getToolFormData(message).description ? (vue.openBlock(), vue.createElementBlock(
|
||||
"view",
|
||||
{
|
||||
key: 0,
|
||||
class: "tool-form-desc"
|
||||
},
|
||||
vue.toDisplayString($setup.getToolFormData(message).description),
|
||||
1
|
||||
/* TEXT */
|
||||
)) : vue.createCommentVNode("v-if", true),
|
||||
vue.createElementVNode("view", { class: "tool-form-fields" }, [
|
||||
(vue.openBlock(true), vue.createElementBlock(
|
||||
vue.Fragment,
|
||||
null,
|
||||
vue.renderList($setup.getToolFormData(message).components, (comp, ci) => {
|
||||
return vue.openBlock(), vue.createElementBlock(
|
||||
vue.Fragment,
|
||||
{ key: ci },
|
||||
[
|
||||
comp.type === "text" ? (vue.openBlock(), vue.createElementBlock(
|
||||
"view",
|
||||
{
|
||||
key: 0,
|
||||
class: "tool-form-text"
|
||||
},
|
||||
vue.toDisplayString(comp.content),
|
||||
1
|
||||
/* TEXT */
|
||||
)) : comp.type === "textarea" ? (vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: 1,
|
||||
class: "tool-form-field"
|
||||
}, [
|
||||
vue.createElementVNode("view", { class: "tool-form-label" }, [
|
||||
vue.createTextVNode(
|
||||
vue.toDisplayString(comp.label),
|
||||
1
|
||||
/* TEXT */
|
||||
),
|
||||
comp.required ? (vue.openBlock(), vue.createElementBlock("text", {
|
||||
key: 0,
|
||||
style: { "color": "#e74c3c" }
|
||||
}, " *")) : vue.createCommentVNode("v-if", true)
|
||||
]),
|
||||
vue.createElementVNode("textarea", {
|
||||
class: "tool-form-textarea",
|
||||
placeholder: comp.placeholder || "",
|
||||
disabled: $setup.getToolFormData(message)._disabled || ($setup.toolFormValues[$setup.getToolFormData(message).formId] || {})._submitted,
|
||||
value: ($setup.toolFormValues[$setup.getToolFormData(message).formId] || {})[comp.name] || "",
|
||||
onInput: (e2) => {
|
||||
const f = $setup.ensureToolForm($setup.getToolFormData(message));
|
||||
f[comp.name] = e2.detail.value;
|
||||
},
|
||||
"auto-height": ""
|
||||
}, null, 40, ["placeholder", "disabled", "value", "onInput"])
|
||||
])) : (vue.openBlock(), vue.createElementBlock("view", {
|
||||
key: 2,
|
||||
class: "tool-form-field"
|
||||
}, [
|
||||
vue.createElementVNode("view", { class: "tool-form-label" }, [
|
||||
vue.createTextVNode(
|
||||
vue.toDisplayString(comp.label),
|
||||
1
|
||||
/* TEXT */
|
||||
),
|
||||
comp.required ? (vue.openBlock(), vue.createElementBlock("text", {
|
||||
key: 0,
|
||||
style: { "color": "#e74c3c" }
|
||||
}, " *")) : vue.createCommentVNode("v-if", true)
|
||||
]),
|
||||
vue.createElementVNode("input", {
|
||||
class: "tool-form-input",
|
||||
placeholder: comp.placeholder || "",
|
||||
disabled: ($setup.toolFormValues[$setup.getToolFormData(message).formId] || {})._submitted,
|
||||
value: ($setup.toolFormValues[$setup.getToolFormData(message).formId] || {})[comp.name] || "",
|
||||
onInput: (e2) => {
|
||||
const f = $setup.ensureToolForm($setup.getToolFormData(message));
|
||||
f[comp.name] = e2.detail.value;
|
||||
}
|
||||
}, null, 40, ["placeholder", "disabled", "value", "onInput"])
|
||||
]))
|
||||
],
|
||||
64
|
||||
/* STABLE_FRAGMENT */
|
||||
);
|
||||
}),
|
||||
128
|
||||
/* KEYED_FRAGMENT */
|
||||
))
|
||||
]),
|
||||
vue.createElementVNode("view", {
|
||||
class: vue.normalizeClass(["tool-form-submit", { "tool-form-submitted": ($setup.toolFormValues[$setup.getToolFormData(message).formId] || {})._submitted }]),
|
||||
onClick: ($event) => $setup.submitToolForm($setup.getToolFormData(message))
|
||||
}, vue.toDisplayString(($setup.toolFormValues[$setup.getToolFormData(message).formId] || {})._submitted ? "已提交" : $setup.getToolFormData(message).submitText || "提交"), 11, ["onClick"])
|
||||
])) : vue.createCommentVNode("v-if", true)
|
||||
],
|
||||
64
|
||||
/* STABLE_FRAGMENT */
|
||||
)) : vue.createCommentVNode("v-if", true)
|
||||
], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
|
||||
], 10, ["id"])) : vue.createCommentVNode("v-if", true)
|
||||
],
|
||||
|
||||
76
unpackage/dist/dev/app-plus/pages/Chat/Chat.css
vendored
76
unpackage/dist/dev/app-plus/pages/Chat/Chat.css
vendored
@@ -1567,6 +1567,82 @@ to { opacity: 1; transform: translateY(0);
|
||||
.chat-content-user .file-size[data-v-5eb7b895] {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
/* sendFrom 工具表单卡片 */
|
||||
.chat-content-assistant .tool-form-card[data-v-5eb7b895] {
|
||||
margin: -0.25rem -0.375rem;
|
||||
}
|
||||
.tool-form-card[data-v-5eb7b895] {
|
||||
background: #f8f9fc;
|
||||
border-radius: 0.625rem;
|
||||
padding: 1rem 0.75rem;
|
||||
border: 0.03125rem solid #e8ecf2;
|
||||
}
|
||||
.tool-form-title[data-v-5eb7b895] {
|
||||
font-size: 1.0625rem;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.tool-form-desc[data-v-5eb7b895] {
|
||||
font-size: 0.875rem;
|
||||
color: #909399;
|
||||
margin-bottom: 0.625rem;
|
||||
}
|
||||
.tool-form-fields[data-v-5eb7b895] {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.625rem;
|
||||
}
|
||||
.tool-form-text[data-v-5eb7b895] {
|
||||
font-size: 0.875rem;
|
||||
color: #606266;
|
||||
padding: 0.25rem 0;
|
||||
}
|
||||
.tool-form-field[data-v-5eb7b895] {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3125rem;
|
||||
}
|
||||
.tool-form-label[data-v-5eb7b895] {
|
||||
font-size: 0.875rem;
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
}
|
||||
.tool-form-input[data-v-5eb7b895] {
|
||||
font-size: 0.875rem;
|
||||
color: #303133;
|
||||
padding: 1.25rem 0.625rem;
|
||||
background: #fff;
|
||||
border-radius: 0.375rem;
|
||||
border: 0.03125rem solid #e4e7ed;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.tool-form-textarea[data-v-5eb7b895] {
|
||||
font-size: 0.875rem;
|
||||
color: #303133;
|
||||
padding: 0.5625rem 0.625rem;
|
||||
background: #fff;
|
||||
border-radius: 0.375rem;
|
||||
border: 0.03125rem solid #e4e7ed;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
min-height: 3.125rem;
|
||||
}
|
||||
.tool-form-submit[data-v-5eb7b895] {
|
||||
margin-top: 0.75rem;
|
||||
padding: 0.5625rem 0;
|
||||
text-align: center;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
color: #fff;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 500;
|
||||
border-radius: 0.4375rem;
|
||||
}
|
||||
.tool-form-submitted[data-v-5eb7b895] {
|
||||
background: #c0c4cc;
|
||||
color: #fff;
|
||||
}
|
||||
/* ==========聊天输入容器部分========== */
|
||||
.chat-interactive-container[data-v-5eb7b895] {
|
||||
display: flex;
|
||||
|
||||
76
unpackage/dist/dev/app-plus/pages/text/text.css
vendored
76
unpackage/dist/dev/app-plus/pages/text/text.css
vendored
@@ -1567,6 +1567,82 @@ to { opacity: 1; transform: translateY(0);
|
||||
.chat-content-user .file-size[data-v-fdf84df1] {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
/* sendFrom 工具表单卡片 */
|
||||
.chat-content-assistant .tool-form-card[data-v-fdf84df1] {
|
||||
margin: -0.25rem -0.375rem;
|
||||
}
|
||||
.tool-form-card[data-v-fdf84df1] {
|
||||
background: #f8f9fc;
|
||||
border-radius: 0.625rem;
|
||||
padding: 1rem 0.75rem;
|
||||
border: 0.03125rem solid #e8ecf2;
|
||||
}
|
||||
.tool-form-title[data-v-fdf84df1] {
|
||||
font-size: 1.0625rem;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.tool-form-desc[data-v-fdf84df1] {
|
||||
font-size: 0.875rem;
|
||||
color: #909399;
|
||||
margin-bottom: 0.625rem;
|
||||
}
|
||||
.tool-form-fields[data-v-fdf84df1] {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.625rem;
|
||||
}
|
||||
.tool-form-text[data-v-fdf84df1] {
|
||||
font-size: 0.875rem;
|
||||
color: #606266;
|
||||
padding: 0.25rem 0;
|
||||
}
|
||||
.tool-form-field[data-v-fdf84df1] {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3125rem;
|
||||
}
|
||||
.tool-form-label[data-v-fdf84df1] {
|
||||
font-size: 0.875rem;
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
}
|
||||
.tool-form-input[data-v-fdf84df1] {
|
||||
font-size: 0.875rem;
|
||||
color: #303133;
|
||||
padding: 1.25rem 0.625rem;
|
||||
background: #fff;
|
||||
border-radius: 0.375rem;
|
||||
border: 0.03125rem solid #e4e7ed;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.tool-form-textarea[data-v-fdf84df1] {
|
||||
font-size: 0.875rem;
|
||||
color: #303133;
|
||||
padding: 0.5625rem 0.625rem;
|
||||
background: #fff;
|
||||
border-radius: 0.375rem;
|
||||
border: 0.03125rem solid #e4e7ed;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
min-height: 3.125rem;
|
||||
}
|
||||
.tool-form-submit[data-v-fdf84df1] {
|
||||
margin-top: 0.75rem;
|
||||
padding: 0.5625rem 0;
|
||||
text-align: center;
|
||||
background: linear-gradient(135deg, #667eea, #764ba2);
|
||||
color: #fff;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 500;
|
||||
border-radius: 0.4375rem;
|
||||
}
|
||||
.tool-form-submitted[data-v-fdf84df1] {
|
||||
background: #c0c4cc;
|
||||
color: #fff;
|
||||
}
|
||||
/* ==========聊天输入容器部分========== */
|
||||
.chat-interactive-container[data-v-fdf84df1] {
|
||||
display: flex;
|
||||
|
||||
@@ -101,7 +101,7 @@ export const getConversationMessages = async (token, conversation_id, size, page
|
||||
uni.setStorageSync('workspace_id', messagesInfo.workspace_id)
|
||||
}
|
||||
const filtered = (messagesInfo.messages || []).filter(
|
||||
m => m.role !== 'tool'
|
||||
m => m.role !== 'tool' || m.yxd_tool_name === 'sendFrom'
|
||||
)
|
||||
resolve(filtered)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user