mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
(feat:tools) ask for custom names
This commit is contained in:
@@ -25,6 +25,7 @@ export default function ConfigToolModal({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const token = useSelector(selectToken);
|
const token = useSelector(selectToken);
|
||||||
const [authKey, setAuthKey] = React.useState<string>('');
|
const [authKey, setAuthKey] = React.useState<string>('');
|
||||||
|
const [customName, setCustomName] = React.useState<string>('');
|
||||||
|
|
||||||
const handleAddTool = (tool: AvailableToolType) => {
|
const handleAddTool = (tool: AvailableToolType) => {
|
||||||
userService
|
userService
|
||||||
@@ -34,6 +35,7 @@ export default function ConfigToolModal({
|
|||||||
displayName: tool.displayName,
|
displayName: tool.displayName,
|
||||||
description: tool.description,
|
description: tool.description,
|
||||||
config: { token: authKey },
|
config: { token: authKey },
|
||||||
|
customName: customName,
|
||||||
actions: tool.actions,
|
actions: tool.actions,
|
||||||
status: true,
|
status: true,
|
||||||
},
|
},
|
||||||
@@ -58,6 +60,16 @@ export default function ConfigToolModal({
|
|||||||
{t('modals.configTool.type')}:{' '}
|
{t('modals.configTool.type')}:{' '}
|
||||||
<span className="font-semibold">{tool?.name}</span>
|
<span className="font-semibold">{tool?.name}</span>
|
||||||
</p>
|
</p>
|
||||||
|
<div className="mt-6 px-3">
|
||||||
|
<Input
|
||||||
|
type="text"
|
||||||
|
value={customName}
|
||||||
|
onChange={(e) => setCustomName(e.target.value)}
|
||||||
|
borderVariant="thin"
|
||||||
|
placeholder="Enter custom name (optional)"
|
||||||
|
labelBgClassName="bg-white dark:bg-charleston-green-2"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className="mt-6 px-3">
|
<div className="mt-6 px-3">
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ export default function Tools() {
|
|||||||
label: t('settings.tools.delete'),
|
label: t('settings.tools.delete'),
|
||||||
onClick: () => handleDeleteTool(tool),
|
onClick: () => handleDeleteTool(tool),
|
||||||
variant: 'danger',
|
variant: 'danger',
|
||||||
iconWidth: 18,
|
iconWidth: 12,
|
||||||
iconHeight: 18,
|
iconHeight: 12,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ export default function Tools() {
|
|||||||
) : (
|
) : (
|
||||||
userTools
|
userTools
|
||||||
.filter((tool) =>
|
.filter((tool) =>
|
||||||
tool.displayName
|
(tool.customName || tool.displayName)
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.includes(searchTerm.toLowerCase()),
|
.includes(searchTerm.toLowerCase()),
|
||||||
)
|
)
|
||||||
@@ -250,10 +250,10 @@ export default function Tools() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mt-[9px]">
|
<div className="mt-[9px]">
|
||||||
<p
|
<p
|
||||||
title={tool.displayName}
|
title={tool.customName || tool.displayName}
|
||||||
className="truncate px-1 text-[13px] font-semibold capitalize leading-relaxed text-raisin-black-light dark:text-bright-gray"
|
className="truncate px-1 text-[13px] font-semibold capitalize leading-relaxed text-raisin-black-light dark:text-bright-gray"
|
||||||
>
|
>
|
||||||
{tool.displayName}
|
{tool.customName || tool.displayName}
|
||||||
</p>
|
</p>
|
||||||
<p className="mt-1 h-24 overflow-auto px-1 text-[12px] leading-relaxed text-old-silver dark:text-sonic-silver-light">
|
<p className="mt-1 h-24 overflow-auto px-1 text-[12px] leading-relaxed text-old-silver dark:text-sonic-silver-light">
|
||||||
{tool.description}
|
{tool.description}
|
||||||
@@ -269,7 +269,7 @@ export default function Tools() {
|
|||||||
size="small"
|
size="small"
|
||||||
id={`toolToggle-${index}`}
|
id={`toolToggle-${index}`}
|
||||||
ariaLabel={t('settings.tools.toggleToolAria', {
|
ariaLabel={t('settings.tools.toggleToolAria', {
|
||||||
toolName: tool.displayName,
|
toolName: tool.customName || tool.displayName,
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user