Spaces:
Running
Running
File size: 1,211 Bytes
d669ddb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
<script setup lang="ts">
import { usePromptStore, type IPrompt } from '@/stores/modules/prompt';
import { NThing, NTag, NEllipsis } from 'naive-ui';
import { storeToRefs } from 'pinia';
defineProps<{
index: number;
source: IPrompt;
}>();
const promptStore = usePromptStore();
const { selectedPromptIndex, isShowChatPrompt, keyword } = storeToRefs(promptStore);
const selectPrompt = (item: IPrompt) => {
// console.log('select prompt : ', item);
if (!item) {
return;
}
keyword.value = '';
CIB.vm.actionBar.textInput.value = item.prompt;
CIB.vm.actionBar.input.focus();
isShowChatPrompt.value = false;
};
</script>
<template>
<NThing
class="hover:bg-gray-400 cursor-pointer px-5 h-[130px] flex justify-start items-center"
:class="{
'bg-gray-100': index === selectedPromptIndex,
}"
@click="selectPrompt(source)"
>
<template #description>
<NTag type="info">
<span class="inline-block max-w-[310px] xl:max-w-[650px] overflow-hidden text-ellipsis">{{ source.act }}</span>
</NTag>
</template>
<NEllipsis :tooltip="false" :line-clamp="2">{{ source.prompt }}</NEllipsis>
</NThing>
</template>
|