Skip to content

Commit 4b22c99

Browse files
committed
Update history selection logic
1 parent 0cd63d2 commit 4b22c99

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# TUUI - Tool Unitary User Interface
22

3-
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/AI-QL/tuui)
4-
[![](https://img.shields.io/badge/Vue3-brightgreen.svg)](https://vuejs.org)
5-
[![](https://img.shields.io/badge/Vuetify-blue.svg)](https://vuetifyjs.com)
6-
[![LICENSE](https://img.shields.io/github/license/AI-QL/tuui)](https://github.com/AI-QL/tuui/blob/main/LICENSE)
3+
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/AI-QL/tuui) [![](https://img.shields.io/badge/Vue3-brightgreen.svg)](https://vuejs.org) [![](https://img.shields.io/badge/Vuetify-blue.svg)](https://vuetifyjs.com) [![LICENSE](https://img.shields.io/github/license/AI-QL/tuui)](https://github.com/AI-QL/tuui/blob/main/LICENSE)
74

85
#### TUUI is a tool unitary utility integration that accelerates AI tool adoption through MCP (Model Context Protocol) and enables orchestration of cross-vendor LLM APIs.
96

src/renderer/screens/chat/ChatHistoryScreen.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function parseContent(content) {
1818
}
1919
</script>
2020
<template>
21-
<v-list nav>
21+
<v-list v-model:selected="historyStore.selected" nav>
2222
<v-list-item
2323
v-for="(item, index) in historyStore.conversation"
2424
:key="item.id"

src/renderer/store/history.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,48 @@ import localForage from 'localforage'
33
import { v4 as uuidv4 } from 'uuid'
44
import { useMessageStore } from '@/renderer/store/message'
55

6+
type ConversationID = string
7+
68
export type MessageEntry = {
79
role: string
810
content: any
911
reasoning_content?: string
1012
[key: string]: any
1113
}
1214

13-
interface ConversationEntry {
14-
id: string
15+
type ConversationEntry = {
16+
id: ConversationID
1517
messages: MessageEntry[]
1618
}
1719

1820
export const useHistoryStore = defineStore('historyStore', {
1921
state: () => ({
22+
selected: undefined as ConversationID[] | undefined,
2023
conversation: [] as ConversationEntry[]
2124
}),
2225
persist: {
26+
include: ['conversation'],
2327
storage: localForage
2428
},
25-
getters: {
26-
getDate: () => {
29+
getters: {},
30+
actions: {
31+
getDate() {
2732
const date = new Date().toLocaleString('zh', { timeZoneName: 'short', hour12: false })
2833
return `${date} ${uuidv4()}`
29-
}
30-
},
31-
actions: {
34+
},
3235
resetState() {
3336
this.$reset()
3437
},
3538
deleteById(index) {
3639
this.conversation.splice(index, 1)
3740
},
3841
init(conversation) {
42+
const newId = this.getDate()
3943
this.conversation.unshift({
40-
id: this.getDate,
44+
id: newId,
4145
messages: conversation
4246
})
47+
this.selected = [newId]
4348
},
4449
replace(id) {
4550
this.deleteById(id)
@@ -48,9 +53,7 @@ export const useHistoryStore = defineStore('historyStore', {
4853
},
4954
select(id) {
5055
const messageStore = useMessageStore()
51-
// settingStore.configHistory = false
5256
messageStore.conversation = this.conversation[id].messages
53-
// this.replace(id)
5457
},
5558
getColor(id) {
5659
const targetElement = this.conversation[id]?.messages.find(

0 commit comments

Comments
 (0)