feat: update translations and add new topic functionality

This commit is contained in:
kangfenmao 2024-10-15 16:33:15 +08:00
parent 5ba6c9f882
commit 99f05383cb
5 changed files with 7 additions and 5 deletions

View File

@ -107,6 +107,7 @@
"add.assistant.title": "Add Assistant",
"message.new.context": "New Context",
"message.new.branch": "New Branch",
"message.new.branch.created": "New Branch Created",
"assistant.search.placeholder": "Search",
"artifacts.button.preview": "Preview",
"artifacts.button.download": "Download"

View File

@ -81,7 +81,7 @@
"topics.export.image": "导出为图片",
"input.new_topic": "新话题",
"input.topics": " 话题 ",
"input.clear": "清除会话消息",
"input.clear": "清消息",
"input.new.context": "清除上下文",
"input.expand": "展开",
"input.collapse": "收起",
@ -107,6 +107,7 @@
"add.assistant.title": "添加助手",
"message.new.context": "清除上下文",
"message.new.branch": "新分支",
"message.new.branch.created": "新分支已创建",
"assistant.search.placeholder": "搜索",
"artifacts.button.preview": "预览",
"artifacts.button.download": "下载"

View File

@ -107,6 +107,7 @@
"add.assistant.title": "添加助手",
"message.new.context": "新上下文",
"message.new.branch": "新分支",
"message.new.branch.created": "新分支已建立",
"assistant.search.placeholder": "搜尋",
"artifacts.button.preview": "預覽",
"artifacts.button.download": "下載"

View File

@ -129,8 +129,10 @@ const Inputbar: FC<Props> = ({ assistant, setActiveTopic }) => {
const addNewTopic = useCallback(() => {
const topic = getDefaultTopic(assistant.id)
addTopic(topic)
setActiveTopic(topic)
db.topics.add({ id: topic.id, messages: [] })
}, [addTopic, assistant.id, setActiveTopic])

View File

@ -11,7 +11,6 @@ import { EVENT_NAMES, EventEmitter } from '@renderer/services/event'
import { Assistant, Topic } from '@renderer/types'
import { Switch } from 'antd'
import { FC, useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'
import SelectModelButton from './components/SelectModelButton'
@ -28,13 +27,11 @@ const HeaderNavbar: FC<Props> = ({ activeAssistant }) => {
const { theme, toggleTheme } = useTheme()
const { topicPosition } = useSettings()
const { showTopics, toggleShowTopics } = useShowTopics()
const { t } = useTranslation()
const addNewTopic = useCallback(() => {
EventEmitter.emit(EVENT_NAMES.ADD_NEW_TOPIC)
window.message.success({ content: t('message.topic.added'), key: 'topic-added' })
setTimeout(() => EventEmitter.emit(EVENT_NAMES.SHOW_TOPIC_SIDEBAR), 0)
}, [t])
}, [])
return (
<Navbar>