Skip to content

Commit 6afbd03

Browse files
authored
add test env (#1565)
1 parent 8b10717 commit 6afbd03

15 files changed

Lines changed: 47 additions & 28 deletions

File tree

.env.development

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
VITE_BASE_URL=/api
22

3+
# =======Production environment variables=======
4+
SERVER_URL=https://dev.eigent.ai
35
VITE_PROXY_URL=https://dev.eigent.ai
6+
VITE_SITE_URL=https://www.eigent.ai
47
VITE_USE_LOCAL_PROXY=false
58

9+
# =======Local environment variables=======
610
# VITE_PROXY_URL=http://localhost:3001
711
# VITE_USE_LOCAL_PROXY=true
812

backend/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

electron/main/init.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,16 @@ export async function startBackend(
289289
}
290290
}
291291

292+
// In dev mode, also check .env.development for SERVER_URL
293+
if (!resolvedServerUrl && devServerUrl) {
294+
const devEnvPath = path.join(app.getAppPath(), '.env.development');
295+
const devFileServerUrl = readEnvValue(devEnvPath, 'SERVER_URL');
296+
if (devFileServerUrl) {
297+
resolvedServerUrl = devFileServerUrl;
298+
resolvedSource = `dev env file SERVER_URL (${devEnvPath})`;
299+
}
300+
}
301+
292302
if (!resolvedServerUrl && process.env.SERVER_URL) {
293303
resolvedServerUrl = process.env.SERVER_URL;
294304
resolvedSource = 'process.env SERVER_URL';

src/components/Toast/creditsToast.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
1414

1515
import i18n from '@/i18n';
16+
import { SITE_URL } from '@/lib';
1617
import { toast } from 'sonner';
1718

1819
export function showCreditsToast() {
@@ -22,7 +23,7 @@ export function showCreditsToast() {
2223
{i18n.t('chat.you-ve-reached-the-limit-of-your-current-plan')}
2324
<a
2425
className="cursor-pointer underline"
25-
onClick={() => (window.location.href = 'https://www.eigent.ai/pricing')}
26+
onClick={() => (window.location.href = `${SITE_URL}/pricing`)}
2627
>
2728
{i18n.t('chat.upgrade')}
2829
</a>{' '}

src/components/Toast/storageToast.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
1414

1515
import i18n from '@/i18n';
16+
import { SITE_URL } from '@/lib';
1617
import { toast } from 'sonner';
1718

1819
export function showStorageToast() {
@@ -25,7 +26,7 @@ export function showStorageToast() {
2526
Please{' '}
2627
<a
2728
className="cursor-pointer underline"
28-
onClick={() => (window.location.href = 'https://www.eigent.ai/pricing')}
29+
onClick={() => (window.location.href = `${SITE_URL}/pricing`)}
2930
>
3031
{i18n.t('chat.upgrade')}
3132
</a>{' '}

src/components/TopBar/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import EndNoticeDialog from '@/components/Dialog/EndNotice';
2525
import { Button } from '@/components/ui/button';
2626
import { TooltipSimple } from '@/components/ui/tooltip';
2727
import useChatStoreAdapter from '@/hooks/useChatStoreAdapter';
28+
import { SITE_URL } from '@/lib';
2829
import { share } from '@/lib/share';
2930
import { useAuthStore } from '@/store/authStore';
3031
import { useInstallationUI } from '@/store/installationStore';
@@ -113,7 +114,7 @@ function HeaderWin() {
113114
try {
114115
const res: any = await proxyFetchGet('/api/v1/user/invite_code');
115116
if (res?.invite_code) {
116-
const inviteLink = `https://www.eigent.ai/signup?invite_code=${res.invite_code}`;
117+
const inviteLink = `${SITE_URL}/signup?invite_code=${res.invite_code}`;
117118
await navigator.clipboard.writeText(inviteLink);
118119
toast.success(t('layout.invitation-link-copied'));
119120
} else {

src/lib/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
import { getAuthStore } from '@/store/authStore';
1616

17+
export const SITE_URL =
18+
import.meta.env.VITE_SITE_URL || 'https://www.eigent.ai';
19+
1720
export function getProxyBaseURL() {
1821
const isDev = import.meta.env.DEV;
1922

src/lib/share.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
// ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
1414

1515
import { proxyFetchPost } from '@/api/http';
16+
import { SITE_URL } from '@/lib';
1617
import { toast } from 'sonner';
1718

1819
export const share = async (taskId: string) => {
1920
try {
2021
const res = await proxyFetchPost(`/api/v1/chat/share`, {
2122
task_id: taskId,
2223
});
23-
const shareLink = `${import.meta.env.VITE_USE_LOCAL_PROXY === 'true' ? 'eigent://callback' : 'https://www.eigent.ai/download'}?share_token=${res.share_token}__${taskId}`;
24+
const shareLink = `${import.meta.env.VITE_USE_LOCAL_PROXY === 'true' ? 'eigent://callback' : `${SITE_URL}/download`}?share_token=${res.share_token}__${taskId}`;
2425
navigator.clipboard
2526
.writeText(shareLink)
2627
.then(() => {

src/pages/Agents/Models.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
SelectTrigger,
3838
SelectValue,
3939
} from '@/components/ui/select';
40+
import { SITE_URL } from '@/lib';
4041
import { INIT_PROVODERS } from '@/lib/llm';
4142
import { useAuthStore } from '@/store/authStore';
4243
import { Provider } from '@/types';
@@ -1200,7 +1201,7 @@ export default function SettingModels() {
12001201
</span>
12011202
<span
12021203
onClick={() => {
1203-
window.location.href = `https://www.eigent.ai/pricing`;
1204+
window.location.href = `${SITE_URL}/pricing`;
12041205
}}
12051206
className="cursor-pointer text-body-sm text-text-label underline"
12061207
>
@@ -1223,7 +1224,7 @@ export default function SettingModels() {
12231224
</div>
12241225
<Button
12251226
onClick={() => {
1226-
window.location.href = `https://www.eigent.ai/dashboard`;
1227+
window.location.href = `${SITE_URL}/dashboard`;
12271228
}}
12281229
variant="primary"
12291230
size="sm"

src/pages/Browser/Cookies.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import { fetchDelete, fetchGet, fetchPost } from '@/api/http';
1616
import AlertDialog from '@/components/ui/alertDialog';
1717
import { Button } from '@/components/ui/button';
18+
import { SITE_URL } from '@/lib';
1819
import { Cookie, Plus, RefreshCw, Trash2 } from 'lucide-react';
1920
import { useEffect, useState } from 'react';
2021
import { useTranslation } from 'react-i18next';
@@ -332,7 +333,7 @@ export default function Cookies() {
332333
<div className="w-full text-center text-label-xs text-text-label">
333334
For more information, check out our
334335
<a
335-
href="https://www.eigent.ai/privacy-policy"
336+
href={`${SITE_URL}/privacy-policy`}
336337
target="_blank"
337338
className="ml-1 text-text-information underline"
338339
rel="noreferrer"

0 commit comments

Comments
 (0)