Skip to content

Commit 15a5157

Browse files
authored
♻️ Refactor: The Agent information bar uses AntD style #1133
2 parents 1eb3814 + 74c63b2 commit 15a5157

File tree

1 file changed

+73
-78
lines changed

1 file changed

+73
-78
lines changed

frontend/app/[locale]/setup/agentSetup/components/agent/AgentConfigModal.tsx

Lines changed: 73 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useState, useEffect, useCallback } from "react";
44
import { useTranslation } from "react-i18next";
5-
import { Button, Modal, Spin } from "antd";
5+
import { Button, Modal, Spin, Input, Select, InputNumber } from "antd";
66
import {
77
ExpandAltOutlined,
88
SaveOutlined,
@@ -367,20 +367,15 @@ export default function AgentConfigModal({
367367
<label className="block text-sm font-medium text-gray-700 mb-1">
368368
{t("agent.displayName")}:
369369
</label>
370-
<input
371-
type="text"
370+
<Input
372371
value={agentDisplayName}
373372
onChange={(e) => {
374373
handleAgentDisplayNameChange(e.target.value);
375374
}}
376375
placeholder={t("agent.displayNamePlaceholder")}
377-
className={`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 box-border ${
378-
agentDisplayNameError ||
379-
agentDisplayNameStatus === NAME_CHECK_STATUS.EXISTS_IN_TENANT
380-
? "border-red-500 focus:ring-red-500 focus:border-red-500"
381-
: "border-gray-300 focus:ring-blue-500 focus:border-blue-500"
382-
}`}
376+
size="large"
383377
disabled={!isEditingMode}
378+
status={agentDisplayNameError || agentDisplayNameStatus === NAME_CHECK_STATUS.EXISTS_IN_TENANT ? "error" : ""}
384379
/>
385380
{agentDisplayNameError && (
386381
<p className="mt-1 text-sm text-red-600">{agentDisplayNameError}</p>
@@ -400,19 +395,15 @@ export default function AgentConfigModal({
400395
<label className="block text-sm font-medium text-gray-700 mb-1">
401396
{t("agent.name")}:
402397
</label>
403-
<input
404-
type="text"
398+
<Input
405399
value={agentName}
406400
onChange={(e) => {
407401
handleAgentNameChange(e.target.value);
408402
}}
409403
placeholder={t("agent.namePlaceholder")}
410-
className={`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 box-border ${
411-
agentNameError || agentNameStatus === NAME_CHECK_STATUS.EXISTS_IN_TENANT
412-
? "border-red-500 focus:ring-red-500 focus:border-red-500"
413-
: "border-gray-300 focus:ring-blue-500 focus:border-blue-500"
414-
}`}
404+
size="large"
415405
disabled={!isEditingMode}
406+
status={agentNameError || agentNameStatus === NAME_CHECK_STATUS.EXISTS_IN_TENANT ? "error" : ""}
416407
/>
417408
{agentNameError && (
418409
<p className="mt-1 text-sm text-red-600">{agentNameError}</p>
@@ -429,34 +420,35 @@ export default function AgentConfigModal({
429420
<label className="block text-sm font-medium text-gray-700 mb-1">
430421
{t("businessLogic.config.model")}:
431422
</label>
432-
<select
423+
<Select
433424
value={mainAgentModel}
434-
onChange={(e) => onModelChange?.(e.target.value)}
435-
className="w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 box-border"
425+
onChange={(value) => onModelChange?.(value)}
426+
size="large"
436427
disabled={!isEditingMode}
428+
style={{ width: "100%" }}
437429
>
438-
<option value={OpenAIModel.MainModel}>
430+
<Select.Option value={OpenAIModel.MainModel}>
439431
{t("model.option.main")}
440-
</option>
441-
<option value={OpenAIModel.SubModel}>{t("model.option.sub")}</option>
442-
</select>
432+
</Select.Option>
433+
<Select.Option value={OpenAIModel.SubModel}>
434+
{t("model.option.sub")}
435+
</Select.Option>
436+
</Select>
443437
</div>
444438

445439
{/* Max Steps */}
446440
<div className="mb-2">
447441
<label className="block text-sm font-medium text-gray-700 mb-1">
448442
{t("businessLogic.config.maxSteps")}:
449443
</label>
450-
<input
451-
type="number"
444+
<InputNumber
452445
min={1}
453446
max={20}
454447
value={mainAgentMaxStep}
455-
onChange={(e) =>
456-
onMaxStepChange?.(e.target.value ? Number(e.target.value) : null)
457-
}
458-
className="w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 box-border"
448+
onChange={(value) => onMaxStepChange?.(value)}
449+
size="large"
459450
disabled={!isEditingMode}
451+
style={{ width: "100%" }}
460452
/>
461453
</div>
462454

@@ -465,16 +457,17 @@ export default function AgentConfigModal({
465457
<label className="block text-sm font-medium text-gray-700 mb-1">
466458
{t("agent.description")}:
467459
</label>
468-
<textarea
460+
<Input.TextArea
469461
value={agentDescription}
470462
onChange={(e) => onAgentDescriptionChange?.(e.target.value)}
471463
placeholder={t("agent.descriptionPlaceholder")}
472-
rows={4}
473-
className="w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none box-border"
464+
rows={6}
465+
size="large"
474466
disabled={!isEditingMode}
475467
style={{
476-
minHeight: "100px",
477-
maxHeight: "150px",
468+
minHeight: "150px",
469+
maxHeight: "200px",
470+
boxShadow: "none",
478471
}}
479472
/>
480473
</div>
@@ -492,6 +485,7 @@ export default function AgentConfigModal({
492485
onDutyContentChange(value);
493486
}
494487
}}
488+
height="200px"
495489
/>
496490
</div>
497491
);
@@ -507,6 +501,7 @@ export default function AgentConfigModal({
507501
onConstraintContentChange(value);
508502
}
509503
}}
504+
height="200px"
510505
/>
511506
</div>
512507
);
@@ -522,6 +517,7 @@ export default function AgentConfigModal({
522517
onFewShotsContentChange(value);
523518
}
524519
}}
520+
height="200px"
525521
/>
526522
</div>
527523
);
@@ -612,18 +608,24 @@ export default function AgentConfigModal({
612608
{(activeSegment === "duty" ||
613609
activeSegment === "constraint" ||
614610
activeSegment === "few-shots") && (
615-
<button
611+
<Button
616612
onClick={() => {
617613
if (activeSegment === "duty") onExpandCard?.(2);
618614
else if (activeSegment === "constraint") onExpandCard?.(3);
619615
else if (activeSegment === "few-shots") onExpandCard?.(4);
620616
}}
621-
className="absolute top-2 right-4 z-20 p-1.5 rounded-full bg-white/90 hover:bg-white text-gray-500 hover:text-gray-700 transition-all duration-200 shadow-sm hover:shadow-md"
622-
style={{ border: "none" }}
617+
className="absolute top-2 right-4 z-20"
618+
style={{
619+
borderRadius: "50%",
620+
backgroundColor: "rgba(255, 255, 255, 0.9)",
621+
border: "none",
622+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.1)"
623+
}}
623624
title={t("systemPrompt.button.expand")}
624-
>
625-
<ExpandAltOutlined className="text-xs" />
626-
</button>
625+
icon={<ExpandAltOutlined />}
626+
size="small"
627+
type="text"
628+
/>
627629
)}
628630

629631
<style jsx global>{`
@@ -716,40 +718,6 @@ export default function AgentConfigModal({
716718
}
717719
}
718720
719-
/* Generating prompt overlay styles */
720-
.generating-overlay {
721-
position: absolute;
722-
top: 0;
723-
left: 0;
724-
right: 0;
725-
bottom: 0;
726-
background: rgba(255, 255, 255, 0.9);
727-
backdrop-filter: blur(2px);
728-
display: flex;
729-
flex-direction: column;
730-
justify-content: center;
731-
align-items: center;
732-
z-index: 1000;
733-
border-radius: 8px;
734-
}
735-
736-
.generating-content {
737-
text-align: center;
738-
color: #1890ff;
739-
}
740-
741-
.generating-text {
742-
margin-top: 16px;
743-
font-size: 16px;
744-
font-weight: 500;
745-
color: #1890ff;
746-
}
747-
748-
.generating-subtext {
749-
margin-top: 8px;
750-
font-size: 14px;
751-
color: #666;
752-
}
753721
754722
/* Fix Ant Design button hover border color issues - ensure consistent color scheme */
755723
.responsive-button.ant-btn:hover {
@@ -913,11 +881,38 @@ export default function AgentConfigModal({
913881

914882
{/* Generating prompt overlay */}
915883
{isGeneratingAgent && (
916-
<div className="generating-overlay">
917-
<div className="generating-content">
884+
<div
885+
style={{
886+
position: "absolute",
887+
top: 0,
888+
left: 0,
889+
right: 0,
890+
bottom: 0,
891+
background: "rgba(255, 255, 255, 0.9)",
892+
backdropFilter: "blur(2px)",
893+
display: "flex",
894+
flexDirection: "column",
895+
justifyContent: "center",
896+
alignItems: "center",
897+
zIndex: 1000,
898+
borderRadius: "8px",
899+
}}
900+
>
901+
<div style={{ textAlign: "center", color: "#1890ff" }}>
918902
<Spin size="large" />
919-
<div className="generating-text">{t("agent.generating.title")}</div>
920-
<div className="generating-subtext">
903+
<div style={{
904+
marginTop: "16px",
905+
fontSize: "16px",
906+
fontWeight: 500,
907+
color: "#1890ff"
908+
}}>
909+
{t("agent.generating.title")}
910+
</div>
911+
<div style={{
912+
marginTop: "8px",
913+
fontSize: "14px",
914+
color: "#666"
915+
}}>
921916
{t("agent.generating.subtitle")}
922917
</div>
923918
</div>

0 commit comments

Comments
 (0)