Compare commits

...

16 Commits

26 changed files with 4346 additions and 501 deletions

View File

@@ -72,10 +72,7 @@
<view class="history-chat-avatar">
<uni-icons type="chat-filled" size="26" color="#007aff"></uni-icons>
</view>
<view v-if="chat.agent_id">
{{truncateText(chat.agent_data?.title) || "加载中"}}
</view>
<view v-else>{{truncateText(chat.title)}}</view>
<view>{{truncateText(getConvName(chat))}}</view>
</view>
<!-- 好友对话列表 -->
<view v-if="chatType === 1" v-for="chat in UserConversations" :key="chat.sessionId"
@@ -269,7 +266,12 @@
// 新建会话
const openNewChatModal = () => {
console.log("点击了新建会话");
// 好友会话(1)或群聊(2)时,跳转到通讯录页面发起新聊天
if (chatType.value === 1 || chatType.value === 2) {
goContactPages()
return
}
// AI 聊天(0)时,弹出新建会话弹窗
emit('update:showNewChatModal', true)
}
@@ -320,6 +322,18 @@
return text.length > maxLength ? text.substring(0, maxLength) + '...' : text
}
// 获取会话名称agent_title > 清理后的title > 格式化时间
const getConvName = (conv) => {
if (conv.agent_data?.title) return conv.agent_data.title
if (conv.title && !conv.title.startsWith('[文件信息')) return conv.title
if (conv.created_at) {
const t = conv.created_at
const pad = (n) => String(n).padStart(2, '0')
return `${t.year}${t.month}${t.day}${pad(t.hour)}:${pad(t.minute)}:${pad(t.second)}`
}
return '未命名会话'
}
onMounted(async () => {
UserToken.value = getToken()
const UserInfo = await getUserInfo(UserToken.value)

View File

@@ -212,6 +212,379 @@
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
/* ========== 智能体选择弹窗 ========== */
.agent-modal-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.agent-modal {
width: 85%;
max-height: 70%;
background-color: #ffffff;
border-radius: 24rpx;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.12);
}
.agent-modal-header {
display: flex;
justify-content: center;
align-items: center;
padding: 30rpx 30rpx 20rpx;
position: relative;
border-bottom: 2rpx solid #f0f0f0;
}
.agent-modal-title {
font-size: 34rpx;
font-weight: 700;
color: #1a1a2e;
}
.agent-modal-close {
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
padding: 10rpx;
}
.agent-list {
box-sizing: border-box;
flex: 1;
padding: 20rpx 24rpx;
max-height: 600rpx;
}
.agent-loading {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 60rpx 0;
}
.agent-loading-text {
margin-top: 16rpx;
font-size: 26rpx;
color: #999;
}
.agent-empty {
display: flex;
align-items: center;
justify-content: center;
padding: 80rpx 0;
}
.agent-empty-text {
font-size: 28rpx;
color: #999;
}
.agent-card {
box-sizing: border-box;
width: 100%;
background: linear-gradient(135deg, #f8f5ff, #efe8ff);
border: 2rpx solid #c4b5fd;
border-radius: 20rpx;
padding: 28rpx 24rpx;
margin-bottom: 20rpx;
transition: all 0.2s ease;
overflow: hidden;
}
.agent-card:active {
transform: scale(0.98);
border-color: #a78bfa;
background: linear-gradient(135deg, #f3efff, #e8dcff);
}
.agent-card-header {
display: flex;
align-items: center;
margin-bottom: 16rpx;
}
.agent-avatar {
width: 70rpx;
height: 70rpx;
border-radius: 20rpx;
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.agent-card-info {
margin-left: 16rpx;
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
}
.agent-card-title {
font-size: 30rpx;
font-weight: 600;
color: #1a1a2e;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.agent-card-category {
font-size: 22rpx;
color: #8b5cf6;
margin-top: 4rpx;
}
.agent-card-desc {
font-size: 26rpx;
color: #555;
line-height: 1.5;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
overflow: hidden;
}
.agent-card-welcome {
font-size: 24rpx;
color: #7c3aed;
margin-top: 12rpx;
padding-top: 12rpx;
border-top: 2rpx dashed #ddd6fe;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.agent-modal-footer {
padding: 20rpx 30rpx 30rpx;
border-top: 2rpx solid #f0f0f0;
display: flex;
justify-content: flex-end;
}
.agent-modal-btn {
padding: 18rpx 48rpx;
border-radius: 16rpx;
font-size: 28rpx;
font-weight: 500;
}
.agent-modal-btn-cancel {
background: #f0f0f0;
color: #666;
}
.agent-modal-btn-cancel:active {
background: #e0e0e0;
}
/* ========== 转发消息弹窗 ========== */
.forward-modal-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: 1001;
display: flex;
align-items: center;
justify-content: center;
}
.forward-modal {
width: 85%;
max-height: 72%;
background-color: #fff;
border-radius: 24rpx;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.12);
}
.forward-modal-header {
display: flex;
justify-content: center;
align-items: center;
position: relative;
padding: 28rpx 30rpx 20rpx;
border-bottom: 2rpx solid #f0f0f0;
}
.forward-modal-title {
font-size: 34rpx;
font-weight: 700;
color: #1a1a2e;
}
.forward-modal-close {
position: absolute;
right: 24rpx;
top: 50%;
transform: translateY(-50%);
}
.forward-preview-box {
margin: 20rpx 30rpx 8rpx;
padding: 20rpx 24rpx;
background: #f7f8fc;
border-radius: 14rpx;
border-left: 6rpx solid #007aff;
}
.forward-preview-label {
font-size: 24rpx;
color: #999;
display: block;
margin-bottom: 8rpx;
}
.forward-preview-text {
font-size: 28rpx;
color: #333;
word-break: break-all;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
.forward-select-label {
font-size: 26rpx;
color: #666;
padding: 12rpx 30rpx 8rpx;
display: block;
}
.forward-conv-list {
flex: 1;
max-height: 400rpx;
padding: 0 20rpx;
}
.forward-empty {
display: flex;
justify-content: center;
align-items: center;
height: 160rpx;
color: #999;
font-size: 26rpx;
}
.forward-conv-item {
display: flex;
align-items: center;
padding: 22rpx 16rpx;
border-radius: 16rpx;
margin-bottom: 8rpx;
background: #fafafa;
transition: background 0.2s;
}
.forward-conv-item:active {
background: #eef4ff;
}
.forward-conv-selected {
background: #e8f0fe;
border: 2rpx solid #007aff;
}
.forward-conv-avatar {
width: 60rpx;
height: 60rpx;
border-radius: 14rpx;
background: #e8f0fe;
display: flex;
align-items: center;
justify-content: center;
margin-right: 20rpx;
flex-shrink: 0;
}
.forward-conv-info {
flex: 1;
min-width: 0;
}
.forward-conv-name {
font-size: 28rpx;
color: #333;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.forward-conv-check {
flex-shrink: 0;
margin-left: 12rpx;
}
.forward-modal-footer {
padding: 20rpx 30rpx 30rpx;
border-top: 2rpx solid #f0f0f0;
display: flex;
justify-content: flex-end;
gap: 20rpx;
}
.forward-modal-btn {
padding: 18rpx 48rpx;
border-radius: 16rpx;
font-size: 28rpx;
font-weight: 500;
}
.forward-btn-cancel {
background: #f0f0f0;
color: #666;
}
.forward-btn-cancel:active {
background: #e0e0e0;
}
.forward-btn-confirm {
background: #007aff;
color: #fff;
}
.forward-btn-confirm:active {
background: #005fcc;
}
.forward-btn-disabled {
background: #b0d0f0;
color: #fff;
pointer-events: none;
}
/* ==========新建聊天列表相关====== */
.close-option-card {
width: 100%;
@@ -319,6 +692,10 @@
font-size: 48rpx;
}
.chat-btn-group .head-btn:nth-child(4) {
/* 刷新按钮 */
}
.log-out {
/* background: #ffd4d4; */
}
@@ -427,7 +804,7 @@
.chat-message {
display: flex;
align-items: flex-start;
flex-direction: column;
margin: 14rpx 0;
box-sizing: border-box;
animation: msgFadeIn 0.3s ease;
@@ -439,6 +816,17 @@
}
.message-user {
align-items: flex-end;
}
/* avatar + 气泡行(上方) */
.message-row {
display: flex;
align-items: flex-start;
width: 100%;
}
.message-user .message-row {
flex-direction: row-reverse;
}
@@ -483,6 +871,9 @@
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
background: #ffffff;
border: 1rpx solid #eeeef5;
/* 启用文本选择复制 */
user-select: text;
-webkit-user-select: text;
}
.chat-content-user {
@@ -502,6 +893,81 @@
border-bottom-left-radius: 8rpx;
}
/* 消息操作栏 */
.message-actions {
display: flex;
align-items: center;
justify-content: flex-end;
margin-top: 16rpx;
padding-top: 12rpx;
border-top: 1rpx solid rgba(0, 0, 0, 0.06);
gap: 24rpx;
}
.message-actions-user {
justify-content: flex-start;
border-top-color: rgba(255, 255, 255, 0.3);
}
.message-action-item {
display: flex;
align-items: center;
gap: 6rpx;
padding: 8rpx 16rpx;
border-radius: 12rpx;
transition: all 0.2s ease;
}
.message-action-item:active {
background: rgba(0, 0, 0, 0.05);
transform: scale(0.95);
}
.message-actions-user .message-action-item:active {
background: rgba(255, 255, 255, 0.2);
}
.action-text {
font-size: 22rpx;
color: #999;
}
.message-actions-user .action-text {
color: rgba(255, 255, 255, 0.8);
}
/* 消息转发弹窗 */
.msg-actions {
display: flex;
align-items: center;
gap: 16rpx;
margin-top: 10rpx;
}
.msg-actions-user {
justify-content: flex-end;
}
.msg-action-btn {
display: flex;
align-items: center;
gap: 6rpx;
padding: 4rpx 0;
}
.msg-action-icon {
font-size: 26rpx;
}
.msg-action-label {
font-size: 22rpx;
color: #888;
}
.msg-action-forward {
margin-left: 8rpx;
}
/* 图片消息 */
.message-image {
max-width: 300rpx;
@@ -563,6 +1029,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 {

File diff suppressed because it is too large Load Diff

View File

@@ -336,8 +336,13 @@ import {
if (isSelectFolder.value) return;
const isWyxd = folder.name && folder.name.toLowerCase().endsWith('.wyxd');
const itemList = isWyxd ? ['下载', '删除', 'WYXD查看器', 'AI修改'] : ['下载', '删除'];
// 截断过长文件名,避免撑开弹窗遮挡操作按钮
const maxTitleLen = 40;
const title = folder.name && folder.name.length > maxTitleLen
? folder.name.substring(0, maxTitleLen) + '...'
: folder.name;
uni.showActionSheet({
title: folder.name,
title: title,
itemList: itemList,
success: (res) => {
if (isWyxd) {

View File

@@ -66,7 +66,11 @@
</view>
<view class="main-chat">
<scroll-view class="chat-messages" direction="vertical" scroll-y :scroll-into-view="scrollToView"
:upper-threshold="0" :scroll-with-animation="true" @scroll="onScroll">
:upper-threshold="50" :scroll-with-animation="true" @scroll="onScroll" @scrolltoupper="onScrollToUpper">
<!-- 加载更多提示 -->
<view v-if="(ChatType === 0 && isAILoadingMore) || (ChatType === 1 && isFriendLoadingMore) || (ChatType === 2 && isGroupLoadingMore)" class="load-more-tip">
<text>加载更多消息...</text>
</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"
@@ -1317,6 +1321,22 @@ import { openFile as openFileNative } from '@/utils/fileOpener.js'
// 加载状态和分页相关变量
const isLoadingMore = ref(false) // 是否正在加载更多
const currentPage = ref(1) // 当前页码(如果后端支持分页)
const pageSize = 200;
// AI 消息分页
const isAILoadingMore = ref(false)
const aiPageNumber = ref(0) // AI 会话当前服务端页码0-based
const hasMoreAIMessages = ref(true)
// 好友消息分页
const isFriendLoadingMore = ref(false)
const friendPageNumber = ref(1) // 好友消息当前页码1-based
const hasMoreFriendMessages = ref(true)
// 群聊消息分页
const isGroupLoadingMore = ref(false)
const groupPageNumber = ref(1) // 群聊消息当前页码1-based
const hasMoreGroupMessages = ref(true)
// 计算属性:自动根据 allmessages 和 currentPage 计算显示消息
const currentMessages = computed(() => {
// return allmessages.value.slice(-pageInfoNumber);
@@ -1327,9 +1347,11 @@ import { openFile as openFileNative } from '@/utils/fileOpener.js'
// 获取对话消息
const takeConversationMessages = async () => {
try {
allmessages.value = await getConversationMessages(userToken.value, currentSessionId.value) || [];
aiPageNumber.value = 0
hasMoreAIMessages.value = true
const rawMessages = await getConversationMessages(userToken.value, currentSessionId.value, pageSize, 0) || [];
allmessages.value = rawMessages
// console.log("获取到的所有消息:", JSON.stringify(allmessages.value) );
// currentMessages.value = allmessages.value.slice(-pageInfoNumber);
// 数据获取后执行滚动
scrollToBottom();
} catch (error) {
@@ -1341,7 +1363,10 @@ import { openFile as openFileNative } from '@/utils/fileOpener.js'
}
const takeFriendMessages = async () => {
try {
allmessages.value = await getFriendMessages(currentSessionId.value) || [];
friendPageNumber.value = 1
hasMoreFriendMessages.value = true
const rawMessages = await getFriendMessages(currentSessionId.value, 1) || [];
allmessages.value = rawMessages
// console.log("好友消息:", JSON.stringify(allmessages.value));
// 数据获取后执行滚动
scrollToBottom();
@@ -1354,7 +1379,10 @@ import { openFile as openFileNative } from '@/utils/fileOpener.js'
}
const takeGroupMessages = async () => {
try {
allmessages.value = await getGroupMessages(currentSessionId.value) || [];
groupPageNumber.value = 1
hasMoreGroupMessages.value = true
const rawMessages = await getGroupMessages(currentSessionId.value, 1) || [];
allmessages.value = rawMessages
console.log("群聊消息:", allmessages.value);
// 获取群成员列表并获取头像
const memberList = await getGroupMemberList(currentSessionId.value)
@@ -1394,6 +1422,90 @@ import { openFile as openFileNative } from '@/utils/fileOpener.js'
// 监听滚动
const onScroll = (e) => {}
// 滚动到顶部时加载更多消息(根据 ChatType 分发)
const onScrollToUpper = async () => {
if (ChatType.value === 0) {
await loadMoreAIMessages()
} else if (ChatType.value === 1) {
await loadMoreFriendMessages()
} else if (ChatType.value === 2) {
await loadMoreGroupMessages()
}
}
// 加载更多 AI 历史消息(上一页),并定位到原第一条消息
const loadMoreAIMessages = async () => {
if (isAILoadingMore.value || !hasMoreAIMessages.value || !currentSessionId.value) return
isAILoadingMore.value = true
try {
const nextPage = aiPageNumber.value + 1
const olderMessages = await getConversationMessages(userToken.value, currentSessionId.value, pageSize, nextPage)
if (olderMessages && olderMessages.length > 0) {
aiPageNumber.value = nextPage
allmessages.value = [...olderMessages, ...allmessages.value]
await nextTick()
scrollToView.value = 'msg-' + olderMessages.length
} else {
hasMoreAIMessages.value = false
}
} catch (e) {
console.error('加载更多AI消息失败:', e)
uni.showToast({ title: '加载更多失败', icon: 'none' })
} finally {
isAILoadingMore.value = false
}
}
// 加载更多好友历史消息(上一页),并定位到原第一条消息
const loadMoreFriendMessages = async () => {
if (isFriendLoadingMore.value || !hasMoreFriendMessages.value || !currentSessionId.value) return
isFriendLoadingMore.value = true
try {
const nextPage = friendPageNumber.value + 1
const olderMessages = await getFriendMessages(currentSessionId.value, nextPage)
if (olderMessages && olderMessages.length > 0) {
friendPageNumber.value = nextPage
allmessages.value = [...olderMessages, ...allmessages.value]
await nextTick()
scrollToView.value = 'msg-' + olderMessages.length
} else {
hasMoreFriendMessages.value = false
}
} catch (e) {
console.error('加载更多好友消息失败:', e)
uni.showToast({ title: '加载更多失败', icon: 'none' })
} finally {
isFriendLoadingMore.value = false
}
}
// 加载更多群聊历史消息(上一页),并定位到原第一条消息
const loadMoreGroupMessages = async () => {
if (isGroupLoadingMore.value || !hasMoreGroupMessages.value || !currentSessionId.value) return
isGroupLoadingMore.value = true
try {
const nextPage = groupPageNumber.value + 1
const olderMessages = await getGroupMessages(currentSessionId.value, nextPage)
if (olderMessages && olderMessages.length > 0) {
groupPageNumber.value = nextPage
allmessages.value = [...olderMessages, ...allmessages.value]
await nextTick()
scrollToView.value = 'msg-' + olderMessages.length
} else {
hasMoreGroupMessages.value = false
}
} catch (e) {
console.error('加载更多群聊消息失败:', e)
uni.showToast({ title: '加载更多失败', icon: 'none' })
} finally {
isGroupLoadingMore.value = false
}
}
// 滑动到底部
const scrollToBottom = async () => {
await nextTick();

View File

@@ -54,6 +54,18 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe6ea;</span>
<div class="name">转发</div>
<div class="code-name">&amp;#xe6ea;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6fc;</span>
<div class="name">复制</div>
<div class="code-name">&amp;#xe6fc;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe695;</span>
<div class="name">代码</div>
@@ -480,9 +492,9 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1783330740989') format('woff2'),
url('iconfont.woff?t=1783330740989') format('woff'),
url('iconfont.ttf?t=1783330740989') format('truetype');
src: url('iconfont.woff2?t=1786091687579') format('woff2'),
url('iconfont.woff?t=1786091687579') format('woff'),
url('iconfont.ttf?t=1786091687579') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -508,6 +520,24 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-zhuanfa_3"></span>
<div class="name">
转发
</div>
<div class="code-name">.icon-zhuanfa_3
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-fuzhi1"></span>
<div class="name">
复制
</div>
<div class="code-name">.icon-fuzhi1
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-daima"></span>
<div class="name">
@@ -1147,6 +1177,22 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhuanfa_3"></use>
</svg>
<div class="name">转发</div>
<div class="code-name">#icon-zhuanfa_3</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-fuzhi1"></use>
</svg>
<div class="name">复制</div>
<div class="code-name">#icon-fuzhi1</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-daima"></use>

View File

@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 4890805 */
src: url('iconfont.woff2?t=1783330740989') format('woff2'),
url('iconfont.woff?t=1783330740989') format('woff'),
url('iconfont.ttf?t=1783330740989') format('truetype');
src: url('iconfont.woff2?t=1786091687579') format('woff2'),
url('iconfont.woff?t=1786091687579') format('woff'),
url('iconfont.ttf?t=1786091687579') format('truetype');
}
.iconfont {
@@ -13,6 +13,14 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-zhuanfa_3:before {
content: "\e6ea";
}
.icon-fuzhi1:before {
content: "\e6fc";
}
.icon-daima:before {
content: "\e695";
}

File diff suppressed because one or more lines are too long

View File

@@ -5,6 +5,20 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "16322565",
"name": "转发",
"font_class": "zhuanfa_3",
"unicode": "e6ea",
"unicode_decimal": 59114
},
{
"icon_id": "16322894",
"name": "复制",
"font_class": "fuzhi1",
"unicode": "e6fc",
"unicode_decimal": 59132
},
{
"icon_id": "1767709",
"name": "代码",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -30,6 +30,7 @@ export const useSocketStore = defineStore('socket', () => {
const maxLogCount = ref(20)
const authFailReason = ref('')
const pcOffline = ref(false)
// ==================== 计算属性 ====================
const isConnected = computed(() => connectionStatus.value === 'connected')
@@ -66,6 +67,7 @@ export const useSocketStore = defineStore('socket', () => {
...config.value,
...options
}
pcOffline.value = false // 每次连接时重置 PC 离线标记
addLog('info',
`准备连接WebSocket。Token:${config.value.token || '未设置'}。ConversationId: ${config.value.conversationId || '未设置'}`
)
@@ -161,21 +163,6 @@ export const useSocketStore = defineStore('socket', () => {
// 调试日志:明确输出 type 和 data
console.log(`[handleMessage] type = ${type}, data = ${JSON.stringify(data)}`);
const eventConversationId =
conversation_id ||
data?.conversation_id ||
data?.page?.conversation?.conversation_id ||
data?.page?.conversation?.id ||
''
if (
eventConversationId &&
config.value.conversationId &&
String(eventConversationId) !== String(config.value.conversationId)
) {
addLog('info', `忽略非当前会话消息: ${eventConversationId}`)
return
}
switch (type) {
case 'auth_ok':
addLog('success', '连接成功')
@@ -191,51 +178,14 @@ export const useSocketStore = defineStore('socket', () => {
addLog('warn', 'AI成功收到用户发送的消息')
break
case 'forbid_input':
addLog('warn', '收到封框指令')
isThinking.value = true
break
case 'relieve_input':
addLog('warn', '收到解框指令')
isThinking.value = false
break
case 'turn_status': {
const status = String(messageData.status || data?.status || '').toLowerCase()
if (status === 'locked') {
addLog('warn', '后端确认程序封框')
isThinking.value = true
} else if (status === 'finished' || status === 'cancelled' || status === 'unlocked' || status === 'relieved') {
addLog('warn', `后端确认当前轮结束/解框: ${status}`)
isThinking.value = false
}
break
}
case 'prompt':
if ((messageData.info || data?.info) === '结束等待') {
addLog('warn', '收到结束等待信号')
isThinking.value = false
}
break
case 'refresh':
if (messageData.page?.waiting === false || data?.page?.waiting === false) {
addLog('warn', 'refresh 确认 waiting=false释放输入框')
isThinking.value = false
}
break
case 'render':
addLog('warn', 'AI正在回复信息')
handleBusinessMessage(data)
break
case 'pc_offline':
pcOffline.value = true
addLog('warn', 'PC 端已离线')
isThinking.value = false
authFailReason.value = 'pc offline'
break
default:
@@ -282,46 +232,6 @@ export const useSocketStore = defineStore('socket', () => {
// 处理 data 为对象的情况
if (!data || typeof data !== 'object') return
const msgType = String(data.type || '').trim()
if (msgType === 'forbid_input') {
console.log("收到后端封框指令");
isThinking.value = true
return
}
if (msgType === 'relieve_input') {
console.log("收到后端解框指令");
isThinking.value = false
return
}
if (data.cmd === 'turn_status') {
const status = String(data.status || '').toLowerCase()
if (status === 'locked') {
console.log("后端确认程序封框");
isThinking.value = true
return
}
if (status === 'finished' || status === 'cancelled' || status === 'unlocked' || status === 'relieved') {
console.log("后端确认当前轮结束/解框:", status);
isThinking.value = false
return
}
}
if (data.cmd === 'prompt' && data.info === '结束等待') {
console.log("收到结束等待信号");
isThinking.value = false
return
}
// refresh 也会在流式输出和工具中间消息落盘时出现,不能直接当成最终完成。
// 只有后端明确 page.waiting=false 时,才作为漏发结束信号的兜底释放。
if (data.cmd === 'refresh' && data.page?.waiting === false) {
console.log("refresh 确认 waiting=false释放输入框");
isThinking.value = false
return
}
// 中断确认:后端返回 cmd=event_callback 表示中断成功
if (data.cmd === 'event_callback' && data.info === '中断成功') {
console.log("后端确认中断成功");
@@ -380,6 +290,7 @@ export const useSocketStore = defineStore('socket', () => {
logs,
config,
authFailReason,
pcOffline,
// 计算属性
isConnected,

File diff suppressed because it is too large Load Diff

View File

@@ -28,9 +28,9 @@
/*每个页面公共css */
@font-face {
font-family: "iconfont"; /* Project id 4890805 */
src: url('static/iconfont/iconfont.woff2?t=1783330740989') format('woff2'),
url('static/iconfont/iconfont.woff?t=1783330740989') format('woff'),
url('static/iconfont/iconfont.ttf?t=1783330740989') format('truetype');
src: url('static/iconfont/iconfont.woff2?t=1786091687579') format('woff2'),
url('static/iconfont/iconfont.woff?t=1786091687579') format('woff'),
url('static/iconfont/iconfont.ttf?t=1786091687579') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
@@ -39,6 +39,12 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-zhuanfa_3:before {
content: "\e6ea";
}
.icon-fuzhi1:before {
content: "\e6fc";
}
.icon-daima:before {
content: "\e695";
}

View File

@@ -1096,6 +1096,331 @@ to { opacity: 1; transform: translateY(0) scale(1);
.ncd-intelligence .ncd-opt-icon[data-v-5eb7b895] {
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
/* ========== 智能体选择弹窗 ========== */
.agent-modal-mask[data-v-5eb7b895] {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.agent-modal[data-v-5eb7b895] {
width: 85%;
max-height: 70%;
background-color: #ffffff;
border-radius: 0.75rem;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}
.agent-modal-header[data-v-5eb7b895] {
display: flex;
justify-content: center;
align-items: center;
padding: 0.9375rem 0.9375rem 0.625rem;
position: relative;
border-bottom: 0.0625rem solid #f0f0f0;
}
.agent-modal-title[data-v-5eb7b895] {
font-size: 1.0625rem;
font-weight: 700;
color: #1a1a2e;
}
.agent-modal-close[data-v-5eb7b895] {
position: absolute;
right: 0.75rem;
top: 50%;
transform: translateY(-50%);
padding: 0.3125rem;
}
.agent-list[data-v-5eb7b895] {
box-sizing: border-box;
flex: 1;
padding: 0.625rem 0.75rem;
max-height: 18.75rem;
}
.agent-loading[data-v-5eb7b895] {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1.875rem 0;
}
.agent-loading-text[data-v-5eb7b895] {
margin-top: 0.5rem;
font-size: 0.8125rem;
color: #999;
}
.agent-empty[data-v-5eb7b895] {
display: flex;
align-items: center;
justify-content: center;
padding: 2.5rem 0;
}
.agent-empty-text[data-v-5eb7b895] {
font-size: 0.875rem;
color: #999;
}
.agent-card[data-v-5eb7b895] {
box-sizing: border-box;
width: 100%;
background: linear-gradient(135deg, #f8f5ff, #efe8ff);
border: 0.0625rem solid #c4b5fd;
border-radius: 0.625rem;
padding: 0.875rem 0.75rem;
margin-bottom: 0.625rem;
transition: all 0.2s ease;
overflow: hidden;
}
.agent-card[data-v-5eb7b895]:active {
transform: scale(0.98);
border-color: #a78bfa;
background: linear-gradient(135deg, #f3efff, #e8dcff);
}
.agent-card-header[data-v-5eb7b895] {
display: flex;
align-items: center;
margin-bottom: 0.5rem;
}
.agent-avatar[data-v-5eb7b895] {
width: 2.1875rem;
height: 2.1875rem;
border-radius: 0.625rem;
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.agent-card-info[data-v-5eb7b895] {
margin-left: 0.5rem;
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
}
.agent-card-title[data-v-5eb7b895] {
font-size: 0.9375rem;
font-weight: 600;
color: #1a1a2e;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.agent-card-category[data-v-5eb7b895] {
font-size: 0.6875rem;
color: #8b5cf6;
margin-top: 0.125rem;
}
.agent-card-desc[data-v-5eb7b895] {
font-size: 0.8125rem;
color: #555;
line-height: 1.5;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
overflow: hidden;
}
.agent-card-welcome[data-v-5eb7b895] {
font-size: 0.75rem;
color: #7c3aed;
margin-top: 0.375rem;
padding-top: 0.375rem;
border-top: 0.0625rem dashed #ddd6fe;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.agent-modal-footer[data-v-5eb7b895] {
padding: 0.625rem 0.9375rem 0.9375rem;
border-top: 0.0625rem solid #f0f0f0;
display: flex;
justify-content: flex-end;
}
.agent-modal-btn[data-v-5eb7b895] {
padding: 0.5625rem 1.5rem;
border-radius: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
}
.agent-modal-btn-cancel[data-v-5eb7b895] {
background: #f0f0f0;
color: #666;
}
.agent-modal-btn-cancel[data-v-5eb7b895]:active {
background: #e0e0e0;
}
/* ========== 转发消息弹窗 ========== */
.forward-modal-mask[data-v-5eb7b895] {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: 1001;
display: flex;
align-items: center;
justify-content: center;
}
.forward-modal[data-v-5eb7b895] {
width: 85%;
max-height: 72%;
background-color: #fff;
border-radius: 0.75rem;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}
.forward-modal-header[data-v-5eb7b895] {
display: flex;
justify-content: center;
align-items: center;
position: relative;
padding: 0.875rem 0.9375rem 0.625rem;
border-bottom: 0.0625rem solid #f0f0f0;
}
.forward-modal-title[data-v-5eb7b895] {
font-size: 1.0625rem;
font-weight: 700;
color: #1a1a2e;
}
.forward-modal-close[data-v-5eb7b895] {
position: absolute;
right: 0.75rem;
top: 50%;
transform: translateY(-50%);
}
.forward-preview-box[data-v-5eb7b895] {
margin: 0.625rem 0.9375rem 0.25rem;
padding: 0.625rem 0.75rem;
background: #f7f8fc;
border-radius: 0.4375rem;
border-left: 0.1875rem solid #007aff;
}
.forward-preview-label[data-v-5eb7b895] {
font-size: 0.75rem;
color: #999;
display: block;
margin-bottom: 0.25rem;
}
.forward-preview-text[data-v-5eb7b895] {
font-size: 0.875rem;
color: #333;
word-break: break-all;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
.forward-select-label[data-v-5eb7b895] {
font-size: 0.8125rem;
color: #666;
padding: 0.375rem 0.9375rem 0.25rem;
display: block;
}
.forward-conv-list[data-v-5eb7b895] {
flex: 1;
max-height: 12.5rem;
padding: 0 0.625rem;
}
.forward-empty[data-v-5eb7b895] {
display: flex;
justify-content: center;
align-items: center;
height: 5rem;
color: #999;
font-size: 0.8125rem;
}
.forward-conv-item[data-v-5eb7b895] {
display: flex;
align-items: center;
padding: 0.6875rem 0.5rem;
border-radius: 0.5rem;
margin-bottom: 0.25rem;
background: #fafafa;
transition: background 0.2s;
}
.forward-conv-item[data-v-5eb7b895]:active {
background: #eef4ff;
}
.forward-conv-selected[data-v-5eb7b895] {
background: #e8f0fe;
border: 0.0625rem solid #007aff;
}
.forward-conv-avatar[data-v-5eb7b895] {
width: 1.875rem;
height: 1.875rem;
border-radius: 0.4375rem;
background: #e8f0fe;
display: flex;
align-items: center;
justify-content: center;
margin-right: 0.625rem;
flex-shrink: 0;
}
.forward-conv-info[data-v-5eb7b895] {
flex: 1;
min-width: 0;
}
.forward-conv-name[data-v-5eb7b895] {
font-size: 0.875rem;
color: #333;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.forward-conv-check[data-v-5eb7b895] {
flex-shrink: 0;
margin-left: 0.375rem;
}
.forward-modal-footer[data-v-5eb7b895] {
padding: 0.625rem 0.9375rem 0.9375rem;
border-top: 0.0625rem solid #f0f0f0;
display: flex;
justify-content: flex-end;
gap: 0.625rem;
}
.forward-modal-btn[data-v-5eb7b895] {
padding: 0.5625rem 1.5rem;
border-radius: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
}
.forward-btn-cancel[data-v-5eb7b895] {
background: #f0f0f0;
color: #666;
}
.forward-btn-cancel[data-v-5eb7b895]:active {
background: #e0e0e0;
}
.forward-btn-confirm[data-v-5eb7b895] {
background: #007aff;
color: #fff;
}
.forward-btn-confirm[data-v-5eb7b895]:active {
background: #005fcc;
}
.forward-btn-disabled[data-v-5eb7b895] {
background: #b0d0f0;
color: #fff;
pointer-events: none;
}
/* ==========新建聊天列表相关====== */
.close-option-card[data-v-5eb7b895] {
width: 100%;
@@ -1188,6 +1513,9 @@ to { opacity: 1; transform: translateY(0) scale(1);
.head-btn .iconfont[data-v-5eb7b895] {
font-size: 1.5rem;
}
.chat-btn-group .head-btn[data-v-5eb7b895]:nth-child(4) {
/* 刷新按钮 */
}
.log-out[data-v-5eb7b895] {
/* background: #ffd4d4; */
}
@@ -1281,7 +1609,7 @@ to { opacity: 1; transform: translateY(0) scale(1);
}
.chat-message[data-v-5eb7b895] {
display: flex;
align-items: flex-start;
flex-direction: column;
margin: 0.4375rem 0;
box-sizing: border-box;
animation: msgFadeIn-5eb7b895 0.3s ease;
@@ -1293,6 +1621,15 @@ to { opacity: 1; transform: translateY(0);
}
}
.message-user[data-v-5eb7b895] {
align-items: flex-end;
}
/* avatar + 气泡行(上方) */
.message-row[data-v-5eb7b895] {
display: flex;
align-items: flex-start;
width: 100%;
}
.message-user .message-row[data-v-5eb7b895] {
flex-direction: row-reverse;
}
.chat-avatar[data-v-5eb7b895] {
@@ -1333,6 +1670,9 @@ to { opacity: 1; transform: translateY(0);
box-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.04);
background: #ffffff;
border: 0.03125rem solid #eeeef5;
/* 启用文本选择复制 */
user-select: text;
-webkit-user-select: text;
}
.chat-content-user[data-v-5eb7b895] {
background: linear-gradient(135deg, #c4b5fd, #b8a5f0);
@@ -1348,6 +1688,68 @@ to { opacity: 1; transform: translateY(0);
.chat-content[data-v-5eb7b895]:not(.chat-content-user) {
border-bottom-left-radius: 0.25rem;
}
/* 消息操作栏 */
.message-actions[data-v-5eb7b895] {
display: flex;
align-items: center;
justify-content: flex-end;
margin-top: 0.5rem;
padding-top: 0.375rem;
border-top: 0.03125rem solid rgba(0, 0, 0, 0.06);
gap: 0.75rem;
}
.message-actions-user[data-v-5eb7b895] {
justify-content: flex-start;
border-top-color: rgba(255, 255, 255, 0.3);
}
.message-action-item[data-v-5eb7b895] {
display: flex;
align-items: center;
gap: 0.1875rem;
padding: 0.25rem 0.5rem;
border-radius: 0.375rem;
transition: all 0.2s ease;
}
.message-action-item[data-v-5eb7b895]:active {
background: rgba(0, 0, 0, 0.05);
transform: scale(0.95);
}
.message-actions-user .message-action-item[data-v-5eb7b895]:active {
background: rgba(255, 255, 255, 0.2);
}
.action-text[data-v-5eb7b895] {
font-size: 0.6875rem;
color: #999;
}
.message-actions-user .action-text[data-v-5eb7b895] {
color: rgba(255, 255, 255, 0.8);
}
/* 消息转发弹窗 */
.msg-actions[data-v-5eb7b895] {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.3125rem;
}
.msg-actions-user[data-v-5eb7b895] {
justify-content: flex-end;
}
.msg-action-btn[data-v-5eb7b895] {
display: flex;
align-items: center;
gap: 0.1875rem;
padding: 0.125rem 0;
}
.msg-action-icon[data-v-5eb7b895] {
font-size: 0.8125rem;
}
.msg-action-label[data-v-5eb7b895] {
font-size: 0.6875rem;
color: #888;
}
.msg-action-forward[data-v-5eb7b895] {
margin-left: 0.25rem;
}
/* 图片消息 */
.message-image[data-v-5eb7b895] {
max-width: 9.375rem;
@@ -1399,6 +1801,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;
@@ -1709,45 +2187,57 @@ to { opacity: 1; transform: translateY(0);
/* 气泡内容字体:确保 v-html 渲染的 markdown 内容使用系统字体栈 */
.chat-content {
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans", "MiSans", "Source Han Sans CN", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif !important;
font-size: 16px !important;
font-weight: 600 !important;
line-height: 1.6;
margin: 0.25rem 0;
font-size: 0.9375rem !important;
line-height: 1.5rem !important;
margin: 0.25rem 0 !important;
/* 普通正文 */
/* 粗体和斜体样式 */
/* 气泡内的内联链接(替代 <a> 标签,点击由 JS 拦截处理) */
/* 可下载文件链接 → 按钮卡片样式 */
}
.chat-content h1 {
font-size: 1.3125rem;
line-height: 1.4;
margin: 0.5rem 0 0.3125rem;
font-size: 1.0625rem !important;
font-weight: 600 !important;
line-height: 1.75rem !important;
margin: 0.6875rem 0 0.4375rem !important;
}
.chat-content h2 {
font-size: 1.1875rem;
line-height: 1.4;
margin: 0.4375rem 0 0.25rem;
font-size: 1rem !important;
font-weight: 600 !important;
line-height: 1.625rem !important;
margin: 0.5625rem 0 0.3125rem !important;
}
.chat-content h3 {
font-size: 1.125rem;
line-height: 1.4;
margin: 0.375rem 0 0.25rem;
font-size: 0.9375rem !important;
font-weight: 600 !important;
line-height: 1.5rem !important;
margin: 0.4375rem 0 0.1875rem !important;
}
.chat-content h4 {
font-size: 0.875rem !important;
font-weight: 600 !important;
line-height: 1.5rem !important;
margin: 0.4375rem 0 0.1875rem !important;
}
.chat-content h5 {
font-size: 0.8125rem !important;
font-weight: 600 !important;
line-height: 1.375rem !important;
margin: 0.3125rem 0 0.125rem !important;
}
.chat-content h4,
.chat-content h5,
.chat-content h6 {
font-size: 1.0625rem;
line-height: 1.5;
margin: 0.3125rem 0 0.1875rem;
font-size: 0.75rem !important;
font-weight: 600 !important;
line-height: 1.25rem !important;
margin: 0.3125rem 0 0.125rem !important;
}
.chat-content p,
.chat-content uni-text,
.chat-content span {
font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans", "MiSans", "Source Han Sans CN", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif !important;
font-size: 1.1875rem !important;
font-weight: 400 !important;
line-height: 1.6;
margin: 0.25rem 0;
font-size: 0.9375rem !important;
line-height: 1.5rem !important;
margin: 0.25rem 0 !important;
}
.chat-content strong,
.chat-content b {
@@ -1968,3 +2458,168 @@ to {
color: #fff;
font-weight: 500;
}
/* ========== 转发消息弹窗 ========== */
.forward-modal-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: 1001;
display: flex;
align-items: center;
justify-content: center;
}
.forward-modal {
width: 85%;
max-height: 72%;
background-color: #fff;
border-radius: 0.75rem;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}
.forward-modal-header {
display: flex;
justify-content: center;
align-items: center;
position: relative;
padding: 0.875rem 0.9375rem 0.625rem;
border-bottom: 0.0625rem solid #f0f0f0;
}
.forward-modal-title {
font-size: 1.0625rem;
font-weight: 700;
color: #1a1a2e;
}
.forward-modal-close {
position: absolute;
right: 0.75rem;
top: 50%;
transform: translateY(-50%);
}
.forward-preview-box {
margin: 0.625rem 0.9375rem 0.25rem;
padding: 0.625rem 0.75rem;
background: #f7f8fc;
border-radius: 0.4375rem;
border-left: 0.1875rem solid #007aff;
flex-shrink: 0;
}
.forward-preview-label {
font-size: 0.75rem;
color: #999;
display: block;
margin-bottom: 0.25rem;
}
.forward-preview-text {
font-size: 0.875rem;
color: #333;
word-break: break-all;
max-height: 5rem;
overflow-y: auto;
line-height: 1.5;
}
.forward-select-label {
font-size: 0.8125rem;
color: #666;
padding: 0.375rem 0.9375rem 0.25rem;
display: block;
flex-shrink: 0;
}
.forward-conv-list {
flex: 1;
height: 0;
min-height: 15.625rem;
padding: 0 0.625rem;
box-sizing: border-box;
}
.forward-empty {
display: flex;
justify-content: center;
align-items: center;
height: 5rem;
color: #999;
font-size: 0.8125rem;
}
.forward-conv-item {
display: flex;
align-items: center;
padding: 0.6875rem 0.5rem;
border-radius: 0.5rem;
margin-bottom: 0.25rem;
background: #fafafa;
transition: background 0.2s;
}
.forward-conv-item:active {
background: #eef4ff;
}
.forward-conv-selected {
background: #e8f0fe;
border: 0.0625rem solid #007aff;
}
.forward-conv-avatar {
width: 1.875rem;
height: 1.875rem;
border-radius: 0.4375rem;
background: #e8f0fe;
display: flex;
align-items: center;
justify-content: center;
margin-right: 0.625rem;
flex-shrink: 0;
}
.forward-conv-info {
flex: 1;
min-width: 0;
}
.forward-conv-name {
font-size: 0.875rem;
color: #333;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.forward-conv-check {
flex-shrink: 0;
margin-left: 0.375rem;
}
.forward-modal-footer {
padding: 0.625rem 0.9375rem 0.9375rem;
border-top: 0.0625rem solid #f0f0f0;
display: flex;
justify-content: flex-end;
gap: 0.625rem;
flex-shrink: 0;
}
.forward-modal-btn {
padding: 0.5625rem 1.5rem;
border-radius: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
}
.forward-btn-cancel {
background: #f0f0f0;
color: #666;
}
.forward-btn-cancel:active {
background: #e0e0e0;
}
.forward-btn-confirm {
background: #007aff;
color: #fff;
}
.forward-btn-confirm:active {
background: #005fcc;
}
.forward-btn-disabled {
background: #b0d0f0;
color: #fff;
pointer-events: none;
}

View File

@@ -1096,6 +1096,331 @@ to { opacity: 1; transform: translateY(0) scale(1);
.ncd-intelligence .ncd-opt-icon[data-v-fdf84df1] {
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
/* ========== 智能体选择弹窗 ========== */
.agent-modal-mask[data-v-fdf84df1] {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
}
.agent-modal[data-v-fdf84df1] {
width: 85%;
max-height: 70%;
background-color: #ffffff;
border-radius: 0.75rem;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}
.agent-modal-header[data-v-fdf84df1] {
display: flex;
justify-content: center;
align-items: center;
padding: 0.9375rem 0.9375rem 0.625rem;
position: relative;
border-bottom: 0.0625rem solid #f0f0f0;
}
.agent-modal-title[data-v-fdf84df1] {
font-size: 1.0625rem;
font-weight: 700;
color: #1a1a2e;
}
.agent-modal-close[data-v-fdf84df1] {
position: absolute;
right: 0.75rem;
top: 50%;
transform: translateY(-50%);
padding: 0.3125rem;
}
.agent-list[data-v-fdf84df1] {
box-sizing: border-box;
flex: 1;
padding: 0.625rem 0.75rem;
max-height: 18.75rem;
}
.agent-loading[data-v-fdf84df1] {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1.875rem 0;
}
.agent-loading-text[data-v-fdf84df1] {
margin-top: 0.5rem;
font-size: 0.8125rem;
color: #999;
}
.agent-empty[data-v-fdf84df1] {
display: flex;
align-items: center;
justify-content: center;
padding: 2.5rem 0;
}
.agent-empty-text[data-v-fdf84df1] {
font-size: 0.875rem;
color: #999;
}
.agent-card[data-v-fdf84df1] {
box-sizing: border-box;
width: 100%;
background: linear-gradient(135deg, #f8f5ff, #efe8ff);
border: 0.0625rem solid #c4b5fd;
border-radius: 0.625rem;
padding: 0.875rem 0.75rem;
margin-bottom: 0.625rem;
transition: all 0.2s ease;
overflow: hidden;
}
.agent-card[data-v-fdf84df1]:active {
transform: scale(0.98);
border-color: #a78bfa;
background: linear-gradient(135deg, #f3efff, #e8dcff);
}
.agent-card-header[data-v-fdf84df1] {
display: flex;
align-items: center;
margin-bottom: 0.5rem;
}
.agent-avatar[data-v-fdf84df1] {
width: 2.1875rem;
height: 2.1875rem;
border-radius: 0.625rem;
background: linear-gradient(135deg, #8b5cf6, #7c3aed);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.agent-card-info[data-v-fdf84df1] {
margin-left: 0.5rem;
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
}
.agent-card-title[data-v-fdf84df1] {
font-size: 0.9375rem;
font-weight: 600;
color: #1a1a2e;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.agent-card-category[data-v-fdf84df1] {
font-size: 0.6875rem;
color: #8b5cf6;
margin-top: 0.125rem;
}
.agent-card-desc[data-v-fdf84df1] {
font-size: 0.8125rem;
color: #555;
line-height: 1.5;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
overflow: hidden;
}
.agent-card-welcome[data-v-fdf84df1] {
font-size: 0.75rem;
color: #7c3aed;
margin-top: 0.375rem;
padding-top: 0.375rem;
border-top: 0.0625rem dashed #ddd6fe;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.agent-modal-footer[data-v-fdf84df1] {
padding: 0.625rem 0.9375rem 0.9375rem;
border-top: 0.0625rem solid #f0f0f0;
display: flex;
justify-content: flex-end;
}
.agent-modal-btn[data-v-fdf84df1] {
padding: 0.5625rem 1.5rem;
border-radius: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
}
.agent-modal-btn-cancel[data-v-fdf84df1] {
background: #f0f0f0;
color: #666;
}
.agent-modal-btn-cancel[data-v-fdf84df1]:active {
background: #e0e0e0;
}
/* ========== 转发消息弹窗 ========== */
.forward-modal-mask[data-v-fdf84df1] {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.45);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: 1001;
display: flex;
align-items: center;
justify-content: center;
}
.forward-modal[data-v-fdf84df1] {
width: 85%;
max-height: 72%;
background-color: #fff;
border-radius: 0.75rem;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}
.forward-modal-header[data-v-fdf84df1] {
display: flex;
justify-content: center;
align-items: center;
position: relative;
padding: 0.875rem 0.9375rem 0.625rem;
border-bottom: 0.0625rem solid #f0f0f0;
}
.forward-modal-title[data-v-fdf84df1] {
font-size: 1.0625rem;
font-weight: 700;
color: #1a1a2e;
}
.forward-modal-close[data-v-fdf84df1] {
position: absolute;
right: 0.75rem;
top: 50%;
transform: translateY(-50%);
}
.forward-preview-box[data-v-fdf84df1] {
margin: 0.625rem 0.9375rem 0.25rem;
padding: 0.625rem 0.75rem;
background: #f7f8fc;
border-radius: 0.4375rem;
border-left: 0.1875rem solid #007aff;
}
.forward-preview-label[data-v-fdf84df1] {
font-size: 0.75rem;
color: #999;
display: block;
margin-bottom: 0.25rem;
}
.forward-preview-text[data-v-fdf84df1] {
font-size: 0.875rem;
color: #333;
word-break: break-all;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
.forward-select-label[data-v-fdf84df1] {
font-size: 0.8125rem;
color: #666;
padding: 0.375rem 0.9375rem 0.25rem;
display: block;
}
.forward-conv-list[data-v-fdf84df1] {
flex: 1;
max-height: 12.5rem;
padding: 0 0.625rem;
}
.forward-empty[data-v-fdf84df1] {
display: flex;
justify-content: center;
align-items: center;
height: 5rem;
color: #999;
font-size: 0.8125rem;
}
.forward-conv-item[data-v-fdf84df1] {
display: flex;
align-items: center;
padding: 0.6875rem 0.5rem;
border-radius: 0.5rem;
margin-bottom: 0.25rem;
background: #fafafa;
transition: background 0.2s;
}
.forward-conv-item[data-v-fdf84df1]:active {
background: #eef4ff;
}
.forward-conv-selected[data-v-fdf84df1] {
background: #e8f0fe;
border: 0.0625rem solid #007aff;
}
.forward-conv-avatar[data-v-fdf84df1] {
width: 1.875rem;
height: 1.875rem;
border-radius: 0.4375rem;
background: #e8f0fe;
display: flex;
align-items: center;
justify-content: center;
margin-right: 0.625rem;
flex-shrink: 0;
}
.forward-conv-info[data-v-fdf84df1] {
flex: 1;
min-width: 0;
}
.forward-conv-name[data-v-fdf84df1] {
font-size: 0.875rem;
color: #333;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.forward-conv-check[data-v-fdf84df1] {
flex-shrink: 0;
margin-left: 0.375rem;
}
.forward-modal-footer[data-v-fdf84df1] {
padding: 0.625rem 0.9375rem 0.9375rem;
border-top: 0.0625rem solid #f0f0f0;
display: flex;
justify-content: flex-end;
gap: 0.625rem;
}
.forward-modal-btn[data-v-fdf84df1] {
padding: 0.5625rem 1.5rem;
border-radius: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
}
.forward-btn-cancel[data-v-fdf84df1] {
background: #f0f0f0;
color: #666;
}
.forward-btn-cancel[data-v-fdf84df1]:active {
background: #e0e0e0;
}
.forward-btn-confirm[data-v-fdf84df1] {
background: #007aff;
color: #fff;
}
.forward-btn-confirm[data-v-fdf84df1]:active {
background: #005fcc;
}
.forward-btn-disabled[data-v-fdf84df1] {
background: #b0d0f0;
color: #fff;
pointer-events: none;
}
/* ==========新建聊天列表相关====== */
.close-option-card[data-v-fdf84df1] {
width: 100%;
@@ -1188,6 +1513,9 @@ to { opacity: 1; transform: translateY(0) scale(1);
.head-btn .iconfont[data-v-fdf84df1] {
font-size: 1.5rem;
}
.chat-btn-group .head-btn[data-v-fdf84df1]:nth-child(4) {
/* 刷新按钮 */
}
.log-out[data-v-fdf84df1] {
/* background: #ffd4d4; */
}
@@ -1281,7 +1609,7 @@ to { opacity: 1; transform: translateY(0) scale(1);
}
.chat-message[data-v-fdf84df1] {
display: flex;
align-items: flex-start;
flex-direction: column;
margin: 0.4375rem 0;
box-sizing: border-box;
animation: msgFadeIn-fdf84df1 0.3s ease;
@@ -1293,6 +1621,15 @@ to { opacity: 1; transform: translateY(0);
}
}
.message-user[data-v-fdf84df1] {
align-items: flex-end;
}
/* avatar + 气泡行(上方) */
.message-row[data-v-fdf84df1] {
display: flex;
align-items: flex-start;
width: 100%;
}
.message-user .message-row[data-v-fdf84df1] {
flex-direction: row-reverse;
}
.chat-avatar[data-v-fdf84df1] {
@@ -1333,6 +1670,9 @@ to { opacity: 1; transform: translateY(0);
box-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.04);
background: #ffffff;
border: 0.03125rem solid #eeeef5;
/* 启用文本选择复制 */
user-select: text;
-webkit-user-select: text;
}
.chat-content-user[data-v-fdf84df1] {
background: linear-gradient(135deg, #c4b5fd, #b8a5f0);
@@ -1348,6 +1688,68 @@ to { opacity: 1; transform: translateY(0);
.chat-content[data-v-fdf84df1]:not(.chat-content-user) {
border-bottom-left-radius: 0.25rem;
}
/* 消息操作栏 */
.message-actions[data-v-fdf84df1] {
display: flex;
align-items: center;
justify-content: flex-end;
margin-top: 0.5rem;
padding-top: 0.375rem;
border-top: 0.03125rem solid rgba(0, 0, 0, 0.06);
gap: 0.75rem;
}
.message-actions-user[data-v-fdf84df1] {
justify-content: flex-start;
border-top-color: rgba(255, 255, 255, 0.3);
}
.message-action-item[data-v-fdf84df1] {
display: flex;
align-items: center;
gap: 0.1875rem;
padding: 0.25rem 0.5rem;
border-radius: 0.375rem;
transition: all 0.2s ease;
}
.message-action-item[data-v-fdf84df1]:active {
background: rgba(0, 0, 0, 0.05);
transform: scale(0.95);
}
.message-actions-user .message-action-item[data-v-fdf84df1]:active {
background: rgba(255, 255, 255, 0.2);
}
.action-text[data-v-fdf84df1] {
font-size: 0.6875rem;
color: #999;
}
.message-actions-user .action-text[data-v-fdf84df1] {
color: rgba(255, 255, 255, 0.8);
}
/* 消息转发弹窗 */
.msg-actions[data-v-fdf84df1] {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.3125rem;
}
.msg-actions-user[data-v-fdf84df1] {
justify-content: flex-end;
}
.msg-action-btn[data-v-fdf84df1] {
display: flex;
align-items: center;
gap: 0.1875rem;
padding: 0.125rem 0;
}
.msg-action-icon[data-v-fdf84df1] {
font-size: 0.8125rem;
}
.msg-action-label[data-v-fdf84df1] {
font-size: 0.6875rem;
color: #888;
}
.msg-action-forward[data-v-fdf84df1] {
margin-left: 0.25rem;
}
/* 图片消息 */
.message-image[data-v-fdf84df1] {
max-width: 9.375rem;
@@ -1399,6 +1801,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;

View File

@@ -54,6 +54,18 @@
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe6ea;</span>
<div class="name">转发</div>
<div class="code-name">&amp;#xe6ea;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6fc;</span>
<div class="name">复制</div>
<div class="code-name">&amp;#xe6fc;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe695;</span>
<div class="name">代码</div>
@@ -480,9 +492,9 @@
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1783330740989') format('woff2'),
url('iconfont.woff?t=1783330740989') format('woff'),
url('iconfont.ttf?t=1783330740989') format('truetype');
src: url('iconfont.woff2?t=1786091687579') format('woff2'),
url('iconfont.woff?t=1786091687579') format('woff'),
url('iconfont.ttf?t=1786091687579') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -508,6 +520,24 @@
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-zhuanfa_3"></span>
<div class="name">
转发
</div>
<div class="code-name">.icon-zhuanfa_3
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-fuzhi1"></span>
<div class="name">
复制
</div>
<div class="code-name">.icon-fuzhi1
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-daima"></span>
<div class="name">
@@ -1147,6 +1177,22 @@
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhuanfa_3"></use>
</svg>
<div class="name">转发</div>
<div class="code-name">#icon-zhuanfa_3</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-fuzhi1"></use>
</svg>
<div class="name">复制</div>
<div class="code-name">#icon-fuzhi1</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-daima"></use>

View File

@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 4890805 */
src: url('iconfont.woff2?t=1783330740989') format('woff2'),
url('iconfont.woff?t=1783330740989') format('woff'),
url('iconfont.ttf?t=1783330740989') format('truetype');
src: url('iconfont.woff2?t=1786091687579') format('woff2'),
url('iconfont.woff?t=1786091687579') format('woff'),
url('iconfont.ttf?t=1786091687579') format('truetype');
}
.iconfont {
@@ -13,6 +13,14 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-zhuanfa_3:before {
content: "\e6ea";
}
.icon-fuzhi1:before {
content: "\e6fc";
}
.icon-daima:before {
content: "\e695";
}

File diff suppressed because one or more lines are too long

View File

@@ -5,6 +5,20 @@
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "16322565",
"name": "转发",
"font_class": "zhuanfa_3",
"unicode": "e6ea",
"unicode_decimal": 59114
},
{
"icon_id": "16322894",
"name": "复制",
"font_class": "fuzhi1",
"unicode": "e6fc",
"unicode_decimal": 59132
},
{
"icon_id": "1767709",
"name": "代码",

View File

@@ -29,7 +29,11 @@ export const login = async (username, password) => {
}
} else {
if (String(res.statusCode).startsWith('5')) {
reject({ serverError: true, code: res.statusCode, message: '服务器升级中,请稍后再试' })
reject({
serverError: true,
code: res.statusCode,
message: '服务器升级中,请稍后再试'
})
} else {
reject(`请求失败:${res.statusCode}`)
}
@@ -73,15 +77,16 @@ export const getUserConversations = async (token) => {
}
// 获取与AI的对话内容
export const getConversationMessages = async (token, conversatio_id) => {
export const getConversationMessages = async (token, conversation_id, size, page_number) => {
return new Promise((resolve, reject) => {
uni.request({
url: `${BASE_URL}/get_conversation_messages`,
method: 'POST',
data: {
"access_token": token,
"login_type": "phone",
"conversation_id": conversatio_id
"conversation_id": conversation_id,
"size": 20,
"current": page_number
},
header: {
'Content-Type': 'application/json'
@@ -90,14 +95,15 @@ export const getConversationMessages = async (token, conversatio_id) => {
if (res.statusCode === 200) {
const messagesInfo = res.data
if (messagesInfo) {
// console.log("返回数据为",messagesInfo);
console.log("工作区id为", messagesInfo.workspace_id || '(无)');
if (messagesInfo.workspace_id) {
uni.setStorageSync('workspace_id', messagesInfo.workspace_id)
}
const filtered = (messagesInfo.messages || []).filter(
m => m.role !== 'tool'
)
resolve(filtered)
m => m.role !== 'tool' || m.yxd_tool_name === 'sendFrom'
)
resolve(filtered)
} else {
const msg = res.data.error || '获取消息出错啦'
reject(msg)
@@ -556,9 +562,9 @@ export const workspaceUploadFileByURL = (token, workspacesId, urls, dirPath) =>
const failedItems = (respond.results || [])
.filter(r => !r.success)
.map(r => r.error || '未知错误');
const msg = failedItems.length > 0
? `上传失败 ${respond.failed_count}/${respond.total_files}${failedItems[0]}`
: (respond.summary || respond?.error || '上传文件到工作区出错啦');
const msg = failedItems.length > 0 ?
`上传失败 ${respond.failed_count}/${respond.total_files}${failedItems[0]}` :
(respond.summary || respond?.error || '上传文件到工作区出错啦');
reject(msg);
}
} else {
@@ -585,14 +591,19 @@ export const uploadFileToShortStorage = (workspacesId, files, filePath) => {
// 构建 files 数组供 uni.uploadFile 使用
const uploadFiles = fileList.map((file) => {
const fileUri = typeof file === 'string' ? file : (file.tempFilePath || file.path || file);
const fileUri = typeof file === 'string' ? file : (file.tempFilePath || file.path ||
file);
return {
name: 'files',
uri: fileUri
};
});
console.log('uploadFileToShortStorage 参数:', { workspacesId, fileCount: uploadFiles.length, filePath });
console.log('uploadFileToShortStorage 参数:', {
workspacesId,
fileCount: uploadFiles.length,
filePath
});
uni.uploadFile({
url: `${BASE_URL}/cloud_api/file/temp/upload`,
@@ -614,9 +625,13 @@ export const uploadFileToShortStorage = (workspacesId, files, filePath) => {
resolve(respond);
} else if (respond.success) {
// 兼容 { success: true, url: "..." } 格式
resolve([{ url: respond.url || respond.message, success: true }]);
resolve([{
url: respond.url || respond.message,
success: true
}]);
} else {
const msg = respond?.error || respond?.message || '上传文件到短存云端获取URL出错啦';
const msg = respond?.error || respond?.message ||
'上传文件到短存云端获取URL出错啦';
reject(msg);
}
} catch (e) {
@@ -1718,3 +1733,80 @@ export const conversationMessageDownload = (token, workspacesId, localUrl) => {
});
});
};
// 智能体
// 获取智能体列表
export const getAgentList = (token) => {
return new Promise((resolve, reject) => {
uni.request({
url: `${BASE_URL}/cloud_api/agent/list`,
method: "POST",
header: {
'Content-Type': 'application/json'
},
data: {
"access_token": token
},
success: (res) => {
if (res.statusCode === 200) {
const respond = res.data;
if (respond.success) {
resolve(respond.data)
} else {
const msg = '获取智能体列表出错啦';
reject(msg);
}
} else {
reject(`获取智能体列表失败:${res.statusCode}`)
}
},
fail: (err) => {
const msg = err.errMsg || '网络错误';
reject(msg);
}
})
})
}
// 创建智能体会话
export const addConversationAgent = (token, agent_id) => {
return new Promise((resolve, reject) => {
uni.request({
url: `${BASE_URL}/cloud_api/phone/conversation/agent/add`,
method: "POST",
header: {
"Content-Type": "application/json"
},
data: {
"access_token": token,
"agent_id": agent_id
},
success: (res) => {
if (res.statusCode === 200) {
const respond = res.data
// 返回格式: { success: true, title: "...", conversation_id: "...", workspace_id: "..." }
if (respond?.success && respond?.conversation_id) {
// // 保存 workspace_id 到本地存储
// if (respond.workspace_id) {
// uni.setStorageSync('workspace_id', respond.workspace_id)
// }
resolve({
conversation_id: respond.conversation_id,
workspace_id: respond.workspace_id,
title: respond.title || ''
})
} else {
const msg = respond?.error || '创建智能体会话出错啦'
reject(msg)
}
} else {
reject(`创建智能体会话失败:${res.statusCode}`)
}
},
fail: (err) => {
const msg = err.errMsg || '网络错误'
reject(msg)
}
})
})
}

View File

@@ -84,7 +84,7 @@ export const getGroup = async (sendId) => {
}
// 获取与好友的对话内容
export const getFriendMessages = async (sessionId, current = 1) => {
export const getFriendMessages = async (sessionId, size, current = 1) => {
console.log('请求的好友消息id', sessionId);
return new Promise((resolve, reject) => {
uni.request({
@@ -92,7 +92,7 @@ export const getFriendMessages = async (sessionId, current = 1) => {
method: 'POST',
data: {
"sessionId": sessionId,
"size": 100,
"size": size,
"current": current,
"beginTime": "",
"endTime": ""
@@ -130,7 +130,7 @@ export const getFriendMessages = async (sessionId, current = 1) => {
// 获取群聊的对话内容
export const getGroupMessages = async (groupId, current = 1) => {
export const getGroupMessages = async (groupId, size, current = 1) => {
console.log('请求的群聊消息id', groupId);
return new Promise((resolve, reject) => {
uni.request({
@@ -138,7 +138,7 @@ export const getGroupMessages = async (groupId, current = 1) => {
method: 'POST',
data: {
"current": current,
"size": 100,
"size": size,
"groupId": groupId,
"beginTime": "",
"endTime": ""