mirror of
https://github.com/Chanzhaoyu/chatgpt-web.git
synced 2025-07-25 07:23:47 +00:00
feat: 支持上下文联想
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { nextTick, onMounted, ref } from 'vue'
|
||||
import { NButton, NInput, NPopover, useMessage } from 'naive-ui'
|
||||
import { Message } from './components'
|
||||
import { fetchChatAPI } from './request'
|
||||
import { clearChatContext, fetchChatAPI } from './request'
|
||||
import { Icon } from '@/components'
|
||||
|
||||
interface ListProps {
|
||||
@@ -27,9 +27,16 @@ function initChat() {
|
||||
addMessage('Hi, I am ChatGPT, a chatbot based on GPT-3.', false)
|
||||
}
|
||||
|
||||
function handleClear() {
|
||||
list.value = []
|
||||
setTimeout(initChat, 100)
|
||||
async function handleClear() {
|
||||
try {
|
||||
const { message } = await clearChatContext()
|
||||
ms.success(message)
|
||||
list.value = []
|
||||
setTimeout(initChat, 100)
|
||||
}
|
||||
catch (error) {
|
||||
ms.error('Clear failed, please try again later.')
|
||||
}
|
||||
}
|
||||
|
||||
function handleEnter(event: KeyboardEvent) {
|
||||
@@ -81,7 +88,7 @@ function addMessage(message: string, reversal = false) {
|
||||
<Icon icon="ri:delete-bin-6-line" />
|
||||
</button>
|
||||
</template>
|
||||
<span>Clear</span>
|
||||
<span>Clear Context</span>
|
||||
</NPopover>
|
||||
</div>
|
||||
</header>
|
||||
|
Reference in New Issue
Block a user