feat: add new button to inputbar component and remove unnecessary toolbar button
This commit is contained in:
parent
0f3dc87d08
commit
d2ca6f1041
@ -7,6 +7,7 @@ import {
|
|||||||
PauseCircleOutlined,
|
PauseCircleOutlined,
|
||||||
QuestionCircleOutlined
|
QuestionCircleOutlined
|
||||||
} from '@ant-design/icons'
|
} from '@ant-design/icons'
|
||||||
|
import { PicCenterOutlined } from '@ant-design/icons'
|
||||||
import { documentExts, imageExts, textExts } from '@renderer/config/constant'
|
import { documentExts, imageExts, textExts } from '@renderer/config/constant'
|
||||||
import { isVisionModel } from '@renderer/config/models'
|
import { isVisionModel } from '@renderer/config/models'
|
||||||
import db from '@renderer/databases'
|
import db from '@renderer/databases'
|
||||||
@ -342,6 +343,11 @@ const Inputbar: FC<Props> = ({ assistant, setActiveTopic }) => {
|
|||||||
</ToolbarButton>
|
</ToolbarButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<AttachmentButton model={model} files={files} setFiles={setFiles} ToolbarButton={ToolbarButton} />
|
<AttachmentButton model={model} files={files} setFiles={setFiles} ToolbarButton={ToolbarButton} />
|
||||||
|
<ToolbarButton type="text" onClick={onNewContext}>
|
||||||
|
<Tooltip placement="top" title={t('chat.input.new.context')}>
|
||||||
|
<PicCenterOutlined />
|
||||||
|
</Tooltip>
|
||||||
|
</ToolbarButton>
|
||||||
<Tooltip placement="top" title={expended ? t('chat.input.collapse') : t('chat.input.expand')} arrow>
|
<Tooltip placement="top" title={expended ? t('chat.input.collapse') : t('chat.input.expand')} arrow>
|
||||||
<ToolbarButton type="text" onClick={onToggleExpended}>
|
<ToolbarButton type="text" onClick={onToggleExpended}>
|
||||||
{expended ? <FullscreenExitOutlined /> : <FullscreenOutlined />}
|
{expended ? <FullscreenExitOutlined /> : <FullscreenOutlined />}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { ArrowUpOutlined, MenuOutlined, PicCenterOutlined } from '@ant-design/icons'
|
import { ArrowUpOutlined, MenuOutlined } from '@ant-design/icons'
|
||||||
import { HStack, VStack } from '@renderer/components/Layout'
|
import { HStack, VStack } from '@renderer/components/Layout'
|
||||||
import { useSettings } from '@renderer/hooks/useSettings'
|
import { useSettings } from '@renderer/hooks/useSettings'
|
||||||
import { Divider, Popover, Tooltip } from 'antd'
|
import { Divider, Popover } from 'antd'
|
||||||
import { FC } from 'react'
|
import { FC } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
@ -13,7 +13,7 @@ type Props = {
|
|||||||
ToolbarButton: any
|
ToolbarButton: any
|
||||||
} & React.HTMLAttributes<HTMLDivElement>
|
} & React.HTMLAttributes<HTMLDivElement>
|
||||||
|
|
||||||
const TokenCount: FC<Props> = ({ estimateTokenCount, inputTokenCount, contextCount, ToolbarButton, ...props }) => {
|
const TokenCount: FC<Props> = ({ estimateTokenCount, inputTokenCount, contextCount }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { showInputEstimatedTokens } = useSettings()
|
const { showInputEstimatedTokens } = useSettings()
|
||||||
|
|
||||||
@ -38,21 +38,14 @@ const TokenCount: FC<Props> = ({ estimateTokenCount, inputTokenCount, contextCou
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<Container>
|
||||||
<ToolbarButton type="text" onClick={props.onClick}>
|
<Popover content={PopoverContent}>
|
||||||
<Tooltip placement="top" title={t('chat.input.new.context')}>
|
<MenuOutlined /> {contextCount}
|
||||||
<PicCenterOutlined />
|
<Divider type="vertical" style={{ marginTop: 0, marginLeft: 5, marginRight: 5 }} />
|
||||||
</Tooltip>
|
<ArrowUpOutlined />
|
||||||
</ToolbarButton>
|
{inputTokenCount} / {estimateTokenCount}
|
||||||
<Container>
|
</Popover>
|
||||||
<Popover content={PopoverContent}>
|
</Container>
|
||||||
<MenuOutlined /> {contextCount}
|
|
||||||
<Divider type="vertical" style={{ marginTop: 0, marginLeft: 5, marginRight: 5 }} />
|
|
||||||
<ArrowUpOutlined />
|
|
||||||
{inputTokenCount} / {estimateTokenCount}
|
|
||||||
</Popover>
|
|
||||||
</Container>
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user