Skip to content

Commit

Permalink
🐛 fix: Fixed jump error when requesting desktop website
Browse files Browse the repository at this point in the history
  • Loading branch information
RubuJam committed May 28, 2024
1 parent 920a70d commit fa6e750
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion src/const/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,21 @@ import { withBasePath } from '@/utils/basePath';
import pkg from '../../package.json';
import { INBOX_SESSION_ID } from './session';

export const OFFICIAL_URL = 'https://chat-preview.lobehub.com/';
const isVercelPreview = process.env.VERCEL === '1' && process.env.VERCEL_ENV !== 'production';

const inVercelProduction = process.env.VERCEL === '1' && process.env.VERCEL_ENV === 'production';

const vercelPreviewUrl = `https://${process.env.VERCEL_URL}`;

const vercelProductionUrl = `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;

export const siteUrl = inVercelProduction
? vercelProductionUrl

Check warning on line 18 in src/const/url.ts

View check run for this annotation

Codecov / codecov/patch

src/const/url.ts#L18

Added line #L18 was not covered by tests
: isVercelPreview
? vercelPreviewUrl

Check warning on line 20 in src/const/url.ts

View check run for this annotation

Codecov / codecov/patch

src/const/url.ts#L20

Added line #L20 was not covered by tests
: 'https://chat-preview.lobehub.com';

export const OFFICIAL_URL = siteUrl;
export const OFFICIAL_SITE = 'https://lobehub.com/';

export const getCanonicalUrl = (path: string) => urlJoin(OFFICIAL_URL, path);
Expand Down
2 changes: 1 addition & 1 deletion src/libs/agent-runtime/openrouter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const LobeOpenRouterAI = LobeOpenAICompatibleFactory({
baseURL: 'https://openrouter.ai/api/v1',
constructorOptions: {
defaultHeaders: {
'HTTP-Referer': 'https://chat-preview.lobehub.com',
'HTTP-Referer': 'siteUrl',
'X-Title': 'Lobe Chat',
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/libs/agent-runtime/togetherai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const LobeTogetherAI = LobeOpenAICompatibleFactory({
baseURL: `${baseURL}/v1`,
constructorOptions: {
defaultHeaders: {
'HTTP-Referer': 'https://chat-preview.lobehub.com',
'HTTP-Referer': 'siteUrl',
'X-Title': 'Lobe Chat',
},
},
Expand Down

0 comments on commit fa6e750

Please sign in to comment.