feat: 取消回答按钮

This commit is contained in:
ChenZhaoYu
2023-02-23 11:04:21 +08:00
parent 719a522512
commit 3bb81c707e

View File

@@ -217,6 +217,13 @@ function handleEnter(event: KeyboardEvent) {
} }
} }
function handleStop() {
if (loading.value) {
controller.abort()
loading.value = false
}
}
const buttonDisabled = computed(() => { const buttonDisabled = computed(() => {
return loading.value || !prompt.value || prompt.value.trim() === '' return loading.value || !prompt.value || prompt.value.trim() === ''
}) })
@@ -267,6 +274,14 @@ onUnmounted(() => {
:loading="item.loading" :loading="item.loading"
@regenerate="onRegenerate(index)" @regenerate="onRegenerate(index)"
/> />
<div class="flex justify-center">
<NButton v-if="loading" ghost @click="handleStop">
<template #icon>
<SvgIcon icon="ri:stop-circle-line" />
</template>
Stop Responding
</NButton>
</div>
</div> </div>
</template> </template>
</div> </div>