2025-12-18 01:00:25 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import type { ChatBubbleProps } from '@/types/chat'
|
|
|
|
|
|
|
|
|
|
const props = defineProps<ChatBubbleProps>()
|
|
|
|
|
|
|
|
|
|
const messageClasses = computed(() => {
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
const base = 'rounded-2xl p-3 max-w-80 break-words'
|
2025-12-18 01:00:25 +08:00
|
|
|
const sender = props.message.sender === 'user'
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
? 'bg-blue-100 dark:bg-blue-800'
|
|
|
|
|
: 'bg-gray-100 dark:bg-gray-700'
|
2025-12-18 01:00:25 +08:00
|
|
|
return `${base} ${sender}`
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const formattedTime = computed(() => {
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
if (!props.message.timestamp)
|
|
|
|
|
return ''
|
2025-12-18 01:00:25 +08:00
|
|
|
const date = typeof props.message.timestamp === 'string'
|
|
|
|
|
? new Date(props.message.timestamp)
|
|
|
|
|
: props.message.timestamp
|
|
|
|
|
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
<div class="mb-4 flex gap-2" :class="message.sender === 'user' ? 'justify-end' : 'justify-start'">
|
|
|
|
|
<!-- Avatar for AI messages (left side) -->
|
|
|
|
|
<div v-if="message.sender === 'ai'">
|
|
|
|
|
<van-image
|
|
|
|
|
v-if="avatar"
|
|
|
|
|
:src="avatar"
|
|
|
|
|
class="rounded-full flex-shrink-0 h-8 w-8"
|
|
|
|
|
round
|
|
|
|
|
/>
|
|
|
|
|
<div v-else class="text-gray-600 rounded-full bg-gray-100 flex flex-shrink-0 h-8 w-8 items-center justify-center dark:text-gray-300 dark:bg-gray-700">
|
|
|
|
|
<van-icon name="robot-o" class="text-lg" />
|
|
|
|
|
</div>
|
2025-12-18 01:00:25 +08:00
|
|
|
</div>
|
|
|
|
|
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
<!-- Message bubble and timestamp -->
|
|
|
|
|
<div class="flex flex-col max-w-[80%]">
|
2025-12-18 01:00:25 +08:00
|
|
|
<div :class="messageClasses">
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
<p class="text-sm">
|
|
|
|
|
{{ message.content }}
|
|
|
|
|
</p>
|
2025-12-18 01:00:25 +08:00
|
|
|
|
|
|
|
|
<!-- Status indicator -->
|
|
|
|
|
<div v-if="message.status === 'sending'" class="mt-1">
|
|
|
|
|
<van-icon name="clock-o" class="animate-pulse" />
|
|
|
|
|
</div>
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
<div v-else-if="message.status === 'error'" class="text-red-500 mt-1">
|
2025-12-18 01:00:25 +08:00
|
|
|
<van-icon name="warning-o" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Timestamp -->
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
<div
|
|
|
|
|
v-if="showTimestamp && formattedTime"
|
|
|
|
|
class="text-xs text-gray-500 mt-1 dark:text-gray-400"
|
|
|
|
|
:class="message.sender === 'user' ? 'text-right' : 'text-left'"
|
|
|
|
|
>
|
2025-12-18 01:00:25 +08:00
|
|
|
{{ formattedTime }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
|
|
|
|
|
<!-- Avatar for user messages (right side) -->
|
|
|
|
|
<div v-if="message.sender === 'user'">
|
|
|
|
|
<van-image
|
|
|
|
|
v-if="avatar"
|
|
|
|
|
:src="avatar"
|
|
|
|
|
class="rounded-full flex-shrink-0 h-8 w-8"
|
|
|
|
|
round
|
|
|
|
|
/>
|
|
|
|
|
<div v-else class="text-blue-600 rounded-full bg-blue-100 flex flex-shrink-0 h-8 w-8 items-center justify-center dark:text-blue-300 dark:bg-blue-800">
|
|
|
|
|
<van-icon name="user-circle-o" class="text-lg" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-18 01:00:25 +08:00
|
|
|
</div>
|
refactor: remove i18n dependency and hardcode strings in components
- Updated ChatInput.vue to remove i18n and handle model value updates directly.
- Refactored NavBar.vue to use a static title map instead of i18n.
- Simplified TabBar.vue by replacing i18n calls with hardcoded titles.
- Removed i18n usage in various pages (charts, counter, forgot-password, index, keepalive, llm-chat, login, mock, profile, register, scroll-cache, settings, unocss).
- Deleted localization files (en-US.json, zh-CN.json) and i18n utility functions.
- Updated constants to provide static app name and description.
- Adjusted page titles in set-page-title.ts to use static names.
- Cleaned up TypeScript types by removing unused i18n types.
2025-12-19 10:09:47 +08:00
|
|
|
</template>
|