fix(ui): fix alignment and spacing issues

This commit is contained in:
sw3205933776 2025-08-06 18:43:36 +08:00
parent cbb54e566e
commit 3a006ae64d
8 changed files with 185 additions and 161 deletions

View file

@ -1,3 +1,5 @@
VITE_BASE_URL=/api
VITE_PROXY_URL=https://dev.eigent.ai
VITE_PROXY_URL=https://dev.eigent.ai
VITE_USE_LOCAL_PROXY=false

View file

@ -23,13 +23,7 @@ export function showCreditsToast() {
</div>,
{
duration: Infinity,
action: {
label: "Undo",
onClick: () => {
console.log("Undo clicked");
toast.dismiss();
},
},
closeButton: true,
}
);
}

View file

@ -19,13 +19,7 @@ export function showStorageToast() {
</div>,
{
duration: Infinity,
action: {
label: "Undo",
onClick: () => {
console.log("Undo clicked");
toast.dismiss();
},
},
closeButton: true,
}
);
}

View file

@ -9,13 +9,7 @@ export function showTrafficToast() {
</div>,
{
duration: 5000,
action: {
label: "Undo",
onClick: () => {
console.log("Undo clicked");
toast.dismiss();
},
},
closeButton: true,
}
);
}

View file

@ -59,7 +59,7 @@ function HeaderWin() {
}
if (response.savedPath) {
window.location.href =
"https://eigent-ai.notion.site/23c511c70ba28030ab28e49e5010eca0?pvs=105";
"https://github.com/eigent-ai/eigent/issues/new/choose";
alert("log saved:" + response.savedPath);
}
} catch (e: any) {
@ -141,14 +141,7 @@ function HeaderWin() {
</>
)}
<Button
onClick={exportLog}
variant="ghost"
size="icon"
className="mr-2 no-drag"
>
<FileDown className="w-4 h-4" />
</Button>
</div>
<div id="maximize-window" className="flex-1 h-10"></div>
{/* right */}
@ -157,6 +150,15 @@ function HeaderWin() {
platform === "darwin" && "pr-2"
} flex h-full items-center space-x-1 z-50 relative no-drag`}
>
<Button
onClick={exportLog}
variant="outline"
size="xs"
className="mr-2 no-drag leading-tight"
>
<FileDown className="w-4 h-4" />
Export Log
</Button>
<Button
onClick={() => {
window.location.href = "https://www.eigent.ai/dashboard";

View file

@ -165,8 +165,10 @@ export default function SettingModels() {
}
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
fetchSubscription();
updateCredits();
if (import.meta.env.VITE_USE_LOCAL_PROXY !== "true") {
fetchSubscription();
updateCredits();
}
}, []);
const handleVerify = async (idx: number) => {
@ -219,20 +221,34 @@ export default function SettingModels() {
console.log("success");
toast("validate success", {
description: "Verify model supports function calling to use Eigent.",
action: {
label: "Undo",
onClick: () => console.log("Undo"),
},
closeButton: true,
});
} else {
console.log("failed", res.message);
toast("validate failed", {
description:
"This model doesn't support Eigent's required capabilities (e.g., tool calls). Please switch models and try again.",
action: {
label: "Undo",
onClick: () => console.log("Undo"),
},
description: (
<div
style={{
maxHeight: "120px",
overflowY: "auto",
}}
>
<div>{res.message}</div>
<div className="flex justify-end">
<Button
size="xs"
variant="primary"
onClick={() => {
navigator.clipboard.writeText(res.message);
toast.success("Copied to clipboard");
}}
>
Copy
</Button>
</div>
</div>
),
closeButton: true,
});
return;
@ -362,20 +378,34 @@ export default function SettingModels() {
toast("validate success", {
description:
"Verify model supports function calling to use Eigent.",
action: {
label: "Undo",
onClick: () => console.log("Undo"),
},
closeButton: true,
});
} else {
console.log("failed", res.message);
toast("validate failed", {
description:
"This model doesn't support Eigent's required capabilities (e.g., tool calls). Please switch models and try again.",
action: {
label: "Undo",
onClick: () => console.log("Undo"),
},
description: (
<div
style={{
maxHeight: "120px",
overflowY: "auto",
}}
>
<div>{res.message}</div>
<div className="flex justify-end">
<Button
size="xs"
variant="primary"
onClick={() => {
navigator.clipboard.writeText(res.message);
toast.success("Copied to clipboard");
}}
>
Copy
</Button>
</div>
</div>
),
closeButton: true,
});
return;
@ -526,117 +556,122 @@ export default function SettingModels() {
return (
<div className="space-y-2">
<div className="w-[630px] pt-4 self-stretch px-6 py-4 bg-surface-secondary rounded-2xl inline-flex flex-col justify-start items-start gap-4">
<div className="self-stretch flex flex-col justify-start items-start gap-1">
<div className="self-stretch h-6 inline-flex justify-start items-center gap-2.5">
<div className="flex-1 justify-center text-text-body text-base font-bold leading-snug">
Eigent Cloud Version
{import.meta.env.VITE_USE_LOCAL_PROXY !== "true" && (
<div className="w-[630px] pt-4 self-stretch px-6 py-4 bg-surface-secondary rounded-2xl inline-flex flex-col justify-start items-start gap-4">
<div className="self-stretch flex flex-col justify-start items-start gap-1">
<div className="self-stretch h-6 inline-flex justify-start items-center gap-2.5">
<div className="flex-1 justify-center text-text-body text-base font-bold leading-snug">
Eigent Cloud Version
</div>
<Switch
checked={cloudPrefer}
onCheckedChange={(checked) => {
if (checked) {
setLocalPrefer(false);
setActiveModelIdx(null);
setForm((f) => f.map((fi) => ({ ...fi, prefer: false })));
setCloudPrefer(true);
setModelType("cloud");
} else {
setCloudPrefer(false);
setModelType("custom");
}
}}
/>
</div>
<Switch
checked={cloudPrefer}
onCheckedChange={(checked) => {
if (checked) {
setLocalPrefer(false);
setActiveModelIdx(null);
setForm((f) => f.map((fi) => ({ ...fi, prefer: false })));
setCloudPrefer(true);
setModelType("cloud");
} else {
setCloudPrefer(false);
setModelType("custom");
}
}}
/>
</div>
<div className="self-stretch justify-center">
<span className="text-text-body text-xs font-normal font-['Inter'] leading-tight">
You are currently subscribed to the{" "}
{subscription?.plan_key?.charAt(0).toUpperCase() +
subscription?.plan_key?.slice(1)}
. Discover more about our{" "}
</span>
<span
onClick={() => {
window.location.href = `https://www.eigent.ai/pricing`;
}}
className="cursor-pointer text-text-body text-xs font-normal font-['Inter'] underline leading-tight"
>
pricing options
</span>
<span className="text-text-body text-xs font-normal font-['Inter'] leading-tight">
.
</span>
</div>
</div>
<div className="flex flex-row items-center justify-start gap-2 mt-2 w-full">
<Button
onClick={() => {
window.location.href = `https://www.eigent.ai/dashboard`;
}}
variant="primary"
size="sm"
>
{loadingCredits ? (
<Loader2 className="w-4 h-4 animate-spin" />
) : (
subscription?.plan_key?.charAt(0).toUpperCase() +
subscription?.plan_key?.slice(1)
)}
<Settings />
</Button>
<div className="text-text-body text-sm font-normal font-['Inter'] leading-tight">
Credits:{" "}
{loadingCredits ? (
<Loader2 className="w-4 h-4 animate-spin" />
) : (
credits
)}
</div>
</div>
<div className="w-full flex items-center flex-1 justify-between pt-4 border-t border-border-secondary">
<div className="flex items-center flex-1 min-w-0">
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-xs font-medium leading-tight">
Select Model Type
</span>
<Tooltip>
<TooltipTrigger asChild>
<span className="ml-1 cursor-pointer inline-flex items-center">
<Info className="w-4 h-4 text-gray-400" />
</span>
</TooltipTrigger>
<TooltipContent
side="top"
className="flex items-center justify-center text-center min-w-[220px] min-h-[40px]"
<div className="self-stretch justify-center">
<span className="text-text-body text-xs font-normal font-['Inter'] leading-tight">
You are currently subscribed to the{" "}
{subscription?.plan_key?.charAt(0).toUpperCase() +
subscription?.plan_key?.slice(1)}
. Discover more about our{" "}
</span>
<span
onClick={() => {
window.location.href = `https://www.eigent.ai/pricing`;
}}
className="cursor-pointer text-text-body text-xs font-normal font-['Inter'] underline leading-tight"
>
<span className="w-full flex items-center justify-center">
{cloud_model_type === "gpt-4.1-mini"
? "GPT-4.1 Mini: Lower cost, faster responses, but reduced output quality."
: cloud_model_type === "gpt-4.1"
? "GPT-4.1: Higher cost, slower responses, but superior quality and reasoning."
: "Gemini 2.5 Pro: Higher cost, slower responses, but superior quality and reasoning."}
</span>
</TooltipContent>
</Tooltip>
pricing options
</span>
<span className="text-text-body text-xs font-normal font-['Inter'] leading-tight">
.
</span>
</div>
</div>
<div className="flex-shrink-0">
<Select value={cloud_model_type} onValueChange={setCloudModelType}>
<SelectTrigger className="h-7 min-w-[160px] px-3 py-1 text-xs">
<SelectValue placeholder="Select Model Type" />
</SelectTrigger>
<SelectContent className="bg-input-bg-default">
<SelectItem value="gemini/gemini-2.5-pro">
Gemini 2.5 Pro
</SelectItem>
<SelectItem value="gemini-2.5-flash">
Gemini 2.5 Flash
</SelectItem>
<SelectItem value="gpt-4.1-mini">GPT-4.1 mini</SelectItem>
<SelectItem value="gpt-4.1">GPT-4.1</SelectItem>
</SelectContent>
</Select>
<div className="flex flex-row items-center justify-start gap-2 mt-2 w-full">
<Button
onClick={() => {
window.location.href = `https://www.eigent.ai/dashboard`;
}}
variant="primary"
size="sm"
>
{loadingCredits ? (
<Loader2 className="w-4 h-4 animate-spin" />
) : (
subscription?.plan_key?.charAt(0).toUpperCase() +
subscription?.plan_key?.slice(1)
)}
<Settings />
</Button>
<div className="text-text-body text-sm font-normal font-['Inter'] leading-tight">
Credits:{" "}
{loadingCredits ? (
<Loader2 className="w-4 h-4 animate-spin" />
) : (
credits
)}
</div>
</div>
<div className="w-full flex items-center flex-1 justify-between pt-4 border-t border-border-secondary">
<div className="flex items-center flex-1 min-w-0">
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-xs font-medium leading-tight">
Select Model Type
</span>
<Tooltip>
<TooltipTrigger asChild>
<span className="ml-1 cursor-pointer inline-flex items-center">
<Info className="w-4 h-4 text-gray-400" />
</span>
</TooltipTrigger>
<TooltipContent
side="top"
className="flex items-center justify-center text-center min-w-[220px] min-h-[40px]"
>
<span className="w-full flex items-center justify-center">
{cloud_model_type === "gpt-4.1-mini"
? "GPT-4.1 Mini: Lower cost, faster responses, but reduced output quality."
: cloud_model_type === "gpt-4.1"
? "GPT-4.1: Higher cost, slower responses, but superior quality and reasoning."
: "Gemini 2.5 Pro: Higher cost, slower responses, but superior quality and reasoning."}
</span>
</TooltipContent>
</Tooltip>
</div>
<div className="flex-shrink-0">
<Select
value={cloud_model_type}
onValueChange={setCloudModelType}
>
<SelectTrigger className="h-7 min-w-[160px] px-3 py-1 text-xs">
<SelectValue placeholder="Select Model Type" />
</SelectTrigger>
<SelectContent className="bg-input-bg-default">
<SelectItem value="gemini/gemini-2.5-pro">
Gemini 2.5 Pro
</SelectItem>
<SelectItem value="gemini-2.5-flash">
Gemini 2.5 Flash
</SelectItem>
<SelectItem value="gpt-4.1-mini">GPT-4.1 mini</SelectItem>
<SelectItem value="gpt-4.1">GPT-4.1</SelectItem>
</SelectContent>
</Select>
</div>
</div>
</div>
</div>
)}
{/* customer models */}
<div className="self-stretch pt-4 border-t border-border-disabled inline-flex flex-col justify-start items-start gap-4">
<div className="self-stretch inline-flex justify-start items-center gap-2 relative px-6">

View file

@ -336,7 +336,7 @@ export default function SignUp() {
<Input
id="invite_code"
type="text"
placeholder="Enter your invite code"
placeholder="Enter your invite code(optional)"
required
value={formData.invite_code}
onChange={(e) =>

View file

@ -783,7 +783,7 @@ const chatStore = create<ChatStore>()(
addFileList(taskId, agentMessages.data.process_task_id as string, fileInfo);
// Async file upload
if (!type && file_path && !import.meta.env.DEV) {
if (!type && file_path && import.meta.env.VITE_USE_LOCAL_PROXY!=='true') {
(async () => {
try {
// Read file content using Electron API
@ -1612,6 +1612,9 @@ const chatStore = create<ChatStore>()(
// return ''
// }
const filterMessage = (message: AgentMessage) => {
if (message.data.toolkit_name?.includes('Search ')) {
message.data.toolkit_name='Search '
}
if (message.data.toolkit_name === 'Note Taking Toolkit') {
message.data.message = message.data.message!.replace(/content='/g, '').replace(/', update=False/g, '').replace(/', update=True/g, '')
}