<template>
|
<!-- 整体容器添加相对定位 -->
|
<div class="container-wrapper" ref="containerRef">
|
<!-- 折叠按钮 -->
|
<div
|
class="sidebar-toggle"
|
:style="{ left: toggleLeft }"
|
@click.stop="toggleSidebar"
|
ref="toggleRef">
|
<Icon :icon="isCollapsed ? 'ep:caret-right' : 'ep:caret-left'" />
|
</div>
|
|
<!-- 左侧对话列表 -->
|
<div
|
class="conversation-wrapper"
|
:class="{ collapsed: isCollapsed }"
|
:style="{ width: sidebarWidth }"
|
ref="sidebarRef">
|
<ConversationList
|
:active-id="activeConversationId"
|
:quick-access="quickAccessFlag"
|
:model-name="modelName"
|
:default-message="defaultMessage"
|
ref="conversationListRef"
|
@on-conversation-create="handleConversationCreateSuccess"
|
@on-conversation-click="handleConversationClick"
|
@on-conversation-clear="handleConversationClear"
|
@on-conversation-delete="handlerConversationDelete"
|
/>
|
</div>
|
<!-- 右侧:对话详情 -->
|
<el-container class="detail-container">
|
<el-header class="header">
|
<div class="title">
|
{{ activeConversation?.title ? activeConversation?.title : '对话' }}
|
<span v-if="activeMessageList.length">({{ activeMessageList.length }})</span>
|
</div>
|
<div class="btns" v-if="activeConversation">
|
<el-button type="primary" bg plain size="small" @click="openChatConversationUpdateForm">
|
<span v-html="activeConversation?.modelName"></span>
|
<Icon icon="ep:setting" class="ml-10px" />
|
</el-button>
|
<el-button size="small" class="btn" @click="handlerMessageClear">
|
<Icon icon="heroicons-outline:archive-box-x-mark" color="#73C4FF" />
|
</el-button>
|
<el-button size="small" class="btn" @click="handleGoBottomMessage">
|
<Icon icon="ep:download" color="#73C4FF" />
|
</el-button>
|
<el-button size="small" class="btn" @click="handleGoTopMessage">
|
<Icon icon="ep:top" color="#73C4FF" />
|
</el-button>
|
</div>
|
</el-header>
|
|
<!-- main:消息列表 -->
|
<el-main class="main-container">
|
<div class="message-container">
|
<!-- 情况一:消息加载中 -->
|
<MessageLoading v-if="activeMessageListLoading" />
|
<!-- 情况二:无聊天对话时 -->
|
<MessageListEmpty
|
v-if="!activeConversation"
|
/>
|
<!-- 情况三:消息列表为空 -->
|
<MessageListEmpty
|
v-if="!activeMessageListLoading && messageList.length === 0 && activeConversation"
|
@on-prompt="doSendMessage"
|
/>
|
<!-- 情况四:消息列表不为空 -->
|
<MessageList
|
v-if="!activeMessageListLoading && messageList.length > 0"
|
ref="messageRef"
|
:conversation="activeConversation"
|
:list="messageList"
|
@on-delete-success="handleMessageDelete"
|
@on-edit="handleMessageEdit"
|
@on-refresh="handleMessageRefresh"
|
/>
|
</div>
|
</el-main>
|
|
<!-- 底部 -->
|
<el-footer class="footer-container">
|
<!-- 输入框 -->
|
<div class="input-container">
|
<form class="prompt-from">
|
<textarea
|
class="prompt-input"
|
v-model="prompt"
|
@keydown="handleSendByKeydown"
|
@input="handlePromptInput"
|
@compositionstart="onCompositionstart"
|
@compositionend="onCompositionend"
|
placeholder="请问我问题...(Shift+Enter 换行,按下 Enter 发送)"
|
></textarea>
|
<div class="prompt-btns">
|
<div class="content">
|
<el-button
|
:class="{ 'active-button': enableContext }"
|
@click="enableContext = !enableContext"
|
>
|
<el-icon class="content-icon" />
|
上下文
|
</el-button>
|
</div>
|
<div class="message">
|
<el-button
|
type="primary"
|
size="default"
|
@click="handleSendByButton"
|
:loading="conversationInProgress"
|
v-if="conversationInProgress == false"
|
>
|
{{ conversationInProgress ? '进行中' : '发消息' }}
|
</el-button>
|
<el-button
|
type="danger"
|
size="default"
|
@click="stopStream()"
|
v-if="conversationInProgress == true"
|
>
|
停止
|
</el-button>
|
</div>
|
</div>
|
</form>
|
</div>
|
</el-footer>
|
</el-container>
|
</div>
|
<!-- 更新对话 Form -->
|
<ConversationUpdateForm
|
ref="conversationUpdateFormRef"
|
@success="handleConversationUpdateSuccess"
|
/>
|
</template>
|
|
<script setup lang="ts">
|
import { ChatMessageApi, ChatMessageVO } from '@/api/ai/chat/message'
|
import { ChatConversationApi, ChatConversationVO } from '@/api/ai/chat/conversation'
|
import ConversationList from './CommonConversationList.vue'
|
import ConversationUpdateForm from './CommonConversationUpdateForm.vue'
|
import MessageList from '../message/MessageList.vue'
|
import MessageListEmpty from '../message/MessageListEmpty.vue'
|
import MessageLoading from '../message/MessageLoading.vue'
|
import { onClickOutside } from '@vueuse/core'
|
import * as authUtil from "@/utils/auth";
|
import {refreshToken} from "@/api/login";
|
import {formatToDateTime} from "@/utils/dateUtil";
|
import { formatReasoningContent } from '@/views/ai/utils/utils'
|
|
/** AI 聊天对话 列表 */
|
defineOptions({ name: 'NormalConversation' })
|
|
const props = defineProps({
|
data: {
|
type: Object,
|
default: () => null
|
}
|
})
|
|
const route = useRoute() // 路由
|
const message = useMessage() // 消息弹窗
|
|
const isCollapsed = ref(true)
|
const sidebarWidth = ref('270px')
|
const toggleLeft = computed(() => isCollapsed.value ? '0' : sidebarWidth.value)
|
|
// 新增DOM引用用于会话列表的展开和收缩
|
const containerRef = ref<HTMLElement>()
|
const sidebarRef = ref<HTMLElement>()
|
const toggleRef = ref<HTMLElement>()
|
|
// 点击外部区域处理
|
onClickOutside(sidebarRef, (event) => {
|
if (!isCollapsed.value &&
|
!sidebarRef.value?.contains(event.target) &&
|
!toggleRef.value?.contains(event.target)) {
|
isCollapsed.value = true
|
}
|
})
|
|
// 切换侧边栏
|
const toggleSidebar = () => {
|
isCollapsed.value = !isCollapsed.value
|
}
|
|
const modelName = ref<string>('common') // 对话搜索
|
|
// 聊天对话
|
const conversationListRef = ref()
|
const quickAccessFlag = ref(false)
|
const defaultMessage = ref<ChatMessageVO>()
|
const activeConversationId = ref<number | null>(null) // 选中的对话编号
|
const activeConversation = ref<ChatConversationVO | null>(null) // 选中的 Conversation
|
const conversationInProgress = ref(false) // 对话是否正在进行中。目前只有【发送】消息时,会更新为 true,避免切换对话、删除对话等操作
|
|
// 消息列表
|
const messageRef = ref()
|
const activeMessageList = ref<ChatMessageVO[]>([]) // 选中对话的消息列表
|
const activeMessageListLoading = ref<boolean>(false) // activeMessageList 是否正在加载中
|
const activeMessageListLoadingTimer = ref<any>() // activeMessageListLoading Timer 定时器。如果加载速度很快,就不进入加载中
|
// 消息滚动
|
const textSpeed = ref<number>(50) // Typing speed in milliseconds
|
const textRoleRunning = ref<boolean>(false) // Typing speed in milliseconds
|
|
// 发送消息输入框
|
const isComposing = ref(false) // 判断用户是否在输入
|
const conversationInAbortController = ref<any>() // 对话进行中 abort 控制器(控制 stream 对话)
|
const inputTimeout = ref<any>() // 处理输入中回车的定时器
|
const prompt = ref<string>() // prompt
|
const enableContext = ref<boolean>(true) // 是否开启上下文
|
// 接收 Stream 消息
|
const receiveMessageFullText = ref('')
|
const receiveMessageDisplayedText = ref('')
|
|
// =========== 【聊天对话】相关 ===========
|
|
/** 获取对话信息 */
|
const getConversation = async (id: number | null) => {
|
if (!id) {
|
return
|
}
|
const conversation: ChatConversationVO = await ChatConversationApi.getChatConversationMy(id)
|
if (!conversation) {
|
return
|
}
|
activeConversation.value = conversation
|
activeConversationId.value = conversation.id
|
}
|
|
/**
|
* 点击某个对话
|
*
|
* @param conversation 选中的对话
|
* @return 是否切换成功
|
*/
|
const handleConversationClick = async (conversation: ChatConversationVO) => {
|
// 对话进行中,不允许切换
|
if (conversationInProgress.value) {
|
message.alert('对话中,不允许切换!')
|
return false
|
}
|
|
// 更新选中的对话 id
|
activeConversationId.value = conversation.id
|
activeConversation.value = conversation
|
// 刷新 message 列表
|
await getMessageList()
|
// 滚动底部
|
scrollToBottom(true)
|
// 清空输入框
|
prompt.value = ''
|
return true
|
}
|
|
/** 删除某个对话*/
|
const handlerConversationDelete = async (delConversation: ChatConversationVO) => {
|
// 删除的对话如果是当前选中的,那么就重置
|
if (activeConversationId.value === delConversation.id) {
|
await handleConversationClear()
|
}
|
}
|
/** 清空选中的对话 */
|
const handleConversationClear = async () => {
|
// 对话进行中,不允许切换
|
if (conversationInProgress.value) {
|
message.alert('对话中,不允许切换!')
|
return false
|
}
|
activeConversationId.value = null
|
activeConversation.value = null
|
activeMessageList.value = []
|
}
|
|
/** 修改聊天对话 */
|
const conversationUpdateFormRef = ref()
|
const openChatConversationUpdateForm = async () => {
|
conversationUpdateFormRef.value.open(activeConversationId.value)
|
}
|
const handleConversationUpdateSuccess = async () => {
|
// 对话更新成功,刷新最新信息
|
await getConversation(activeConversationId.value)
|
}
|
|
/** 处理聊天对话的创建成功 */
|
const handleConversationCreate = async () => {
|
// 创建对话
|
await conversationListRef.value.createConversation()
|
}
|
/** 处理聊天对话的创建成功 */
|
const handleConversationCreateSuccess = async () => {
|
// 创建新的对话,清空输入框
|
prompt.value = ''
|
}
|
|
// =========== 【消息列表】相关 ===========
|
|
/** 获取消息 message 列表 */
|
const getMessageList = async () => {
|
try {
|
if (activeConversationId.value === null) {
|
return
|
}
|
// Timer 定时器,如果加载速度很快,就不进入加载中
|
activeMessageListLoadingTimer.value = setTimeout(() => {
|
activeMessageListLoading.value = true
|
}, 60)
|
|
// 获取消息列表
|
activeMessageList.value = await ChatMessageApi.getChatMessageListByConversationId(
|
activeConversationId.value
|
)
|
// 滚动到最下面
|
await nextTick()
|
await scrollToBottom()
|
} finally {
|
// time 定时器,如果加载速度很快,就不进入加载中
|
if (activeMessageListLoadingTimer.value) {
|
clearTimeout(activeMessageListLoadingTimer.value)
|
}
|
// 加载结束
|
activeMessageListLoading.value = false
|
}
|
}
|
|
/**
|
* 消息列表
|
*
|
* 和 {@link #getMessageList()} 的差异是,把 systemMessage 考虑进去
|
*/
|
const messageList = computed(() => {
|
if (activeMessageList.value.length > 0) {
|
dealResult(activeMessageList.value)
|
return activeMessageList.value
|
}
|
// 没有消息时,如果有 systemMessage 则展示它
|
if (activeConversation.value?.systemMessage) {
|
return [
|
{
|
id: 0,
|
type: 'system',
|
content: activeConversation.value.systemMessage
|
}
|
]
|
}
|
return []
|
})
|
|
//处理调度推理结论(微调大模型)
|
const dealResult = (messages: any) => {
|
messages.forEach((message) => {
|
if(message.type === 'assistant') {
|
const spliceText = message.content.includes("总结:") ? "总结:" : "结论:";
|
// 创建同时捕获前后内容的正则表达式
|
const regex = new RegExp(`^([\\s\\S]*?)${spliceText}([\\s\\S]*)$`);
|
const match = message.content.match(regex);
|
if(match) {
|
message.thinking = match[1];
|
message.conclusion = match[2]
|
} else {
|
message.thinking = message.content
|
}
|
// 处理推理思路内容
|
message.thinking = formatReasoningContent(message.thinking);
|
}
|
})
|
}
|
|
/** 处理删除 message 消息 */
|
const handleMessageDelete = () => {
|
if (conversationInProgress.value) {
|
message.alert('回答中,不能删除!')
|
return
|
}
|
// 刷新 message 列表
|
getMessageList()
|
}
|
|
/** 处理 message 清空 */
|
const handlerMessageClear = async () => {
|
if (!activeConversationId.value) {
|
return
|
}
|
try {
|
// 确认提示
|
await message.delConfirm('确认清空对话消息?')
|
// 清空对话
|
await ChatMessageApi.deleteByConversationId(activeConversationId.value)
|
// 刷新 message 列表
|
activeMessageList.value = []
|
} catch {}
|
}
|
|
/** 回到 message 列表的顶部 */
|
const handleGoTopMessage = () => {
|
messageRef.value.handlerGoTop()
|
}
|
|
/** 回到 message 列表的底部 */
|
const handleGoBottomMessage = () => {
|
messageRef.value.handleGoBottom()
|
}
|
|
// =========== 【发送消息】相关 ===========
|
|
/** 处理来自 keydown 的发送消息 */
|
const handleSendByKeydown = async (event) => {
|
// 判断用户是否在输入
|
if (isComposing.value) {
|
return
|
}
|
// 进行中不允许发送
|
if (conversationInProgress.value) {
|
return
|
}
|
const content = prompt.value?.trim() as string
|
if (event.key === 'Enter') {
|
if (event.shiftKey) {
|
// 插入换行
|
prompt.value += '\r\n'
|
event.preventDefault() // 防止默认的换行行为
|
} else {
|
// 发送消息
|
await doSendMessage(content)
|
event.preventDefault() // 防止默认的提交行为
|
}
|
}
|
}
|
|
/** 处理来自【发送】按钮的发送消息 */
|
const handleSendByButton = () => {
|
doSendMessage(prompt.value?.trim() as string)
|
}
|
|
/** 处理 prompt 输入变化 */
|
const handlePromptInput = (event) => {
|
// 非输入法 输入设置为 true
|
if (!isComposing.value) {
|
// 回车 event data 是 null
|
if (event.data == null) {
|
return
|
}
|
isComposing.value = true
|
}
|
// 清理定时器
|
if (inputTimeout.value) {
|
clearTimeout(inputTimeout.value)
|
}
|
// 重置定时器
|
inputTimeout.value = setTimeout(() => {
|
isComposing.value = false
|
}, 400)
|
}
|
// TODO @芋艿:是不是可以通过 @keydown.enter、@keydown.shift.enter 来实现,回车发送、shift+回车换行;主要看看,是不是可以简化 isComposing 相关的逻辑
|
const onCompositionstart = () => {
|
isComposing.value = true
|
}
|
const onCompositionend = () => {
|
// console.log('输入结束...')
|
setTimeout(() => {
|
isComposing.value = false
|
}, 200)
|
}
|
|
/** 真正执行【发送】消息操作 */
|
const doSendMessage = async (content: string) => {
|
// 校验
|
if (content.length < 1) {
|
message.error('发送失败,原因:内容为空!')
|
return
|
}
|
// 发送请求时如果accessToken过期,无法中断请求,暂时增加请求前刷新token
|
authUtil.setToken(await refreshToken())
|
if (activeConversationId.value == null) {
|
await conversationListRef.value.createConversation(props.data?formatToDateTime(new Date(props.data.createTime)):null)
|
}
|
// 清空输入框
|
prompt.value = ''
|
setTimeout(() => {
|
// 执行发送
|
doSendMessageStream({
|
conversationId: activeConversationId.value,
|
content: content
|
} as ChatMessageVO)
|
}, 400)
|
}
|
|
/** 真正执行【发送】消息操作 */
|
const doSendMessageStream = async (userMessage: ChatMessageVO) => {
|
// 创建 AbortController 实例,以便中止请求
|
conversationInAbortController.value = new AbortController()
|
// 标记对话进行中
|
conversationInProgress.value = true
|
// 设置为空
|
receiveMessageFullText.value = ''
|
try {
|
// 1.1 先添加两个假数据,等 stream 返回再替换
|
activeMessageList.value.push({
|
id: -1,
|
conversationId: activeConversationId.value,
|
type: 'user',
|
content: userMessage.content,
|
createTime: new Date()
|
} as ChatMessageVO)
|
activeMessageList.value.push({
|
id: -2,
|
conversationId: activeConversationId.value,
|
type: 'assistant',
|
content: '思考中...',
|
createTime: new Date()
|
} as ChatMessageVO)
|
// 1.2 滚动到最下面
|
await nextTick()
|
await scrollToBottom() // 底部
|
// 1.3 开始滚动
|
await textRoll()
|
// 2. 发送 event stream
|
let isFirstChunk = true // 是否是第一个 chunk 消息段
|
await ChatMessageApi.sendChatMessageStream(
|
userMessage.conversationId,
|
userMessage.content,
|
conversationInAbortController.value,
|
enableContext.value,
|
async (res) => {
|
const { code, data, msg } = JSON.parse(res.data)
|
if (code !== 0) {
|
message.alert(`对话异常! ${msg}`)
|
return
|
}
|
|
// 如果内容为空,就不处理。
|
if (data.receive.content === '') {
|
return
|
}
|
// 首次返回需要添加一个 message 到页面,后面的都是更新
|
if (isFirstChunk) {
|
isFirstChunk = false
|
// 弹出两个假数据
|
activeMessageList.value.pop()
|
activeMessageList.value.pop()
|
// 更新返回的数据
|
activeMessageList.value.push(data.send)
|
activeMessageList.value.push(data.receive)
|
}
|
// debugger
|
receiveMessageFullText.value = receiveMessageFullText.value + data.receive.content
|
// 滚动到最下面
|
await scrollToBottom()
|
},
|
(error) => {
|
message.alert(`对话异常! ${error}`)
|
stopStream()
|
},
|
() => {
|
stopStream()
|
}
|
)
|
} catch {
|
console.log('sendStream Exception')
|
}
|
}
|
|
/** 停止 stream 流式调用 */
|
const stopStream = async () => {
|
// tip:如果 stream 进行中的 message,就需要调用 controller 结束
|
if (conversationInAbortController.value) {
|
conversationInAbortController.value.abort()
|
}
|
// 设置为 false
|
conversationInProgress.value = false
|
}
|
|
/** 编辑 message:设置为 prompt,可以再次编辑 */
|
const handleMessageEdit = (message: ChatMessageVO) => {
|
prompt.value = message.content
|
}
|
|
/** 刷新 message:基于指定消息,再次发起对话 */
|
const handleMessageRefresh = (message: ChatMessageVO) => {
|
doSendMessage(message.content)
|
}
|
|
// ============== 【消息滚动】相关 =============
|
|
/** 滚动到 message 底部 */
|
const scrollToBottom = async (isIgnore?: boolean) => {
|
await nextTick()
|
if (messageRef.value) {
|
messageRef.value.scrollToBottom(isIgnore)
|
}
|
}
|
|
/** 自提滚动效果 */
|
const textRoll = async () => {
|
let index = 0
|
try {
|
// 只能执行一次
|
if (textRoleRunning.value) {
|
return
|
}
|
// 设置状态
|
textRoleRunning.value = true
|
receiveMessageDisplayedText.value = ''
|
const task = async () => {
|
// 调整速度
|
const diff =
|
(receiveMessageFullText.value.length - receiveMessageDisplayedText.value.length) / 10
|
if (diff > 5) {
|
textSpeed.value = 10
|
} else if (diff > 2) {
|
textSpeed.value = 30
|
} else if (diff > 1.5) {
|
textSpeed.value = 50
|
} else {
|
textSpeed.value = 100
|
}
|
// 对话结束,就按 30 的速度
|
if (!conversationInProgress.value) {
|
textSpeed.value = 10
|
}
|
|
if (index < receiveMessageFullText.value.length) {
|
receiveMessageDisplayedText.value += receiveMessageFullText.value[index]
|
index++
|
|
// 更新 message
|
const lastMessage = activeMessageList.value[activeMessageList.value.length - 1]
|
lastMessage.content = receiveMessageDisplayedText.value
|
// 滚动到住下面
|
await scrollToBottom()
|
// 重新设置任务
|
timer = setTimeout(task, textSpeed.value)
|
} else {
|
// 不是对话中可以结束
|
if (!conversationInProgress.value) {
|
textRoleRunning.value = false
|
clearTimeout(timer)
|
} else {
|
// 重新设置任务
|
timer = setTimeout(task, textSpeed.value)
|
}
|
}
|
}
|
let timer = setTimeout(task, textSpeed.value)
|
} catch {}
|
}
|
|
/** 初始化 **/
|
onMounted(async () => {
|
defaultMessage.value = props.data
|
if(defaultMessage.value) {
|
prompt.value = defaultMessage.value.content
|
quickAccessFlag.value = true
|
} else {
|
// 获取列表数据
|
activeMessageListLoading.value = true
|
await getMessageList()
|
}
|
})
|
|
onUnmounted(() => {
|
stopStream()
|
})
|
</script>
|
|
<style lang="scss" scoped>
|
|
.container-wrapper {
|
position: relative; // 关键定位容器
|
width: 100%;
|
height: 100%;
|
}
|
|
.sidebar-toggle {
|
position: absolute;
|
left: 320px; // 初始展开位置
|
top: 40%;
|
z-index: 1;
|
width: 20px;
|
height: 80px;
|
background: rgba(115, 196, 255, 0.5);
|
border-radius: 0 8px 8px 0;
|
cursor: pointer;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
transition: all 0.3s ease;
|
color: rgba(255,215,0);
|
transition: left 0.3s ease, background 0.2s ease;
|
|
&:hover {
|
background: #409EFF;
|
left: 304px; // 悬停微调
|
transition: left 0.3s ease, background 0.2s ease;
|
}
|
}
|
|
.conversation-wrapper {
|
position: absolute;
|
left: 0;
|
top: 0;
|
bottom: 0;
|
width: 320px;
|
background: rgba(13,28,58,0.9);
|
box-shadow: 2px 0 8px rgba(0,0,0,0.1);
|
transition: transform 0.3s ease, opacity 0.2s ease;
|
z-index: 999;
|
overflow-x: hidden;
|
|
&.collapsed {
|
transform: translateX(-100%);
|
opacity: 0;
|
pointer-events: none;
|
}
|
}
|
|
// 头部
|
.detail-container {
|
width: 100%;
|
height: 910px;
|
margin-left: 5px;
|
background-color: rgba(0, 0, 0, 0); /* 透明背景 */
|
transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
z-index: 1;
|
.header {
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
justify-content: space-between;
|
box-shadow: 0 0 0 0 #dcdfe6;
|
|
.title {
|
font-size: 18px;
|
font-weight: bold;
|
color: gold;
|
}
|
|
.btns {
|
display: flex;
|
width: 300px;
|
flex-direction: row;
|
justify-content: flex-end;
|
|
.btn {
|
padding: 10px;
|
}
|
|
/* 所有状态通用透明背景 */
|
:deep(.el-button) {
|
background: transparent !important;
|
border-color: currentColor; /* 保持与文字同色 */
|
color: #409EFF; /* 蓝色文字 */
|
}
|
|
/* 悬停状态 */
|
:deep(.el-button:hover) {
|
background: rgba(0, 0, 0, 0.05) !important; /* 轻微悬停反馈 */
|
}
|
|
/* 点击状态 */
|
:deep(.el-button:active) {
|
background: rgba(0, 0, 0, 0.1) !important;
|
}
|
|
/* 禁用状态 */
|
:deep(.el-button.is-disabled) {
|
opacity: 0.6;
|
background: transparent !important;
|
}
|
}
|
}
|
|
&[style*="0"] {
|
margin-left: 0 !important;
|
}
|
}
|
|
// main 容器
|
.main-container {
|
margin-left: 10px;
|
padding: 0;
|
position: relative;
|
height: 500px;
|
width: 100%;
|
|
.message-container {
|
position: absolute;
|
top: 0;
|
bottom: 0;
|
left: 0;
|
right: 0;
|
overflow-y: hidden;
|
padding: 0;
|
margin: 0;
|
/* Firefox */
|
scrollbar-width: thin;
|
scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
|
|
/* WebKit */
|
&::-webkit-scrollbar {
|
width: 6px;
|
background: transparent;
|
}
|
&::-webkit-scrollbar-thumb {
|
border-radius: 4px;
|
background: rgba(0, 0, 0, 0.15);
|
transition: background 0.3s;
|
&:hover { background: rgba(0, 0, 0, 0.25); }
|
}
|
}
|
}
|
|
// 底部
|
.footer-container {
|
display: flex;
|
flex-direction: column;
|
height: 205px;
|
margin-left: 10px;
|
padding: 0;
|
|
// 输入框
|
.input-container {
|
display: flex;
|
flex-direction: column;
|
height: auto;
|
width: 876px;
|
margin: 0;
|
padding: 0;
|
overflow-y: auto; /* 垂直方向溢出时显示滚动条 */
|
overflow-x: hidden; /* 水平方向隐藏滚动条 */
|
/* Firefox */
|
scrollbar-width: thin;
|
scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
|
|
/* WebKit */
|
&::-webkit-scrollbar {
|
width: 6px;
|
background: transparent;
|
}
|
&::-webkit-scrollbar-thumb {
|
border-radius: 4px;
|
background: rgba(0, 0, 0, 0.15);
|
transition: background 0.3s;
|
&:hover { background: rgba(0, 0, 0, 0.25); }
|
}
|
|
.prompt-from {
|
display: flex;
|
flex-direction: column;
|
padding: 9px 10px;
|
width: 876px;
|
height: 205px;
|
background: rgba(115,196,255,0.05);
|
border-radius: 4px 4px 4px 4px;
|
border: 1px solid #73C4FF;
|
}
|
|
textarea::placeholder {
|
color: #DBEEFF;
|
}
|
|
.prompt-input {
|
width: 860px;
|
height: 203px;
|
font-weight: 400;
|
font-size: 14px;
|
background-color: rgba(219,238,255,0);
|
line-height: 21px;
|
text-align: left;
|
font-style: normal;
|
text-transform: none;
|
border: 0;
|
color: #73C4FF;
|
}
|
|
.prompt-input:focus {
|
outline: none;
|
}
|
|
.prompt-btns {
|
display: flex;
|
justify-content: space-between;
|
padding-bottom: 0;
|
padding-top: 5px;
|
|
.content {
|
/* 默认状态 */
|
.el-button {
|
background: transparent !important;
|
border-color: rgba(115, 196, 255, 0.5);
|
color: #73C4FF;
|
border-radius: 15px !important;
|
}
|
|
/* 上下文图标处理 */
|
.content-icon {
|
color: blue; /* 图标颜色 */
|
font-size: 18px;
|
margin-right: 10px;
|
background: url("@/assets/ai/zhuanlu/content.png");
|
vertical-align: middle;
|
}
|
|
/* 选中状态 */
|
.active-button {
|
background: #409eff !important;
|
border-color: #409eff !important;
|
color: white !important;
|
.content-icon {
|
background: url("@/assets/ai/zhuanlu/content_select.png");
|
vertical-align: middle;
|
}
|
}
|
|
/* 按钮组间距处理 */
|
.button-group .el-button {
|
margin-left: 0;
|
border-radius: 4px;
|
}
|
|
/* 悬停效果 */
|
.el-button:not(.active-button):hover {
|
border-color: rgba(115,196,255,0.5);
|
color: #409eff;
|
}
|
}
|
.message {
|
/* 所有状态通用透明背景 */
|
:deep(.el-button) {
|
background: rgba(73, 254, 210, 0.8) !important;
|
border-color: currentColor; /* 保持与文字同色 */
|
font-family: Alimama ShuHeiTi, Alimama ShuHeiTi;
|
font-weight: bold;
|
font-size: 16px;
|
color: #123C4E;
|
clip-path: polygon(
|
0 0,
|
100% 0,
|
100% 100%,
|
10px 100%, /* 右下方向留出10px */
|
0 calc(100% - 10px) /* 左上方向留出10px */
|
);
|
position: relative;
|
padding-left: 15px; /* 增加右侧留白 */
|
}
|
|
/* 悬停状态 */
|
:deep(.el-button:hover) {
|
background: rgba(73, 254, 210, 0.6) !important; /* 轻微悬停反馈 */
|
}
|
|
/* 点击状态 */
|
:deep(.el-button:active) {
|
background: rgba(73, 254, 210, 1) !important;
|
}
|
|
/* 禁用状态 */
|
:deep(.el-button.is-disabled) {
|
opacity: 0.6;
|
background: transparent !important;
|
}
|
|
/* 核心样式覆盖 */
|
:deep(.el-switch__core) {
|
background: transparent !important;
|
border-radius: 0 0 15px 0 !important;
|
border: none !important;
|
height: 40px !important;
|
}
|
|
/* 按钮内容容器 */
|
.button-content {
|
display: flex;
|
align-items: center;
|
padding: 0 15px;
|
height: 100%;
|
}
|
}
|
}
|
}
|
}
|
</style>
|