Skip to content

Commit 567cac9

Browse files
author
lichunxian
committed
Merge branch 'feature/1.4' into 'main'
chroe: optimize AI model node graphics See merge request apipark/APIPark!161
2 parents e9c9498 + 095c09c commit 567cac9

File tree

3 files changed

+44
-37
lines changed

3 files changed

+44
-37
lines changed

frontend/packages/core/src/pages/aiSetting/components/KeyStatusNode.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const KeyStatusNode: React.FC<{ data: KeyStatusNodeData }> = ({ data }) =
2727
<div
2828
className="flex gap-1 w-full"
2929
style={{
30+
minWidth: keys.length > 5 ? '118px' : 'auto',
3031
maxWidth: `calc(${MAX_KEYS} * ${KEY_SIZE} + (${MAX_KEYS} - 1) * ${KEY_GAP})`,
3132
minHeight: KEY_SIZE
3233
}}

frontend/packages/core/src/pages/aiSetting/components/ModelCardNode.tsx

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,46 +29,48 @@ export const ModelCardNode: React.FC<{ data: ModelCardNodeData }> = ({ data }) =
2929
const statusConfig = getStatusIcon(status)
3030

3131
return (
32-
<div
33-
className="node-card bg-white rounded-lg shadow-sm p-4 min-w-[280px] group"
34-
style={{ border: '1px solid var(--border-color)' }}
35-
>
36-
<Handle type="target" position={Position.Left} />
37-
<Handle type="source" position={Position.Right} />
38-
<div>
39-
<div className="flex justify-between items-center">
40-
<div className="flex gap-2 items-center">
41-
<div className="flex flex-1 overflow-hidden items-center gap-[4px]">
42-
<span
43-
className="flex items-center h-[22px] ai-setting-svg-container"
44-
dangerouslySetInnerHTML={{ __html: logo }}
45-
></span>
32+
<>
33+
<div
34+
className="node-card bg-white rounded-lg shadow-sm p-4 min-w-[280px] group"
35+
style={{ border: '1px solid var(--border-color)' }}
36+
>
37+
<Handle type="target" position={Position.Left} />
38+
<Handle type="source" position={Position.Right} />
39+
<div>
40+
<div className="flex justify-between items-center">
41+
<div className="flex gap-2 items-center">
42+
<div className="flex flex-1 overflow-hidden items-center gap-[4px]">
43+
<span
44+
className="flex items-center h-[22px] ai-setting-svg-container"
45+
dangerouslySetInnerHTML={{ __html: logo }}
46+
></span>
47+
</div>
48+
<span className="text-base text-gray-900 max-w-[180px] truncate">{name}</span>
49+
<Icon icon={statusConfig?.icon} className={`text-xl ${statusConfig?.color}`} />
4650
</div>
47-
<span className="text-base text-gray-900 max-w-[180px] truncate">{name}</span>
48-
<Icon icon={statusConfig?.icon} className={`text-xl ${statusConfig?.color}`} />
49-
</div>
5051

51-
{/* Action buttons */}
52-
<div className="flex gap-2 transition-opacity duration-200">
53-
<Icon
54-
icon="mdi:cog"
55-
className="text-xl text-gray-400 cursor-pointer hover:text-[--primary-color]"
56-
onClick={() => {
57-
openConfigModal({ id: data.id, defaultLlm: defaultLlm } as AiSettingListItem)
58-
}}
59-
/>
52+
{/* Action buttons */}
53+
<div className="flex gap-2 transition-opacity duration-200">
54+
<Icon
55+
icon="mdi:cog"
56+
className="text-xl text-gray-400 cursor-pointer hover:text-[--primary-color]"
57+
onClick={() => {
58+
openConfigModal({ id: data.id, defaultLlm: defaultLlm } as AiSettingListItem)
59+
}}
60+
/>
61+
</div>
6062
</div>
61-
</div>
62-
<div className="mt-2 text-sm text-gray-500">
63-
{$t('默认:')}
64-
{defaultLlm}
65-
</div>
66-
{status !== 'enabled' && alternativeModel && (
67-
<div className="mt-1 text-sm text-gray-500">
68-
{$t('关联 API 已转用')} {alternativeModel.name}/{alternativeModel.defaultLlm}
63+
<div className="mt-2 text-sm text-gray-500">
64+
{$t('默认:')}
65+
{defaultLlm}
6966
</div>
70-
)}
67+
</div>
7168
</div>
72-
</div>
69+
{status !== 'enabled' && alternativeModel && (
70+
<div className="ml-4 mt-1 text-sm text-gray-500">
71+
{$t('关联 API 已转用')} {alternativeModel.name}/{alternativeModel.defaultLlm}
72+
</div>
73+
)}
74+
</>
7375
)
7476
}

frontend/packages/core/src/pages/aiSetting/styles.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@
1818
.react-flow__node {
1919
padding: 0;
2020
border-radius: 8px;
21-
min-width: 150px;
2221
width: auto;
2322
max-width: 100%;
2423
}
2524

25+
.react-flow__node-modelCard,
26+
.react-flow__node-serviceCard {
27+
min-width: 150px;
28+
}
29+
2630
/* Custom Node Styles */
2731
.custom-node {
2832
background: white;

0 commit comments

Comments
 (0)