Merge pull request #7 from FooFindBar/auto-proxy-by-timezone

feat: add timezone-based proxy configuration and fix minor issues
This commit is contained in:
Wendong-Fan 2025-07-30 04:44:41 +08:00 committed by GitHub
commit bd23293e5d
8 changed files with 1435 additions and 1411 deletions

2782
backend/uv.lock generated

File diff suppressed because it is too large Load diff

View file

@ -96,8 +96,13 @@ export async function installDependencies() {
// touch installing lock file
const installingLockPath = path.join(backendPath, 'uv_installing.lock')
fs.writeFileSync(installingLockPath, '')
const node_process = spawn(uv_path, ['sync', '--no-dev'], { cwd: backendPath })
const proxy = ['--default-index', 'https://pypi.tuna.tsinghua.edu.cn/simple']
function isInChinaTimezone() {
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
return timezone === 'Asia/Shanghai';
}
console.log('isInChinaTimezone', isInChinaTimezone())
const node_process = spawn(uv_path, ['sync', '--no-dev', ...(isInChinaTimezone() ? proxy : [])], { cwd: backendPath })
node_process.stdout.on('data', (data) => {
log.info(`Script output: ${data}`)
// notify frontend install log
@ -168,7 +173,7 @@ export async function startBackend(setPort?: (port: number) => void): Promise<an
["run", "uvicorn", "main:api", "--port", port.toString(), "--loop", "asyncio"],
{ cwd: backendPath, env: env, detached: false }
);
let started = false;
@ -229,7 +234,7 @@ function checkPortAvailable(port: number): Promise<boolean> {
if (err.code === 'EADDRINUSE') {
resolve(false); // port occupied
} else {
resolve(false);
resolve(false);
}
});

View file

@ -1,6 +1,6 @@
{
"name": "Eigent",
"version": "0.0.36",
"version": "0.0.37",
"main": "dist-electron/main/index.js",
"description": "Eigent",
"author": "eigent",

View file

@ -1,7 +1,7 @@
import React, { useState, useEffect } from "react";
import { useAuthStore } from "@/store/authStore";
import { ProgressInstall } from "@/components/ui/progress-install";
import { RotateCcw } from "lucide-react";
import { RefreshCcw, RotateCcw } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Permissions } from "@/components/InstallStep/Permissions";
import { CarouselStep } from "@/components/InstallStep/Carousel";
@ -90,7 +90,10 @@ export const InstallDependencies: React.FC<{
await window.electronAPI.frontendReady();
}
} catch (error) {
console.log("frontend ready notification failed, maybe manual install mode:", error);
console.log(
"frontend ready notification failed, maybe manual install mode:",
error
);
}
};
@ -117,7 +120,11 @@ export const InstallDependencies: React.FC<{
if (!result.success) {
setStatus("error");
setIsInstalling(false);
return
}
setStatus("success");
setProgress(100);
setIsInstalling(false);
} catch (error) {
console.error("install start failed:", error);
setStatus("error");
@ -151,8 +158,13 @@ export const InstallDependencies: React.FC<{
value={isInstalling ? progress : 100}
className="w-full"
/>
<div className="text-text-label text-xs font-normal leading-tight">
{isInstalling ? "System Installing ..." : ""}
<div className="flex items-center gap-2 justify-between">
<div className="text-text-label text-xs font-normal leading-tight">
{isInstalling ? "System Installing ..." : ""}
</div>
<Button size="icon" variant="outline" className="mt-1" onClick={handleInstall}>
<RefreshCcw className="w-4 h-4" />
</Button>
</div>
</div>
</div>

View file

@ -6,9 +6,7 @@ export function showCreditsToast() {
You've reached the limit of your current plan.
<a
className="underline cursor-pointer"
onClick={() =>
(window.location.href = "https://www.eigent.ai/pricing")
}
onClick={() => (window.location.href = "https://www.eigent.ai/pricing")}
>
Upgrade
</a>{" "}
@ -20,6 +18,9 @@ export function showCreditsToast() {
Settings
</a>{" "}
.
</div>
</div>,
{
duration: Infinity,
}
);
}

View file

@ -14,6 +14,9 @@ export function showStorageToast() {
</a>{" "}
your account or store your historical content locally. You've reached the
limit of your current plan.
</div>
</div>,
{
duration: Infinity,
}
);
}

View file

@ -252,6 +252,9 @@ export default function Login() {
or
</div>
<div className="w-full">
{generalError && (
<p className="text-red-500 text-sm mt-0.5 mb-4">{generalError}</p>
)}
<div className="w-full mb-4 relative">
<Label
htmlFor="email"
@ -267,7 +270,7 @@ export default function Login() {
required
value={formData.email}
onChange={(e) => handleInputChange("email", e.target.value)}
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-[#CCC] font-normal ${
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-input-text-focus font-normal ${
errors.email ? "border-red-500" : ""
}`}
/>
@ -280,7 +283,7 @@ export default function Login() {
<div className="flex items-center">
<Label
htmlFor="password"
className="inline-block text-[#222] font-inter text-[13px] font-normal font-bold leading-5 h-5 mb-1.5"
className="inline-block text-[#222] font-inter text-[13px] font-bold leading-5 h-5 mb-1.5"
>
Password
</Label>
@ -304,7 +307,7 @@ export default function Login() {
onChange={(e) =>
handleInputChange("password", e.target.value)
}
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-[#CCC] font-normal pr-9 ${
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-input-text-focus font-normal pr-9 ${
errors.password ? "border-red-500" : ""
}`}
/>

View file

@ -287,7 +287,7 @@ export default function SignUp() {
required
value={formData.email}
onChange={(e) => handleInputChange("email", e.target.value)}
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-[#CCC] font-normal ${errors.email ? "border-red-500" : ""}`}
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-input-text-focus font-normal ${errors.email ? "border-red-500" : ""}`}
/>
</div>
{errors.email && (
@ -319,7 +319,7 @@ export default function SignUp() {
onChange={(e) =>
handleInputChange("password", e.target.value)
}
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-[#CCC] font-normal pr-9 ${errors.password ? "border-red-500" : ""}`}
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-input-text-focus font-normal pr-9 ${errors.password ? "border-red-500" : ""}`}
/>
</div>
{errors.password && (
@ -342,7 +342,7 @@ export default function SignUp() {
onChange={(e) =>
handleInputChange("invite_code", e.target.value)
}
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-[#CCC] font-normal ${errors.invite_code ? "border-red-500" : ""}`}
className={`rounded border border-[#CCC] bg-white shadow-none text-[13px] text-input-text-focus font-normal ${errors.invite_code ? "border-red-500" : ""}`}
/>
</div>
{errors.invite_code && (