Skip to content

Commit

Permalink
修改提示
Browse files Browse the repository at this point in the history
  • Loading branch information
sumingcheng committed Jan 5, 2025
1 parent 4f555f5 commit 0259a31
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/views/home/components/ChatContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ const emit = defineEmits(['scroll-bottom'])
const chatListDom = ref<HTMLDivElement>()
const showScrollButton = ref(false)
// 监听滚动
// Listen for scroll events
const handleScroll = () => {
if (!chatListDom.value) return
const { scrollTop, scrollHeight, clientHeight } = chatListDom.value
// 当距离底部超过200px时显示按钮
// Show button when distance to bottom exceeds 200px
showScrollButton.value = scrollHeight - (scrollTop + clientHeight) > 200
}
// 滚动到底部
// Scroll to bottom
const scrollToBottom = () => {
if (!chatListDom.value) return
chatListDom.value.scrollTop = chatListDom.value.scrollHeight
Expand All @@ -41,12 +41,12 @@ onUnmounted(() => {
chatListDom.value?.removeEventListener('scroll', handleScroll)
})
// 缓存 markedRender 结果
// Cache markedRender results
const getRenderedContent = computed(() => (content: string) => {
return markedRender(content)
})
// 监听消息变化,自动滚动到底部
// Auto scroll to bottom when messages change
watch(() => props.messages, () => {
nextTick(() => {
scrollToBottom()
Expand Down Expand Up @@ -80,7 +80,7 @@ defineExpose({
</div>
</div>

<!-- 向下滚动按钮 -->
<!-- Scroll to bottom button -->
<Transition name="fade">
<div v-if="showScrollButton"
class="fixed right-6 bottom-32 cursor-pointer bg-black rounded-full shadow-lg hover:bg-opacity-80 transition-all"
Expand Down
4 changes: 2 additions & 2 deletions src/views/home/components/SettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ watch(() => props.modelValue, (val) => {
<div :class="[{ 'flex justify-center items-center gap-2': !isMobile, 'space-y-2': isMobile }]">
<el-button @click="$emit('update:modelValue', false)" :size="isMobile ? 'default' : 'large'"
:class="{ 'w-full mb-2': isMobile }">
取消
Cancel
</el-button>
<el-button type="primary" @click="emit('save', localKey, localVersion)" :size="isMobile ? 'default' : 'large'"
class="!m-0" :class="{ 'w-full': isMobile }">
保存
Save
</el-button>
</div>
</template>
Expand Down
10 changes: 5 additions & 5 deletions src/views/home/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const updateMessageListWithResponse = async (response: any) => {
const sendMessageToAssistant = async (content: string) => {
try {
if (!content) {
ElMessage({ message: '请输入内容', type: 'info' })
ElMessage({ message: 'Please enter content', type: 'info' })
return
}
Expand All @@ -112,7 +112,7 @@ const sendMessageToAssistant = async (content: string) => {
if (response.status === 'success' && response.data) {
await updateMessageListWithResponse(response)
} else {
const errorMessage = response.error?.message || '发生未知错误'
const errorMessage = response.error?.message || 'Unknown error occurred'
appendLastMessageContent(errorMessage)
ElMessage({ message: errorMessage, type: 'error' })
}
Expand All @@ -121,7 +121,7 @@ const sendMessageToAssistant = async (content: string) => {
const parsedData = JSON.parse(serializedData)
await chatManager.saveChatRecord(parsedData)
} catch (error: any) {
const errorMessage = error.error?.message || error.message || '请求失败,请重试'
const errorMessage = error.error?.message || error.message || 'Request failed, please try again'
appendLastMessageContent(errorMessage)
ElMessage({ message: errorMessage, type: 'error' })
} finally {
Expand Down Expand Up @@ -152,12 +152,12 @@ const toDelete = () => {
const handleSaveSettings = (key: string, version: string) => {
if (!key) {
ElMessage({ message: '请输入API Key', type: 'warning' })
ElMessage({ message: 'Please enter API Key', type: 'warning' })
return
}
setKey(key)
GPT_V.value = version
ElMessage({ message: '保存成功', type: 'success' })
ElMessage({ message: 'Saved successfully', type: 'success' })
centerDialogVisible.value = false
}
Expand Down

0 comments on commit 0259a31

Please sign in to comment.