Skip to content

Commit a0bb0ef

Browse files
authored
refactor: add spinner svg component (#659)
Signed-off-by: Bob Du <i@bobdu.cc>
1 parent 18da3eb commit a0bb0ef

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

src/icons/Spinner.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<svg
3+
class="animate-spin shrink-0"
4+
xmlns="http://www.w3.org/2000/svg"
5+
fill="none"
6+
viewBox="0 0 24 24"
7+
v-bind="$attrs"
8+
>
9+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
10+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
11+
</svg>
12+
</template>

src/views/chat/components/Message/Reasoning.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts" setup>
22
import { useBasicLayout } from '@/hooks/useBasicLayout'
3+
import Spinner from '@/icons/Spinner.vue'
34
45
const props = defineProps<Props>()
56
@@ -82,15 +83,7 @@ function toggleCollapse() {
8283
>
8384
<div class="flex items-center pr-2">
8485
<template v-if="shouldShowThinkingIndicator">
85-
<svg
86-
class="animate-spin mr-2 h-4 w-4 text-blue-500 dark:text-blue-400 shrink-0"
87-
xmlns="http://www.w3.org/2000/svg"
88-
fill="none"
89-
viewBox="0 0 24 24"
90-
>
91-
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
92-
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
93-
</svg>
86+
<Spinner class="mr-2 h-4 w-4 text-blue-500 dark:text-blue-400" />
9487
<span class="text-gray-700 dark:text-gray-200 truncate">{{ t('chat.thinking') }}</span>
9588
<span v-if="hasReasoningText" class="mx-1.5 text-gray-400 dark:text-gray-500">|</span>
9689
</template>

src/views/chat/components/Message/Search.vue

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts" setup>
22
import { useBasicLayout } from '@/hooks/useBasicLayout'
3+
import Spinner from '@/icons/Spinner.vue'
34
45
const props = defineProps<Props>()
56
@@ -90,15 +91,7 @@ function toggleCollapse() {
9091
>
9192
<div class="flex items-center pr-2">
9293
<template v-if="shouldShowSearchingIndicator">
93-
<svg
94-
class="animate-spin mr-2 h-4 w-4 text-blue-600 dark:text-blue-400 shrink-0"
95-
xmlns="http://www.w3.org/2000/svg"
96-
fill="none"
97-
viewBox="0 0 24 24"
98-
>
99-
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
100-
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
101-
</svg>
94+
<Spinner class="mr-2 h-4 w-4 text-blue-600 dark:text-blue-400" />
10295
<span class="text-blue-700 dark:text-blue-200 truncate">{{ t('chat.searching') }}</span>
10396
<span class="ml-1.5 mr-5 text-blue-400 dark:text-blue-500">|</span>
10497
</template>

0 commit comments

Comments
 (0)