refactor(agent): 重构智能体页面布局和样式

-调整了智能体卡片的布局结构,优化了标题和描述的显示方式
- 改进了历史对话的展示样式,增加了滚动指示器
- 统一了标签和图标的样式,提升了视觉一致性
- 优化了搜索框和卡片列表的样式,提高了用户体验
This commit is contained in:
林志军
2025-07-28 19:59:54 +08:00
parent aa13941a83
commit f13384309a
7 changed files with 80 additions and 86 deletions

View File

@ -28,18 +28,7 @@
{{cozeInfo.description}} {{cozeInfo.description}}
</div> </div>
</div> </div>
<div class="divider"></div>
<!-- <div class="history-section">-->
<!-- <div class="history-title">-->
<!-- <div class="text">历史对话</div>-->
<!-- </div>-->
<!-- <div class="history-list">-->
<!-- <div class="history-item">-->
<!-- <div class="item-text">梳理这次舆情的时间线和关键节点</div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div> </div>
</template> </template>

View File

@ -37,7 +37,7 @@
.info-section { .info-section {
align-self: stretch; align-self: stretch;
padding: 15px; padding: 10px 0 0 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
@ -110,7 +110,7 @@
} }
.label { .label {
left: 43px; left: 22px;
top: 10px; top: 10px;
position: absolute; position: absolute;
color: var(--Text-3, #737478); color: var(--Text-3, #737478);
@ -142,12 +142,7 @@
} }
} }
.divider {
align-self: stretch;
height: 0px;
outline: 1px var(--Border-2, #E6E6E8) solid;
outline-offset: -0.50px;
}
.history-section { .history-section {
align-self: stretch; align-self: stretch;

View File

@ -14,20 +14,23 @@
class="history-chat-col"> class="history-chat-col">
<HistoryChat v-if="cozeInfo?.bot_id && !isCollapsed" :cozeInfo="cozeInfo" /> <HistoryChat v-if="cozeInfo?.bot_id && !isCollapsed" :cozeInfo="cozeInfo" />
</a-col> </a-col>
<!-- 右侧聊天内容 --> <!-- 右侧聊天内容 -->
<a-col :xs="24" <a-col :xs="24"
:sm="isCollapsed ? 24 : 12" :sm="isCollapsed ? 24 : 12"
:md="isCollapsed ? 24 : 16" :md="isCollapsed ? 24 : 16"
:lg="isCollapsed ? 24 : 18" :lg="isCollapsed ? 24 : 18"
:xl="isCollapsed ? 24 : 15" class="chat-content-col"> :xl="isCollapsed ? 24 : 16" class="chat-content-col">
<a-card :bordered="false">
<div class="chat-content-col" style="min-height: fit-content;">
<div class="toggle-btn" @click="toggleCollapse"> <div class="toggle-btn" @click="toggleCollapse">
<a-tooltip :content="isCollapsed ? '展开' : '折叠'"> <a-tooltip :content="isCollapsed ? '展开' : '折叠'">
<img class="status-icon" :src="isCollapsed ? menuFold : menuUnfold" /> <img class="status-icon" :src="isCollapsed ? menuUnfold : menuFold" />
</a-tooltip> </a-tooltip>
</div> </div>
<a-card :bordered="false">
<div id="coze-chat-container" style="width: 100%; margin-left: 100px"></div> <div id="coze-chat-container" style="width: 100%; margin-left: 100px"></div>
</div>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
@ -107,7 +110,7 @@ const initChat = async () => {
} }
Object.assign(cozeInfo, data.info); Object.assign(cozeInfo, data.info);
await loadScript('https://lf-cdn.coze.cn/obj/unpkg/flow-platform/chat-app-sdk/1.2.0-beta.10/libs/cn/index.js'); await loadScript('https://lf-cdn.coze.cn/obj/unpkg/flow-platform/chat-app-sdk/1.2.0-beta.17/libs/cn/index.js');
let cozeConfig = await cozeWebSdkConfig(data.info.bot_id, data.info.name, data.info.auth, data.info.user_info); let cozeConfig = await cozeWebSdkConfig(data.info.bot_id, data.info.name, data.info.auth, data.info.user_info);
cozeWebSDK = cozeWebSDK = new CozeWebSDK.WebChatClient(cozeConfig); cozeWebSDK = cozeWebSDK = new CozeWebSDK.WebChatClient(cozeConfig);
showChatPage(); showChatPage();
@ -124,7 +127,7 @@ const cozeWebSdkConfig = (botId, name, auth, userInfo) => {
ui: { ui: {
chatBot: { chatBot: {
el: document.getElementById('coze-chat-container'), el: document.getElementById('coze-chat-container'),
width: '80%', width: '95%',
height: '100%', height: '100%',
title: name, title: name,
isNeedFunctionCallMessage: true, isNeedFunctionCallMessage: true,
@ -132,10 +135,20 @@ const cozeWebSdkConfig = (botId, name, auth, userInfo) => {
base: { base: {
icon: '', icon: '',
zIndex: 1000, zIndex: 1000,
lang:'zh-CN'
}, },
footer: { footer: {
expressionText: '内容由AI生成无法确保真实准确仅供参考。', expressionText: '内容由AI生成无法确保真实准确仅供参考。',
}, },
header: {
isShow: true,
isNeedClose: true
},
conversations: {
isNeed: true,
isNeedAddNewConversationBoolean: true,
isNeedQuoteBoolean: true,
}
}, },
auth: auth, auth: auth,
userInfo: userInfo, userInfo: userInfo,

View File

@ -17,12 +17,20 @@
/> />
<a-textarea <a-textarea
v-if="field.type === 'textarea'" v-if="field.type === 'textarea'"
style="width: 500px; height: 200px;" style="width: 500px; height: 200px"
v-model="formData[field.props.name]" v-model="formData[field.props.name]"
:placeholder="field?.props?.placeholder" :placeholder="field?.props?.placeholder"
/> />
<ImageUpload v-if="field.type == 'upload_image'" v-model="formData[field.props.name]" :limit="field.props.limit"></ImageUpload> <ImageUpload
<FileUpload v-if="field.type == 'upload_file'" v-model="formData[field.props.name]" :limit="field.props.limit"></FileUpload> v-if="field.type == 'upload_image'"
v-model="formData[field.props.name]"
:limit="field.props.limit"
></ImageUpload>
<FileUpload
v-if="field.type == 'upload_file'"
v-model="formData[field.props.name]"
:limit="field.props.limit"
></FileUpload>
<a-select <a-select
v-else-if="field.type === 'select'" v-else-if="field.type === 'select'"
v-model="formData[field.props.name]" v-model="formData[field.props.name]"
@ -32,10 +40,9 @@
{{ option.label }} {{ option.label }}
</a-option> </a-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-form> </a-form>
<a-button type="primary" :disabled="loading" @click="handleSubmit">提交执行</a-button> <a-button class="submit-btn" type="primary" :disabled="loading" @click="handleSubmit">提交执行</a-button>
</div> </div>
</template> </template>
<script setup> <script setup>
@ -73,6 +80,7 @@ const handleSubmit = async () => {
border: 1px solid #d7d7d9; /* 添加灰色边框 */ border: 1px solid #d7d7d9; /* 添加灰色边框 */
background: var(--BG-White, white); background: var(--BG-White, white);
height: 70vh; height: 70vh;
:deep(.arco-input-wrapper), :deep(.arco-input-wrapper),
:deep(.arco-textarea-wrapper) { :deep(.arco-textarea-wrapper) {
border-radius: 4px; border-radius: 4px;
@ -92,5 +100,10 @@ const handleSubmit = async () => {
height: 60px; height: 60px;
} }
} }
.submit-btn {
display: block;
margin: 0 auto;
}
} }
</style> </style>

View File

@ -28,18 +28,7 @@
{{cozeInfo.description}} {{cozeInfo.description}}
</div> </div>
</div> </div>
<div class="divider"></div>
<!-- <div class="history-section">-->
<!-- <div class="history-title">-->
<!-- <div class="text">历史对话</div>-->
<!-- </div>-->
<!-- <div class="history-list">-->
<!-- <div class="history-item">-->
<!-- <div class="item-text">梳理这次舆情的时间线和关键节点</div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div> </div>
</template> </template>

View File

@ -36,8 +36,6 @@
.info-section { .info-section {
align-self: stretch; align-self: stretch;
padding-top: 15px;
padding-bottom: 15px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
@ -47,7 +45,7 @@
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
gap: 4px; gap: 4px;
padding: 24px; padding: 10px 24px 0 24px;
.title { .title {
color: var(--Text-1, #211F24); color: var(--Text-1, #211F24);
font-size: 18px; font-size: 18px;
@ -97,10 +95,10 @@
width: 79px; width: 79px;
height: 34px; height: 34px;
position: relative; position: relative;
margin-top: 24px; margin-top: 10px;
margin-right: 24px; margin-right: 24px;
.count { .count {
left: 0px; left: 20px;
top: 10px; top: 10px;
position: absolute; position: absolute;
color: var(--Text-2, #3C4043); color: var(--Text-2, #3C4043);
@ -143,12 +141,7 @@
} }
} }
.divider {
align-self: stretch;
height: 0px;
outline: 1px var(--Border-2, #E6E6E8) solid;
outline-offset: -0.50px;
}
.history-section { .history-section {
align-self: stretch; align-self: stretch;

View File

@ -5,45 +5,48 @@
<div class="chat-contain"> <div class="chat-contain">
<a-row class="grid-layout"> <a-row class="grid-layout">
<!-- 左侧历史聊天 --> <!-- 左侧历史聊天 -->
<a-col :xs="isCollapsed ? 0 : 3" <a-col
:xs="isCollapsed ? 0 : 3"
:sm="isCollapsed ? 0 : 3" :sm="isCollapsed ? 0 : 3"
:md="isCollapsed ? 0 : 4" :md="isCollapsed ? 0 : 4"
:lg="isCollapsed ? 0 : 6" :lg="isCollapsed ? 0 : 6"
:xl="isCollapsed ? 0 : 7" :xl="isCollapsed ? 0 : 7"
:xxl="isCollapsed ? 0 : 5" > :xxl="isCollapsed ? 0 : 5"
>
<HistoryChat v-if="!isCollapsed" :cozeInfo="cozeInfo" /> <HistoryChat v-if="!isCollapsed" :cozeInfo="cozeInfo" />
</a-col> </a-col>
<div class="toggle-btn" @click="toggleCollapse"> <div class="toggle-btn" @click="toggleCollapse">
<a-tooltip :content="isCollapsed ? '展开' : '折叠'"> <a-tooltip :content="isCollapsed ? '展开' : '折叠'">
<img class="status-icon" :src="isCollapsed ? menuFold : menuUnfold" /> <img class="status-icon" :src="isCollapsed ? menuUnfold : menuFold" />
</a-tooltip> </a-tooltip>
</div> </div>
<!-- 动态表单 --> <!-- 动态表单 -->
<a-col :xs="isCollapsed ? 3 : 3" <a-col
:xs="isCollapsed ? 3 : 3"
:sm="isCollapsed ? 3 : 3" :sm="isCollapsed ? 3 : 3"
:md="isCollapsed ? 4 : 4" :md="isCollapsed ? 4 : 4"
:lg="isCollapsed ? 6 : 6" :lg="isCollapsed ? 6 : 6"
:xl="isCollapsed ? 6 : 6" :xl="isCollapsed ? 6 : 6"
:xxl="isCollapsed ? 5 : 5" class="dynamic-form"> :xxl="isCollapsed ? 5 : 5"
<DynamicForm class="dynamic-form"
:formFields="formFields.form" >
:formData="formData" <DynamicForm :formFields="formFields.form" :formData="formData" :loading="loading" @submit="handleSubmit" />
:loading="loading"
@submit="handleSubmit"
/>
</a-col> </a-col>
<!-- 主内容区域 --> <!-- 主内容区域 -->
<a-col class="right-box content-container" style="height: 70vh;" :xs="isCollapsed ? 4 : 2" <a-col
class="right-box content-container"
style="height: 70vh"
:xs="isCollapsed ? 4 : 2"
:sm="isCollapsed ? 4 : 4" :sm="isCollapsed ? 4 : 4"
:md="isCollapsed ? 6 : 6" :md="isCollapsed ? 6 : 6"
:lg="isCollapsed ? 8 : 8" :lg="isCollapsed ? 8 : 8"
:xl="isCollapsed ? 10 : 10" :xl="isCollapsed ? 10 : 10"
:xxl="isCollapsed ? 12 : 12" > :xxl="isCollapsed ? 12 : 12"
>
<a-spin v-if="loading" class="spin-center" tip="生成中。。。" /> <a-spin v-if="loading" class="spin-center" tip="生成中。。。" />
<div v-if="workFlowRes?.output != ''" class="work-res" v-html="renderedMarkdown"></div> <div v-if="workFlowRes?.output != ''" class="work-res" v-html="renderedMarkdown"></div>
<NoData v-else /> <NoData v-if="loading == false && workFlowRes?.output == ''" />
</a-col> </a-col>
</a-row> </a-row>
</div> </div>
@ -113,7 +116,7 @@ const renderedMarkdown = computed(() => {
const handleSubmit = async (formData) => { const handleSubmit = async (formData) => {
try { try {
const param = { form_data: formData, workflow_id: cozeInfo.workflow_id, bot_id: formFields.value.bot_id }; const param = { form_data: formData, workflow_id: cozeInfo.workflow_id, bot_id: formFields.value.bot_id };
console.log(param, 'param'); workFlowRes.output = '';
loading.value = true; loading.value = true;
const { code, data } = await executeWorkFlow(param); const { code, data } = await executeWorkFlow(param);
if (code === 200) { if (code === 200) {
@ -121,7 +124,6 @@ const handleSubmit = async (formData) => {
loading.value = false; loading.value = false;
} }
} catch (error) { } catch (error) {
console.log(error, 'error');
loading.value = false; loading.value = false;
} }
}; };