Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
水玉婷
ai-wechat
Commits
0cabbce3
Commit
0cabbce3
authored
Apr 20, 2026
by
水玉婷
Browse files
feat:改造logo获取配置,以及添加disabled字段用于详情页不展示操作
parent
2119f645
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/views/History.vue
View file @
0cabbce3
...
...
@@ -3,8 +3,8 @@
<!-- 头部栏 -->
<div
class=
"history-header"
:class=
"
{ 'header-open': isHistoryPanelOpen }">
<div
class=
"header-left"
>
<img
:src=
"defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
<h2
class=
"header-title"
>
{{
app
N
ame
||
'
国械小智
'
}}
</h2>
<img
:src=
"
appData?.app_logo ||
defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
<h2
class=
"header-title"
>
{{
app
Data
?.
app_n
ame
||
'
国械小智
'
}}
</h2>
<div
class=
"menu-button"
@
click=
"toggleHistoryPanel"
>
<img
:src=
"menuIcon"
alt=
"menu-icon"
class=
"menu-icon"
/>
展开
...
...
@@ -21,7 +21,7 @@
<!-- 历史记录侧边栏 -->
<div
class=
"history-sidebar"
:class=
"
{ 'sidebar-open': isHistoryPanelOpen }">
<div
class=
"sidebar-header"
>
<h3><img
:src=
"defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
{{
app
N
ame
||
'
国械小智
'
}}
</h3>
<h3><img
:src=
"
appData?.app_logo ||
defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
{{
app
Data
?.
app_n
ame
||
'
国械小智
'
}}
</h3>
<div
class=
"close-button"
@
click=
"toggleHistoryPanel"
>
<img
:src=
"menuIcon"
alt=
"menu-icon"
class=
"menu-icon"
/>
</div>
...
...
@@ -159,7 +159,6 @@ const isRefreshing = ref(false);
// 下拉刷新相关数据
const
pullDownStartY
=
ref
(
0
);
const
pullDownDistance
=
ref
(
0
);
const
isPullingDown
=
ref
(
false
);
const
isMouseDown
=
ref
(
false
);
...
...
@@ -191,12 +190,33 @@ const baseConfig = {
stage
:
'
wechat-demo
'
+
time
,
};
const
totalCount
=
ref
(
0
);
const
appName
=
ref
(
''
);
interface
Session
{
id
:
string
;
title
:
string
;
version
:
number
;
}
// 获取应用基本信息
const
appData
=
ref
<
any
>
({});
const
getAppInfo
=
async
()
=>
{
if
(
!
appId
)
{
return
;
}
const
{
userToken
,
appCode
}
=
baseConfig
||
{};
const
response
=
await
fetch
(
`
${
import
.
meta
.
env
.
VITE_SSE_PATH
}
/apps/getAppInfoById/
${
appId
}
`
,
{
method
:
'
GET
'
,
headers
:
{
'
token
'
:
userToken
||
''
,
'
x-session-id
'
:
userToken
||
''
,
'
x-app-code
'
:
appCode
||
''
}
as
HeadersInit
});
const
data
=
await
response
.
json
();
if
(
data
.
code
===
0
)
{
appData
.
value
=
data
.
data
||
{};
}
else
{
console
.
error
(
'
获取应用基本信息失败:
'
,
data
);
}
};
const
historyList
=
ref
<
Session
[]
>
([]);
...
...
@@ -229,7 +249,7 @@ const getChatRecordList = async (isLoadMore = false) => {
});
if
(
res
.
data
.
code
===
0
)
{
let
{
data
=
[],
total
=
0
,
totalInfo
=
{}
}
=
res
.
data
.
data
||
[];
let
{
data
=
[],
total
=
0
}
=
res
.
data
.
data
||
[];
// 反转数据,最新的在前面
const
newData
=
(
data
||
[]).
map
((
item
:
any
)
=>
({
...
...
@@ -246,7 +266,6 @@ const getChatRecordList = async (isLoadMore = false) => {
}
totalCount
.
value
=
total
;
appName
.
value
=
totalInfo
?.
app_name
||
''
;
// 判断是否还有更多数据
hasMore
.
value
=
historyList
.
value
.
length
<
total
;
...
...
@@ -438,6 +457,7 @@ const deleteSession = async (record: Session) => {
};
// 生命周期
onMounted
(()
=>
{
getAppInfo
();
getChatRecordList
();
});
</
script
>
...
...
src/views/components/AiChat.vue
View file @
0cabbce3
...
...
@@ -3,7 +3,7 @@
<!-- 聊天头部 -->
<div
class=
"chat-header"
v-if=
"props?.dialogSessionId || hasStartedConversation"
>
<div
class=
"header-avatar"
>
<img
:src=
"
props?.
logo
Url
|| defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
<img
:src=
"
appData?.app_
logo || defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
</div>
<div
class=
"header-info"
>
<h2>
{{
props
?.
dialogSessionId
?
appData
?.
app_name
||
'
继续对话
'
:
'
新建对话
'
}}
</h2>
...
...
@@ -13,7 +13,7 @@
<!-- 当没有dialogSessionId且未开始对话时显示介绍页面 -->
<div
class=
"chat-intro-center"
v-if=
"!props?.dialogSessionId && !hasStartedConversation"
>
<div
class=
"intro-content"
>
<img
:src=
"defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
<img
:src=
"
appData?.app_logo ||
defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
<h3>
嗨,我是
{{
appData
?.
app_name
||
'
国械小智
'
}}
</h3>
<p>
{{
appData
?.
ai_app_prop
?.
prologue
}}
</p>
</div>
...
...
@@ -25,7 +25,7 @@
<!--
<div
class=
"avatar-container"
>
<div
class=
"avatar"
>
<template
v-if=
"msg.messageType === 'received'"
>
<img
:src=
"
props?.
logo
Url
|| defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
<img
:src=
"
appData?.app_
logo || defaultAvatar"
alt=
"avatar"
class=
"avatar-image"
/>
</
template
>
<
template
v-else
>
<user-outlined
/>
...
...
@@ -50,7 +50,7 @@
</div>
</div>
<!-- 普通内容块 -->
<div
class=
"message-inner-box"
@
click=
"msg.messageType === 'sent' ? handleMessageClick(msg, item, textarea) : null"
>
<div
class=
"message-inner-box"
@
click=
"msg.messageType === 'sent'
&& !props.disabled
? handleMessageClick(msg, item, textarea) : null"
>
<div
v-html=
"item.content"
></div>
</div>
</div>
...
...
@@ -60,7 +60,7 @@
:title=
"item.chartData.title || '图表数据'"
/>
</div>
<!-- 普通内容块 -->
<div
v-else
class=
"message-inner-box"
@
click=
"msg.messageType === 'sent' ? handleMessageClick(msg, item, textarea) : null"
>
<div
v-else
class=
"message-inner-box"
@
click=
"msg.messageType === 'sent'
&& !props.disabled
? handleMessageClick(msg, item, textarea) : null"
>
<div
v-html=
"item.content"
></div>
</div>
<!-- 思考过程框 -->
...
...
@@ -101,7 +101,7 @@
</div>
</div>
<!-- 会话结束 -->
<div
v-if=
"msg.messageType === 'received' && msg.recordId"
class=
"conversation-end"
>
<div
v-if=
"msg.messageType === 'received' && msg.recordId
&& !props.disabled
"
class=
"conversation-end"
>
<!-- 推荐会话列表 -->
<div
v-if=
"msg.showRecommendations !== false && msg.recommendations && msg.recommendations.length > 0"
class=
"recommendation-list"
>
<div
v-for=
"(item, i) in msg.recommendations"
:key=
"i"
class=
"recommendation-item"
@
click=
"handleRecommendationClick(msg, item)"
>
...
...
@@ -140,7 +140,7 @@
</div>
<!-- 附件预览区域(只显示一个附件) -->
<div
v-if=
"hasAttachment"
class=
"attachments-preview-container"
>
<div
v-if=
"hasAttachment
&& !props.disabled
"
class=
"attachments-preview-container"
>
<div
class=
"attachment-item"
>
<div
class=
"attachment-preview"
>
<img
v-if=
"currentAttachment.attachmentType.startsWith('image/')"
:src=
"currentAttachment.previewUrl"
:alt=
"currentAttachment.attachmentName"
class=
"preview-image"
/>
...
...
@@ -171,7 +171,7 @@
/>
<!-- 输入区域 - 始终显示 -->
<div
class=
"chat-input-container"
>
<div
class=
"chat-input-container"
v-if=
"!props.disabled"
>
<div
class=
"chat-input"
>
<textarea
ref=
"textarea"
v-model=
"messageText"
placeholder=
"输入消息..."
@
keypress=
"handleKeyPress"
@
input=
"adjustTextareaHeight"
@
paste=
"(event) => handlePaste(event, uploadConfig)"
></textarea>
...
...
@@ -239,6 +239,8 @@ interface Props {
stage
?:
string
[
key
:
string
]:
any
}
// 是否禁用交互(用于详情页)
disabled
?:
boolean
}
// 定义组件属性
...
...
@@ -256,7 +258,8 @@ const props = withDefaults(defineProps<Props>(), {
params
:
()
=>
({
appId
:
'
app-test
'
,
stage
:
'
wechat-demo
'
,
})
}),
disabled
:
false
});
// 定义SSE数据接口
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment