feat: create assistant with search text
This commit is contained in:
parent
33d5da7325
commit
e765bf9828
@ -32,9 +32,22 @@ const PopupContainer: React.FC<Props> = ({ resolve }) => {
|
||||
const agents = useMemo(() => {
|
||||
const allAgents = [...userAgents, ...systemAgents] as Agent[]
|
||||
const list = [defaultAssistant, ...allAgents.filter((agent) => !assistants.map((a) => a.id).includes(agent.id))]
|
||||
return searchText
|
||||
const filtered = searchText
|
||||
? list.filter((agent) => agent.name.toLowerCase().includes(searchText.trim().toLocaleLowerCase()))
|
||||
: list
|
||||
|
||||
if (searchText.trim()) {
|
||||
const newAgent: Agent = {
|
||||
id: 'new',
|
||||
name: searchText.trim(),
|
||||
prompt: '',
|
||||
topics: [],
|
||||
type: 'assistant',
|
||||
emoji: '⭐️'
|
||||
}
|
||||
return [newAgent, ...filtered]
|
||||
}
|
||||
return filtered
|
||||
}, [assistants, defaultAssistant, searchText, userAgents])
|
||||
|
||||
const onCreateAssistant = async (agent: Agent) => {
|
||||
@ -72,7 +85,14 @@ const PopupContainer: React.FC<Props> = ({ resolve }) => {
|
||||
onCancel={onCancel}
|
||||
afterClose={onClose}
|
||||
transitionName="ant-move-up"
|
||||
styles={{ content: { borderRadius: 20, padding: 0, overflow: 'hidden', paddingBottom: 20 } }}
|
||||
styles={{
|
||||
content: {
|
||||
borderRadius: 20,
|
||||
padding: 0,
|
||||
overflow: 'hidden',
|
||||
paddingBottom: 20
|
||||
}
|
||||
}}
|
||||
closeIcon={null}
|
||||
footer={null}>
|
||||
<HStack style={{ padding: '0 12px', marginTop: 5 }}>
|
||||
@ -105,6 +125,7 @@ const PopupContainer: React.FC<Props> = ({ resolve }) => {
|
||||
</HStack>
|
||||
{agent.id === 'default' && <Tag color="green">{t('agents.tag.system')}</Tag>}
|
||||
{agent.type === 'agent' && <Tag color="orange">{t('agents.tag.agent')}</Tag>}
|
||||
{agent.id === 'new' && <Tag color="green">{t('agents.tag.new')}</Tag>}
|
||||
</AgentItem>
|
||||
))}
|
||||
</Container>
|
||||
@ -148,7 +169,7 @@ const SearchIcon = styled.div`
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: var(--color-background-soft);
|
||||
background-color: var(--color-background-mute);
|
||||
margin-right: 2px;
|
||||
`
|
||||
|
||||
|
||||
@ -200,6 +200,7 @@
|
||||
"tag.default": "Default",
|
||||
"tag.system": "System",
|
||||
"tag.agent": "Agent",
|
||||
"tag.new": "New",
|
||||
"edit.message.title": "Preset messages",
|
||||
"edit.message.add.title": "Add",
|
||||
"edit.message.group.title": "Message Group",
|
||||
|
||||
@ -200,6 +200,7 @@
|
||||
"tag.default": "По умолчанию",
|
||||
"tag.system": "Система",
|
||||
"tag.agent": "Агент",
|
||||
"tag.new": "Новый",
|
||||
"edit.message.title": "Предустановленные сообщения",
|
||||
"edit.message.add.title": "Добавить",
|
||||
"edit.message.group.title": "Группа сообщений",
|
||||
|
||||
@ -200,6 +200,7 @@
|
||||
"tag.default": "默认",
|
||||
"tag.system": "系统",
|
||||
"tag.agent": "智能体",
|
||||
"tag.new": "新建",
|
||||
"edit.message.title": "预设消息",
|
||||
"edit.message.add.title": "添加",
|
||||
"edit.message.group.title": "消息组",
|
||||
|
||||
@ -200,6 +200,7 @@
|
||||
"tag.default": "預設",
|
||||
"tag.system": "系統",
|
||||
"tag.agent": "智能体",
|
||||
"tag.new": "新建",
|
||||
"edit.message.title": "預設訊息",
|
||||
"edit.message.add.title": "添加",
|
||||
"edit.message.group.title": "訊息組",
|
||||
|
||||
@ -15,7 +15,7 @@ const MessageAttachments: FC<Props> = ({ message }) => {
|
||||
|
||||
if (message?.files && message.files[0]?.type === FileTypes.IMAGE) {
|
||||
return (
|
||||
<Container>
|
||||
<Container style={{ marginBottom: 8 }}>
|
||||
{message.files?.map((image) => <Image src={FileManager.getFileUrl(image)} key={image.id} width="33%" />)}
|
||||
</Container>
|
||||
)
|
||||
|
||||
@ -51,6 +51,7 @@ const DropdownButton = styled(Button)`
|
||||
|
||||
const ModelName = styled.span`
|
||||
margin-left: -2px;
|
||||
font-weight: 500;
|
||||
`
|
||||
|
||||
export default SelectModelButton
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user