IntentDetail.vue
1.76 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<template>
<el-card shadow="never" class="detail">
<template #header>
<div class="h">
<div class="name">{{ intent.name }}</div>
<el-tag type="info" effect="light">{{ intent.domain }}</el-tag>
</div>
</template>
<div class="section">
<div class="k">tree_text</div>
<div class="v">{{ intent.tree_text }}</div>
</div>
<div class="section">
<div class="k">embed_text</div>
<div class="v mono">{{ intent.embed_text }}</div>
</div>
<div class="section">
<div class="k">示例</div>
<div class="chips">
<el-tag
v-for="ex in intent.examples"
:key="ex"
effect="plain"
type="info"
class="chip"
@click="onUseExample(ex)"
>
{{ ex }}
</el-tag>
</div>
</div>
</el-card>
</template>
<script setup lang="ts">
import type { IntentItem } from "../../types";
defineProps<{ intent: IntentItem }>();
const emit = defineEmits<{ (e: "use-example", text: string): void }>();
function onUseExample(text: string): void {
emit("use-example", text);
}
</script>
<style scoped>
.detail {
border-radius: 12px;
}
.h {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
}
.name {
font-weight: 700;
overflow: hidden;
text-overflow: ellipsis;
}
.section {
margin: 10px 0;
}
.k {
color: var(--el-text-color-secondary);
margin-bottom: 4px;
}
.v {
color: var(--el-text-color-primary);
white-space: pre-wrap;
word-break: break-word;
}
.mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.chips {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.chip {
max-width: 100%;
cursor: pointer;
}
</style>