Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: update agent builder ui (#10996)

Innei704ef7f2cf3f
diff --git a/packages/builtin-tool-agent-builder/src/client/Render/UpdatePrompt.tsx b/packages/builtin-tool-agent-builder/src/client/Render/UpdatePrompt.tsx
index 84e959679fb..04563d1c144 100644
--- a/packages/builtin-tool-agent-builder/src/client/Render/UpdatePrompt.tsx
+++ b/packages/builtin-tool-agent-builder/src/client/Render/UpdatePrompt.tsx
@@ -1,52 +1,74 @@
import { BuiltinRenderProps } from '@lobechat/types';
import { Flexbox } from '@lobehub/ui';
+import { createStyles } from 'antd-style';
import { CheckCircle, FileText } from 'lucide-react';
import { memo } from 'react';
import type { UpdatePromptParams, UpdatePromptState } from '../../types';
+const useStyles = createStyles(({ css, token }) => ({
+ container: css`
+ font-size: 13px;
+ `,
+ fileIcon: css`
+ color: ${token.colorTextTertiary};
+ `,
+ promptCard: css`
+ background: ${token.colorFillTertiary};
+ border-left: 3px solid ${token.colorSuccess};
+ margin-left: 12px;
+ padding: 12px;
+ `,
+ promptContent: css`
+ color: ${token.colorText};
+ font-size: 13px;
+ line-height: 1.6;
+ margin-left: 20px;
+ max-height: 200px;
+ overflow: auto;
+ white-space: pre-wrap;
+ word-break: break-word;
+ margin-inline: -12px;
+ padding-inline: 12px;
+ `,
+ promptLabel: css`
+ color: ${token.colorTextSecondary};
+ font-size: 12px;
+ font-weight: 500;
+ `,
+ statusRow: css`
+ color: ${token.colorSuccess};
+ margin-left: 9px;
+ margin-bottom: 6px;
+ `,
+ statusText: css`
+ font-weight: 500;
+ `,
+}));
+
const UpdatePrompt = memo<BuiltinRenderProps<UpdatePromptParams, UpdatePromptState>>(
({ pluginState }) => {
const { newPrompt } = pluginState || {};
+ const { styles } = useStyles();
return (
- <Flexbox gap={8} style={{ fontSize: 13 }}>
- <Flexbox align={'center'} gap={6} horizontal style={{ color: 'var(--lobe-success-6)' }}>
+ <Flexbox className={styles.container} gap={8}>
+ <Flexbox align={'center'} className={styles.statusRow} gap={6} horizontal>
<CheckCircle size={14} />
- <span style={{ fontWeight: 500 }}>
+ <span className={styles.statusText}>
{newPrompt ? 'System prompt updated' : 'System prompt cleared'}
</span>
</Flexbox>
{newPrompt && (
- <Flexbox
- gap={8}
- style={{
- background: 'var(--lobe-fill-tertiary)',
- borderLeft: '3px solid var(--lobe-success-6)',
- borderRadius: 6,
- marginLeft: 20,
- padding: 12,
- }}
- >
+ <Flexbox className={styles.promptCard} gap={8}>
<Flexbox align={'center'} gap={6} horizontal>
- <FileText size={14} style={{ color: 'var(--lobe-text-tertiary)' }} />
- <span style={{ color: 'var(--lobe-text-secondary)', fontSize: 12, fontWeight: 500 }}>
+ <FileText className={styles.fileIcon} size={14} />
+ <span className={styles.promptLabel}>
New prompt ({newPrompt.length} characters):
</span>
</Flexbox>
- <div
- style={{
- color: 'var(--lobe-text)',
- fontSize: 13,
- lineHeight: 1.6,
- marginLeft: 20,
- maxHeight: 200,
- overflow: 'auto',
- whiteSpace: 'pre-wrap',
- wordBreak: 'break-word',
- }}
- >
+ <div className={styles.promptContent}>
{newPrompt.length > 500 ? newPrompt.slice(0, 500) + '...' : newPrompt}
</div>
</Flexbox>
diff --git a/src/app/[variants]/(main)/chat/profile/index.tsx b/src/app/[variants]/(main)/chat/profile/index.tsx
index a72fac44498..d831ec750e3 100644
--- a/src/app/[variants]/(main)/chat/profile/index.tsx
+++ b/src/app/[variants]/(main)/chat/profile/index.tsx
@@ -49,7 +49,6 @@ const ProfileArea = memo(() => {
</>
);
});
-
const AgentProfile: FC = () => {
return (
<Suspense fallback={<Loading debugId="AgentProfile" />}>
diff --git a/src/app/[variants]/(main)/home/features/InputArea/index.tsx b/src/app/[variants]/(main)/home/features/InputArea/index.tsx
index a7cbd36d016..628da2cb212 100644
--- a/src/app/[variants]/(main)/home/features/InputArea/index.tsx
+++ b/src/app/[variants]/(main)/home/features/InputArea/index.tsx
@@ -14,7 +14,7 @@ import { useSend } from './useSend';
const leftActions: ActionKeys[] = ['model', 'search', 'fileUpload'];
-const InputArea = memo(() => {
+const InputArea = () => {
const { loading, send, inboxAgentId } = useSend();
const inputActiveMode = useHomeStore((s) => s.inputActiveMode);
@@ -71,6 +71,6 @@ const InputArea = memo(() => {
<StarterList />
</Flexbox>
);
-});
+};
export default InputArea;
diff --git a/src/app/[variants]/(main)/settings/provider/ProviderMenu/index.tsx b/src/app/[variants]/(main)/settings/provider/ProviderMenu/index.tsx
index 7a3ca0b814c..f7db01d941f 100644
--- a/src/app/[variants]/(main)/settings/provider/ProviderMenu/index.tsx
+++ b/src/app/[variants]/(main)/settings/provider/ProviderMenu/index.tsx
@@ -48,6 +48,8 @@ const Layout = memo(({ children, mobile }: ProviderMenuProps) => {
padding={8}
style={{
background: theme.colorBgContainer,
+ borderBottom: `1px solid ${theme.colorBorderSecondary}`,
+ marginBottom: 8,
position: 'sticky',
top: 0,
zIndex: 50,
@@ -74,6 +76,7 @@ const Layout = memo(({ children, mobile }: ProviderMenuProps) => {
style={{ width: '100%' }}
styles={{
input: {
+ paddingBlock: 3,
paddingLeft: 6,
},
}}
diff --git a/src/app/[variants]/(main)/settings/provider/features/ModelList/index.tsx b/src/app/[variants]/(main)/settings/provider/features/ModelList/index.tsx
index cb3103d57ef..6de488c6374 100644
--- a/src/app/[variants]/(main)/settings/provider/features/ModelList/index.tsx
+++ b/src/app/[variants]/(main)/settings/provider/features/ModelList/index.tsx
@@ -21,7 +21,10 @@ import DisabledModels from './DisabledModels';
import EmptyModels from './EmptyModels';
import EnabledModelList from './EnabledModelList';
import ModelTitle from './ModelTitle';
-import { ProviderSettingsContext, type ProviderSettingsContextValue } from './ProviderSettingsContext';
+import {
+ ProviderSettingsContext,
+ type ProviderSettingsContextValue,
+} from './ProviderSettingsContext';
import SearchResult from './SearchResult';
import SkeletonList from './SkeletonList';
@@ -129,7 +132,7 @@ const Content = memo<ContentProps>(({ id }) => {
items={tabs}
onChange={setActiveTab}
size="small"
- style={{ marginBottom: 12 }}
+ style={{ marginBottom: 12, marginLeft: -6 }}
/>
<EnabledModelList activeTab={currentActiveTab} />
<DisabledModels activeTab={currentActiveTab} />
diff --git a/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/Checker.tsx b/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/Checker.tsx
index c8a4c88241e..ec170bf8ffc 100644
--- a/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/Checker.tsx
+++ b/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/Checker.tsx
@@ -21,7 +21,7 @@ const Error = memo<{ error: ChatMessageError }>(({ error }) => {
<Flexbox gap={8} style={{ maxWidth: 600, width: '100%' }}>
<Alert
extra={
- <Flexbox>
+ <Flexbox paddingBlock={8} paddingInline={16}>
<Highlighter
actionIconSize={'small'}
language={'json'}
@@ -62,8 +62,6 @@ const Checker = memo<ConnectionCheckerProps>(
aiProviderSelectors.isProviderConfigUpdating(provider),
);
const totalModels = useAiInfraStore(aiModelSelectors.aiProviderChatModelListIds);
- const updateAiProviderConfig = useAiInfraStore((s) => s.updateAiProviderConfig);
- const currentConfig = useAiInfraStore(aiProviderSelectors.providerConfigById(provider));
const [loading, setLoading] = useState(false);
const [pass, setPass] = useState(false);
@@ -109,12 +107,12 @@ const Checker = memo<ConnectionCheckerProps>(
role: 'user',
},
],
- model,
+ model: checkModel,
provider,
},
trace: {
sessionId: `connection:${provider}`,
- topicId: model,
+ topicId: checkModel,
traceName: TraceNameMap.ConnectivityChecker,
},
});
@@ -134,11 +132,11 @@ const Checker = memo<ConnectionCheckerProps>(
<Select
listItemHeight={36}
onSelect={async (value) => {
+ // Changing the check model should be a local UI concern only.
+ // Persisting it to provider config would trigger global refresh/revalidation.
setCheckModel(value);
- await updateAiProviderConfig(provider, {
- ...currentConfig,
- checkModel: value,
- });
+ setPass(false);
+ setError(undefined);
}}
optionRender={({ value }) => {
return (
@@ -159,6 +157,15 @@ const Checker = memo<ConnectionCheckerProps>(
/>
<Button
disabled={isProviderConfigUpdating}
+ icon={
+ pass ? (
+ <CheckCircleFilled
+ style={{
+ color: theme.colorSuccess,
+ }}
+ />
+ ) : undefined
+ }
loading={loading}
onClick={async () => {
await onBeforeCheck();
@@ -168,21 +175,18 @@ const Checker = memo<ConnectionCheckerProps>(
await onAfterCheck();
}
}}
+ style={
+ pass
+ ? {
+ borderColor: theme.colorSuccess,
+ color: theme.colorSuccess,
+ }
+ : undefined
+ }
>
- {t('llm.checker.button')}
+ {pass ? t('llm.checker.pass') : t('llm.checker.button')}
</Button>
</Flexbox>
-
- {pass && (
- <Flexbox gap={4} horizontal>
- <CheckCircleFilled
- style={{
- color: theme.colorSuccess,
- }}
- />
- {t('llm.checker.pass')}
- </Flexbox>
- )}
{error && errorContent}
</Flexbox>
);
diff --git a/src/components/ModelSelect/index.tsx b/src/components/ModelSelect/index.tsx
index 9d9421b035e..2ad391e6bd1 100644
--- a/src/components/ModelSelect/index.tsx
+++ b/src/components/ModelSelect/index.tsx
@@ -49,6 +49,16 @@ const useStyles = createStyles(({ css, token }) => ({
`,
}));
+type TooltipStyles = ReturnType<typeof useStyles>['styles'];
+
+const DEFAULT_TOOLTIP_STYLES = {
+ root: { pointerEvents: 'none' },
+} as const satisfies ComponentProps<typeof Tooltip>['styles'];
+
+const FUNCTION_CALL_TOOLTIP_STYLES = {
+ root: { maxWidth: 'unset', pointerEvents: 'none' },
+} as const satisfies ComponentProps<typeof Tooltip>['styles'];
+
interface ModelInfoTagsProps extends ModelAbilities {
contextWindowTokens?: number | null;
directionReverse?: boolean;
@@ -63,40 +73,172 @@ interface ModelInfoTagsProps extends ModelAbilities {
withTooltip?: boolean;
}
-export const ModelInfoTags = memo<ModelInfoTagsProps>(
- ({ directionReverse, placement = 'top', withTooltip = true, ...model }) => {
+interface FeatureTagsProps extends Pick<
+ ModelAbilities,
+ 'files' | 'imageOutput' | 'vision' | 'video' | 'functionCall' | 'reasoning' | 'search'
+> {
+ placement: 'top' | 'right';
+ tagClassName: string;
+ withTooltip: boolean;
+}
+
+interface FeatureTagItemProps {
+ className: string;
+ color: Parameters<typeof Tag>[0]['color'];
+ enabled: boolean | undefined;
+ icon: Parameters<typeof Icon>[0]['icon'];
+ placement: 'top' | 'right';
+ title: string;
+ tooltipStyles?: ComponentProps<typeof Tooltip>['styles'];
+ withTooltip: boolean;
+}
+
+const FeatureTagItem = memo<FeatureTagItemProps>(
+ ({ className, color, enabled, icon, placement, title, tooltipStyles, withTooltip }) => {
+ if (!enabled) return null;
+
+ const tag = (
+ <Tag className={className} color={color} size={'small'}>
+ <Icon icon={icon} />
+ </Tag>
+ );
+
+ if (!withTooltip) return tag;
+
+ return (
+ <Tooltip placement={placement} styles={tooltipStyles ?? DEFAULT_TOOLTIP_STYLES} title={title}>
+ {tag}
+ </Tooltip>
+ );
+ },
+);
+
+const FeatureTags = memo<FeatureTagsProps>(
+ ({
+ files,
+ functionCall,
+ imageOutput,
+ placement,
+ reasoning,
+ search,
+ tagClassName,
+ video,
+ vision,
+ withTooltip,
+ }) => {
const { t } = useTranslation('components');
- const { styles } = useStyles();
- const renderTag = (
- enabled: boolean | undefined,
- getTitle: () => string,
- color: Parameters<typeof Tag>[0]['color'],
- icon: Parameters<typeof Icon>[0]['icon'],
- className = styles.tag,
- tooltipStyles?: ComponentProps<typeof Tooltip>['styles'],
- ) => {
- if (!enabled) return null;
-
- const tag = (
- <Tag className={className} color={color} size={'small'}>
- <Icon icon={icon} />
- </Tag>
- );
-
- if (!withTooltip) return tag;
-
- const title = getTitle();
- return (
- <Tooltip
+ return (
+ <>
+ <FeatureTagItem
+ className={tagClassName}
+ color={'success'}
+ enabled={files}
+ icon={LucidePaperclip}
placement={placement}
- styles={tooltipStyles ?? { root: { pointerEvents: 'none' } }}
- title={title}
- >
- {tag}
- </Tooltip>
- );
- };
+ title={t('ModelSelect.featureTag.file')}
+ withTooltip={withTooltip}
+ />
+ <FeatureTagItem
+ className={tagClassName}
+ color={'success'}
+ enabled={imageOutput}
+ icon={LucideImage}
+ placement={placement}
+ title={t('ModelSelect.featureTag.imageOutput')}
+ withTooltip={withTooltip}
+ />
+ <FeatureTagItem
+ className={tagClassName}
+ color={'success'}
+ enabled={vision}
+ icon={LucideEye}
+ placement={placement}
+ title={t('ModelSelect.featureTag.vision')}
+ withTooltip={withTooltip}
+ />
+ <FeatureTagItem
+ className={tagClassName}
+ color={'magenta'}
+ enabled={video}
+ icon={Video}
+ placement={placement}
+ title={t('ModelSelect.featureTag.video')}
+ withTooltip={withTooltip}
+ />
+ <FeatureTagItem
+ className={tagClassName}
+ color={'info'}
+ enabled={functionCall}
+ icon={ToyBrick}
+ placement={placement}
+ title={t('ModelSelect.featureTag.functionCall')}
+ tooltipStyles={FUNCTION_CALL_TOOLTIP_STYLES}
+ withTooltip={withTooltip}
+ />
+ <FeatureTagItem
+ className={tagClassName}
+ color={'purple'}
+ enabled={reasoning}
+ icon={AtomIcon}
+ placement={placement}
+ title={t('ModelSelect.featureTag.reasoning')}
+ withTooltip={withTooltip}
+ />
+ <FeatureTagItem
+ className={tagClassName}
+ color={'cyan'}
+ enabled={search}
+ icon={LucideGlobe}
+ placement={placement}
+ title={t('ModelSelect.featureTag.search')}
+ withTooltip={withTooltip}
+ />
+ </>
+ );
+ },
+);
+
+const Context = memo(
+ ({
+ contextWindowTokens,
+ withTooltip,
+ placement,
+ styles,
+ }: {
+ contextWindowTokens: number;
+ placement: 'top' | 'right';
+ styles: TooltipStyles;
+ withTooltip: boolean;
+ }) => {
+ const { t } = useTranslation('components');
+ const tokensText = contextWindowTokens === 0 ? '∞' : formatTokenNumber(contextWindowTokens);
+
+ const tag = (
+ <Tag className={styles.token} size={'small'}>
+ {contextWindowTokens === 0 ? <Infinity size={17} strokeWidth={1.6} /> : tokensText}
+ </Tag>
+ );
+
+ if (!withTooltip) return tag;
+
+ return (
+ <Tooltip
+ placement={placement}
+ // styles={styles}
+ title={t('ModelSelect.featureTag.tokens', {
+ tokens: contextWindowTokens === 0 ? '∞' : numeral(contextWindowTokens).format('0,0'),
+ })}
+ >
+ {tag}
+ </Tooltip>
+ );
+ },
+);
+
+export const ModelInfoTags = memo<ModelInfoTagsProps>(
+ ({ directionReverse, placement = 'top', withTooltip = true, ...model }) => {
+ const { styles } = useStyles();
return (
<Flexbox
@@ -106,66 +248,26 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
style={{ marginLeft: 'auto' }}
width={'fit-content'}
>
- {renderTag(model.files, () => t('ModelSelect.featureTag.file'), 'success', LucidePaperclip)}
- {renderTag(
- model.imageOutput,
- () => t('ModelSelect.featureTag.imageOutput'),
- 'success',
- LucideImage,
- )}
- {renderTag(model.vision, () => t('ModelSelect.featureTag.vision'), 'success', LucideEye)}
- {renderTag(model.video, () => t('ModelSelect.featureTag.video'), 'magenta', Video)}
- {renderTag(
- model.functionCall,
- () => t('ModelSelect.featureTag.functionCall'),
- 'info',
- ToyBrick,
- styles.tag,
- {
- root: { maxWidth: 'unset', pointerEvents: 'none' },
- },
- )}
- {renderTag(
- model.reasoning,
- () => t('ModelSelect.featureTag.reasoning'),
- 'purple',
- AtomIcon,
+ <FeatureTags
+ files={model.files}
+ functionCall={model.functionCall}
+ imageOutput={model.imageOutput}
+ placement={placement}
+ reasoning={model.reasoning}
+ search={model.search}
+ tagClassName={styles.tag}
+ video={model.video}
+ vision={model.vision}
+ withTooltip={withTooltip}
+ />
+ {typeof model.contextWindowTokens === 'number' && (
+ <Context
+ contextWindowTokens={model.contextWindowTokens}
+ placement={placement}
+ styles={styles}
+ withTooltip={withTooltip}
+ />
)}
- {renderTag(model.search, () => t('ModelSelect.featureTag.search'), 'cyan', LucideGlobe)}
- {typeof model.contextWindowTokens === 'number' &&
- (() => {
- const tokensText =
- model.contextWindowTokens === 0 ? '∞' : formatTokenNumber(model.contextWindowTokens);
-
- const tag = (
- <Tag className={styles.token} size={'small'}>
- {model.contextWindowTokens === 0 ? (
- <Infinity size={17} strokeWidth={1.6} />
- ) : (
- tokensText
- )}
- </Tag>
- );
-
- if (!withTooltip) return tag;
-
- return (
- <Tooltip
- placement={placement}
- styles={{
- root: { maxWidth: 'unset', pointerEvents: 'none' },
- }}
- title={t('ModelSelect.featureTag.tokens', {
- tokens:
- model.contextWindowTokens === 0
- ? '∞'
- : numeral(model.contextWindowTokens).format('0,0'),
- })}
- >
- {tag}
- </Tooltip>
- );
- })()}
</Flexbox>
);
},
diff --git a/src/features/AgentBuilder/TopicSelector.tsx b/src/features/AgentBuilder/TopicSelector.tsx
index 005d634fefc..55d26f37c2d 100644
--- a/src/features/AgentBuilder/TopicSelector.tsx
+++ b/src/features/AgentBuilder/TopicSelector.tsx
@@ -1,4 +1,4 @@
-import { ActionIcon, Flexbox, Tag } from '@lobehub/ui';
+import { ActionIcon, Flexbox } from '@lobehub/ui';
import { Dropdown } from 'antd';
import { createStyles } from 'antd-style';
import type { ItemType } from 'antd/es/menu/interface';
@@ -19,8 +19,11 @@ const useStyles = createStyles(({ css, token }) => ({
time: css`
font-size: 12px;
color: ${token.colorTextTertiary};
+ margin-left: 6px;
`,
title: css`
+ font-size: 14px;
+ font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@@ -61,7 +64,7 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
return {
key: topic.id,
label: (
- <Flexbox gap={4} horizontal justify="space-between" width="100%">
+ <Flexbox align="center" gap={4} horizontal justify="space-between" width="100%">
<span className={styles.title}>{topic.title}</span>
<span className={styles.time}>{displayTime}</span>
</Flexbox>
@@ -74,7 +77,9 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
return (
<NavHeader
- left={activeTopic?.title ? <Tag>{activeTopic.title}</Tag> : undefined}
+ left={
+ activeTopic?.title ? <span className={styles.title}>{activeTopic.title}</span> : undefined
+ }
right={
<>
<ActionIcon
diff --git a/src/features/ChatInput/ActionBar/Model/index.tsx b/src/features/ChatInput/ActionBar/Model/index.tsx
index 8fcd13c5009..9f447564d8f 100644
--- a/src/features/ChatInput/ActionBar/Model/index.tsx
+++ b/src/features/ChatInput/ActionBar/Model/index.tsx
@@ -17,7 +17,7 @@ import ControlsForm from './ControlsForm';
const useStyles = createStyles(({ css, token, cx }) => ({
container: css`
- border-radius: 20px;
+ border-radius: 10px;
background: ${token.colorFillTertiary};
`,
icon: cx(
@@ -41,7 +41,7 @@ const useStyles = createStyles(({ css, token, cx }) => ({
}
`,
modelWithControl: css`
- border-radius: 20px;
+ border-radius: 12px;
:hover {
background: ${token.colorFillTertiary};
@@ -105,7 +105,7 @@ const ModelSwitch = memo(() => {
placement: 'topLeft',
}}
showTooltip={false}
- style={{ borderRadius: 20, marginInlineStart: -4 }}
+ style={{ borderRadius: 12, marginInlineStart: -4 }}
title={t('extendParams.title')}
/>
)}
diff --git a/src/features/DevPanel/features/FloatPanel.tsx b/src/features/DevPanel/features/FloatPanel.tsx
index 485c0389225..edfe88f5c2c 100644
--- a/src/features/DevPanel/features/FloatPanel.tsx
+++ b/src/features/DevPanel/features/FloatPanel.tsx
@@ -112,7 +112,7 @@ const CollapsibleFloatPanel = memo<CollapsibleFloatPanelProps>(({ items }) => {
<>
{
// desktop devtools δΈ‹ιšθ—
- pathname !== '/desktop/devtools' && (
+ pathname !== '/desktop/devtools' && isDesktop && (
<FloatButton
className={styles.floatButton}
icon={<Icon icon={isExpanded ? BugOff : BugIcon} />}