This commit is contained in:
kangfenmao 2024-10-05 19:02:56 +08:00
parent 4cc140e4f2
commit cf98675223
5 changed files with 24 additions and 21 deletions

View File

@ -1,13 +1,8 @@
import './assets/styles/index.scss'
import './init'
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<App />
</React.StrictMode>
)
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(<App />)

View File

@ -93,7 +93,7 @@ const ContentContainer = styled.div`
justify-content: center;
height: 100%;
overflow-y: scroll;
padding: 20px;
padding: 15px;
`
const FileNameText = styled.div`

View File

@ -1,6 +1,12 @@
import { getTopicById } from '@renderer/hooks/useTopic'
import { default as MessageItem } from '@renderer/pages/home/Messages/Message'
import { getAssistantById } from '@renderer/services/assistant'
import { EVENT_NAMES, EventEmitter } from '@renderer/services/event'
import { Message } from '@renderer/types'
import { Button } from 'antd'
import { FC } from 'react'
import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router-dom'
import styled from 'styled-components'
interface Props extends React.HTMLAttributes<HTMLDivElement> {
@ -8,14 +14,27 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
}
const SearchMessage: FC<Props> = ({ message, ...props }) => {
const { t } = useTranslation()
const navigate = useNavigate()
if (!message) {
return null
}
const onContinueChat = async (message: Message) => {
const assistant = getAssistantById(message.assistantId)
const topic = await getTopicById(message.topicId)
navigate('/', { state: { assistant, topic } })
setTimeout(() => EventEmitter.emit(EVENT_NAMES.SHOW_TOPIC_SIDEBAR), 100)
}
return (
<MessagesContainer {...props}>
<ContainerWrapper style={{ paddingTop: 30, paddingBottom: 30 }}>
<MessageItem message={message} showMenu={false} />
<Button type="link" onClick={() => onContinueChat(message)}>
{t('history.continue_chat')}
</Button>
</ContainerWrapper>
</MessagesContainer>
)

View File

@ -224,7 +224,7 @@ const AssistantItem = styled.div`
justify-content: space-between;
padding: 7px 10px;
position: relative;
border-radius: 4px;
border-radius: 17px;
margin: 0 10px;
padding-right: 35px;
font-family: Ubuntu;
@ -239,7 +239,6 @@ const AssistantItem = styled.div`
&.active {
background-color: var(--color-background-mute);
.name {
font-weight: 500;
}
.topics-count {
display: none;

View File

@ -149,10 +149,7 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic
return (
<Dropdown menu={{ items: getTopicMenuItems(topic) }} trigger={['contextMenu']} key={topic.id}>
<TopicListItem className={isActive ? 'active' : ''} onClick={() => onSwitchTopic(topic)}>
<TopicName className="name">
<TopicHash>#</TopicHash>
{topic.name.replace('`', '')}
</TopicName>
<TopicName className="name">{topic.name.replace('`', '')}</TopicName>
{assistant.topics.length > 1 && isActive && (
<MenuButton
className="menu"
@ -187,7 +184,7 @@ const Container = styled.div`
const TopicListItem = styled.div`
padding: 7px 10px;
margin: 0 10px;
border-radius: 4px;
border-radius: 17px;
font-family: Ubuntu;
font-size: 13px;
display: flex;
@ -211,7 +208,6 @@ const TopicListItem = styled.div`
background-color: var(--color-background-mute);
.name {
opacity: 1;
font-weight: 500;
}
.menu {
opacity: 1;
@ -247,10 +243,4 @@ const MenuButton = styled.div`
}
`
const TopicHash = styled.span`
font-size: 13px;
color: var(--color-text-3);
margin-right: 2px;
`
export default Topics