Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
ai-chat-ui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenghong_tao
ai-chat-ui
Commits
cf2005b2
Commit
cf2005b2
authored
Apr 26, 2025
by
chenghong_tao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 新建会话,fix 无法多轮对话
parent
785d75bc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
12 deletions
+45
-12
Chat.vue
src/components/Chat.vue
+4
-2
Header.vue
src/components/Header.vue
+18
-3
HistoryList.vue
src/components/HistoryList.vue
+8
-1
Layout.vue
src/components/Layout.vue
+1
-1
aiBubble.vue
src/components/chatSubassembly/aiBubble.vue
+8
-1
welcomeBubble.vue
src/components/chatSubassembly/welcomeBubble.vue
+1
-1
v-adjust-width.js
src/directives/v-adjust-width.js
+1
-1
task.js
src/store/task.js
+4
-2
No files found.
src/components/Chat.vue
View file @
cf2005b2
...
...
@@ -117,9 +117,11 @@ const scrollToBottom = async () => {
}
// 会话重置
const
resetChat
=
async
()
=>
{
const
resetChat
=
async
(
clearStore
=
true
)
=>
{
await
inputMessageRef
.
value
.
handleCancel
()
taskStore
.
clear
()
if
(
clearStore
)
{
taskStore
.
clear
()
}
}
watch
(()
=>
props
.
historyMsgList
,
(
newValue
)
=>
{
...
...
src/components/Header.vue
View file @
cf2005b2
...
...
@@ -4,16 +4,31 @@
<!-- 图标按钮 -->
<el-button
:icon=
"Expand"
v-if=
"!sideBarStatus"
link
@
click=
"expandSidebar"
/>
<el-button
:icon=
"Fold"
v-if=
"sideBarStatus"
link
@
click=
"foldSidebar"
/>
<el-tooltip
class=
"box-item"
effect=
"dark"
content=
"新建会话"
placement=
"right"
>
<el-button
:icon=
"Plus"
link
@
click=
"refreshConversation"
/>
</el-tooltip>
</div>
<div
class=
"center-info"
>
{{
appInfo
?.
app
?.
name
}}
</div>
<div
class=
"right-tool"
>
<el-button
:icon=
"RefreshRight"
@
click=
"refreshConversation"
link
/>
<el-tooltip
class=
"box-item"
effect=
"dark"
content=
"重置会话"
placement=
"left"
>
<el-button
:icon=
"RefreshRight"
@
click=
"refreshConversation"
link
/>
</el-tooltip>
</div>
</div>
</
template
>
<
script
setup
>
import
{
ref
,
computed
}
from
'vue'
import
{
Expand
,
Fold
,
RefreshRight
}
from
'@element-plus/icons-vue'
import
{
Expand
,
Fold
,
RefreshRight
,
CirclePlus
,
Plus
,
CirclePlusFilled
}
from
'@element-plus/icons-vue'
import
{
useAppStore
}
from
'../store/app'
const
appStore
=
useAppStore
()
...
...
@@ -44,7 +59,7 @@ const refreshConversation = () => {
display: flex;
align-items: center;
.left-tool {
width:
3
0px;
width:
8
0px;
font-size: 20px;
padding-left: 20px;
.el-button{
...
...
src/components/HistoryList.vue
View file @
cf2005b2
...
...
@@ -48,10 +48,13 @@
</div>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
watch
}
from
"vue"
;
import
{
ref
,
onMounted
,
watch
,
nextTick
}
from
"vue"
;
import
{
Search
,
Delete
,
Edit
}
from
"@element-plus/icons-vue"
;
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
difyApi
from
"../apis/difyApi"
;
import
{
useTaskStore
}
from
"../store/task"
;
const
taskStore
=
useTaskStore
();
const
props
=
defineProps
({
isRefreshHistoryList
:
{
...
...
@@ -126,6 +129,10 @@ const getConversationMsg = async (id) => {
conversation_id
:
id
,
limit
:
20
,
});
taskStore
.
setConversationId
(
currentClickItemId
.
value
)
taskStore
.
setTaskId
(
''
);
taskStore
.
setMessageId
(
''
);
taskStore
.
setWorkflowRunId
(
''
);
console
.
log
(
"result:"
,
result
);
emits
(
"getHistoryMsg"
,
result
.
data
);
};
...
...
src/components/Layout.vue
View file @
cf2005b2
...
...
@@ -44,7 +44,7 @@ const initAppInfo = async () => {
const
refreshChat
=
ref
(
false
)
const
refreshConversation
=
(
reset
=
true
)
=>
{
nextTick
(()
=>
{
chatRef
.
value
.
resetChat
()
chatRef
.
value
.
resetChat
(
reset
)
console
.
log
(
'refreshChat'
);
refreshChat
.
value
=
true
nextTick
(()
=>
{
...
...
src/components/chatSubassembly/aiBubble.vue
View file @
cf2005b2
...
...
@@ -124,7 +124,7 @@ async function startSSE(query) {
inputs
:
{},
query
,
response_mode
:
"streaming"
,
conversation_id
:
""
,
conversation_id
:
taskStore
.
conversation_id
,
user
:
chatMessageOptions
.
user
,
files
:
[],
}),
...
...
@@ -152,6 +152,8 @@ const workflowContent = computed(() => {
workflowList
.
push
(
parsedChunk
);
if
(
parsedChunk
.
event
===
"workflow_started"
)
{
workflowStatus
.
value
=
'loading'
;
console
.
log
(
"workflow_started"
,
parsedChunk
);
taskStore
.
setTaskId
(
parsedChunk
.
task_id
);
taskStore
.
setConversationId
(
parsedChunk
.
conversation_id
);
taskStore
.
setMessageId
(
parsedChunk
.
message_id
);
...
...
@@ -207,6 +209,11 @@ const messageContent = computed(() => {
});
const
feedback
=
async
(
type
)
=>
{
console
.
log
(
'messageContent'
,
messageContent
.
value
)
if
(
messageContent
.
value
===
''
)
{
ElMessage
.
error
(
"暂无内容可反馈"
);
return
}
const
messageId
=
props
.
messageType
===
'ai-history'
?
props
.
historyMsgId
:
workflowContent
.
value
[
0
].
message_id
;
await
difyApi
.
feedback
(
messageId
,
{
rating
:
type
,
content
:
type
});
ElMessage
.
success
(
"反馈成功"
);
...
...
src/components/chatSubassembly/welcomeBubble.vue
View file @
cf2005b2
...
...
@@ -35,7 +35,7 @@ const suggestedQuestions = ref([])
watch
(()
=>
props
.
appParams
,
(
val
)
=>
{
content
.
value
=
val
.
opening_statement
;
suggestedQuestions
.
value
=
val
.
suggested_questions
;
suggestedQuestions
.
value
=
val
.
suggested_questions
||
[]
;
},
{
immediate
:
true
});
const
emit
=
defineEmits
([
"userQuery"
]);
...
...
src/directives/v-adjust-width.js
View file @
cf2005b2
...
...
@@ -3,7 +3,7 @@
export
default
{
mounted
(
el
)
{
const
adjustWidth
=
()
=>
{
const
parentWidth
=
document
.
querySelector
(
'#main-container'
).
clientWidth
;
const
parentWidth
=
document
.
querySelector
(
'#main-container'
)
?
.
clientWidth
;
// console.log('parentWidth:', parentWidth);
if
(
parentWidth
<=
740
)
{
...
...
src/store/task.js
View file @
cf2005b2
...
...
@@ -13,8 +13,10 @@ export const useTaskStore = defineStore('task', {
setTaskId
(
taskId
)
{
this
.
taskId
=
taskId
},
setConversationId
(
conversation_id
)
{
this
.
conversation_id
=
conversation_id
setConversationId
(
id
)
{
console
.
log
(
'conversation_id'
,
id
)
this
.
conversation_id
=
id
},
setMessageId
(
message_id
)
{
this
.
message_id
=
message_id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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