Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

♻️ refactor: converge scattered official URLs into const url (#17114)

YuTengjing3576e9c7c554
diff --git a/apps/cli/src/constants/urls.ts b/apps/cli/src/constants/urls.ts
index f97718219d4..f36c92eb632 100644
--- a/apps/cli/src/constants/urls.ts
+++ b/apps/cli/src/constants/urls.ts
@@ -1,3 +1,6 @@
-export const OFFICIAL_AGENT_GATEWAY_URL = 'https://agent-gateway.lobehub.com';
-export const OFFICIAL_SERVER_URL = 'https://app.lobehub.com';
-export const OFFICIAL_GATEWAY_URL = 'https://device-gateway.lobehub.com';
+import { OFFICIAL_DEVICE_GATEWAY_URL, OFFICIAL_URL } from '@lobechat/const';
+
+export { OFFICIAL_AGENT_GATEWAY_URL } from '@lobechat/const';
+
+export const OFFICIAL_SERVER_URL = OFFICIAL_URL;
+export const OFFICIAL_GATEWAY_URL = OFFICIAL_DEVICE_GATEWAY_URL;
diff --git a/apps/desktop/src/main/env.ts b/apps/desktop/src/main/env.ts
index 0e3a58de7fb..b1badbe7dc7 100644
--- a/apps/desktop/src/main/env.ts
+++ b/apps/desktop/src/main/env.ts
@@ -1,3 +1,4 @@
+import { OFFICIAL_URL } from '@lobechat/const/url';
import { createEnv } from '@t3-oss/env-core';
import { memoize } from 'es-toolkit';
import { z } from 'zod';
@@ -100,7 +101,7 @@ export const getDesktopEnv = memoize(() =>
NODE_ENV: z.enum(['development', 'production', 'test']).optional(),
// cloud server url (can be overridden for selfhost/dev)
- OFFICIAL_CLOUD_SERVER: z.string().optional().default('https://app.lobehub.com'),
+ OFFICIAL_CLOUD_SERVER: z.string().optional().default(OFFICIAL_URL),
// updater
// process.env.xxx will replace in build stage
diff --git a/apps/desktop/src/main/menus/impls/linux.ts b/apps/desktop/src/main/menus/impls/linux.ts
index 4fdd5691f81..c905a2849f4 100644
--- a/apps/desktop/src/main/menus/impls/linux.ts
+++ b/apps/desktop/src/main/menus/impls/linux.ts
@@ -1,5 +1,6 @@
import path from 'node:path';
+import { GITHUB, OFFICIAL_SITE } from '@lobechat/const/url';
import type { TrayNavigationSnapshot } from '@lobechat/electron-client-ipc';
import type { MenuItemConstructorOptions } from 'electron';
import { app, clipboard, dialog, Menu, shell } from 'electron';
@@ -199,13 +200,13 @@ export class LinuxMenu extends BaseMenuPlatform implements IMenuPlatform {
submenu: [
{
click: async () => {
- await shell.openExternal('https://lobehub.com');
+ await shell.openExternal(OFFICIAL_SITE);
},
label: t('help.visitWebsite'),
},
{
click: async () => {
- await shell.openExternal('https://github.com/lobehub/lobe-chat');
+ await shell.openExternal(GITHUB);
},
label: t('help.githubRepo'),
},
diff --git a/apps/desktop/src/main/menus/impls/macOS.ts b/apps/desktop/src/main/menus/impls/macOS.ts
index ea52c8a9257..ef493f80a90 100644
--- a/apps/desktop/src/main/menus/impls/macOS.ts
+++ b/apps/desktop/src/main/menus/impls/macOS.ts
@@ -1,5 +1,6 @@
import path from 'node:path';
+import { GITHUB, GITHUB_ISSUES, OFFICIAL_SITE } from '@lobechat/const/url';
import type { TrayNavigationSnapshot } from '@lobechat/electron-client-ipc';
import type { MenuItemConstructorOptions } from 'electron';
import { app, clipboard, Menu, shell } from 'electron';
@@ -249,19 +250,19 @@ export class MacOSMenu extends BaseMenuPlatform implements IMenuPlatform {
submenu: [
{
click: async () => {
- await shell.openExternal('https://lobehub.com');
+ await shell.openExternal(OFFICIAL_SITE);
},
label: t('help.visitWebsite'),
},
{
click: async () => {
- await shell.openExternal('https://github.com/lobehub/lobe-chat');
+ await shell.openExternal(GITHUB);
},
label: t('help.githubRepo'),
},
{
click: async () => {
- await shell.openExternal('https://github.com/lobehub/lobe-chat/issues/new/choose');
+ await shell.openExternal(GITHUB_ISSUES);
},
label: t('help.reportIssue'),
},
diff --git a/apps/desktop/src/main/menus/impls/windows.ts b/apps/desktop/src/main/menus/impls/windows.ts
index 3062b1e79a4..acbeccf6a79 100644
--- a/apps/desktop/src/main/menus/impls/windows.ts
+++ b/apps/desktop/src/main/menus/impls/windows.ts
@@ -1,5 +1,6 @@
import path from 'node:path';
+import { GITHUB, OFFICIAL_SITE } from '@lobechat/const/url';
import type { TrayNavigationSnapshot } from '@lobechat/electron-client-ipc';
import type { MenuItemConstructorOptions } from 'electron';
import { app, clipboard, Menu, shell } from 'electron';
@@ -197,13 +198,13 @@ export class WindowsMenu extends BaseMenuPlatform implements IMenuPlatform {
submenu: [
{
click: async () => {
- await shell.openExternal('https://lobehub.com');
+ await shell.openExternal(OFFICIAL_SITE);
},
label: t('help.visitWebsite'),
},
{
click: async () => {
- await shell.openExternal('https://github.com/lobehub/lobe-chat');
+ await shell.openExternal(GITHUB);
},
label: t('help.githubRepo'),
},
diff --git a/apps/desktop/src/main/services/gatewayConnectionSrv.ts b/apps/desktop/src/main/services/gatewayConnectionSrv.ts
index 410cfd1d80b..0a369cec6a3 100644
--- a/apps/desktop/src/main/services/gatewayConnectionSrv.ts
+++ b/apps/desktop/src/main/services/gatewayConnectionSrv.ts
@@ -1,6 +1,7 @@
import { randomUUID } from 'node:crypto';
import os from 'node:os';
+import { OFFICIAL_DEVICE_GATEWAY_URL } from '@lobechat/const/url';
import type {
EnrollWorkspaceParams,
EnrollWorkspaceResult,
@@ -30,7 +31,7 @@ import { ServiceModule } from './index';
const logger = createLogger('services:GatewayConnectionSrv');
-const DEFAULT_GATEWAY_URL = 'https://device-gateway.lobehub.com';
+const DEFAULT_GATEWAY_URL = OFFICIAL_DEVICE_GATEWAY_URL;
/**
* Result envelope a tool-call handler must return. Mirrors
diff --git a/apps/server/src/routers/lambda/market/agentGroup.ts b/apps/server/src/routers/lambda/market/agentGroup.ts
index f08ea44a67a..52498d716f3 100644
--- a/apps/server/src/routers/lambda/market/agentGroup.ts
+++ b/apps/server/src/routers/lambda/market/agentGroup.ts
@@ -1,3 +1,4 @@
+import { discoverUrl } from '@lobechat/const';
import { TRPCError } from '@trpc/server';
import debug from 'debug';
import { customAlphabet } from 'nanoid/non-secure';
@@ -587,7 +588,7 @@ export const agentGroupRouter = router({
category: group.category,
createdAt: group.createdAt,
description: group.description || '',
- homepage: `https://lobehub.com/discover/group_agent/${group.identifier}`,
+ homepage: discoverUrl('group_agent', group.identifier),
identifier: group.identifier,
installCount: group.installCount || 0,
isFeatured: group.isFeatured || false,
diff --git a/apps/server/src/services/bot/platforms/discord/definition.ts b/apps/server/src/services/bot/platforms/discord/definition.ts
index 333ba8cc07d..b47716a2e3a 100644
--- a/apps/server/src/services/bot/platforms/discord/definition.ts
+++ b/apps/server/src/services/bot/platforms/discord/definition.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../types';
import { DiscordClientFactory } from './client';
import { DEFAULT_DISCORD_CONNECTION_MODE } from './const';
@@ -10,7 +12,7 @@ export const discord: PlatformDefinition = {
description: 'Connect a Discord bot',
documentation: {
portalUrl: 'https://discord.com/developers/applications',
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/discord',
+ setupGuideUrl: channelDocUrl('discord'),
},
schema,
clientFactory: new DiscordClientFactory(),
diff --git a/apps/server/src/services/bot/platforms/feishu/definitions/feishu.ts b/apps/server/src/services/bot/platforms/feishu/definitions/feishu.ts
index d8eb8ce3667..20531396705 100644
--- a/apps/server/src/services/bot/platforms/feishu/definitions/feishu.ts
+++ b/apps/server/src/services/bot/platforms/feishu/definitions/feishu.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../../types';
import { DEFAULT_FEISHU_CONNECTION_MODE } from '../const';
import { sharedSchema } from './schema';
@@ -10,7 +12,7 @@ export const feishu: PlatformDefinition = {
description: 'Connect a Feishu bot',
documentation: {
portalUrl: 'https://open.feishu.cn/app',
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/feishu',
+ setupGuideUrl: channelDocUrl('feishu'),
},
schema: sharedSchema,
supportsMarkdown: false,
diff --git a/apps/server/src/services/bot/platforms/feishu/definitions/lark.ts b/apps/server/src/services/bot/platforms/feishu/definitions/lark.ts
index 62197a43f8a..600be82fda1 100644
--- a/apps/server/src/services/bot/platforms/feishu/definitions/lark.ts
+++ b/apps/server/src/services/bot/platforms/feishu/definitions/lark.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../../types';
import { DEFAULT_FEISHU_CONNECTION_MODE } from '../const';
import { sharedSchema } from './schema';
@@ -10,7 +12,7 @@ export const lark: PlatformDefinition = {
description: 'Connect a Lark bot',
documentation: {
portalUrl: 'https://open.larksuite.com/app',
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/lark',
+ setupGuideUrl: channelDocUrl('lark'),
},
schema: sharedSchema,
supportsMarkdown: false,
diff --git a/apps/server/src/services/bot/platforms/imessage/definition.ts b/apps/server/src/services/bot/platforms/imessage/definition.ts
index ccbc278a901..8989fa7866d 100644
--- a/apps/server/src/services/bot/platforms/imessage/definition.ts
+++ b/apps/server/src/services/bot/platforms/imessage/definition.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../types';
import { ImessageClientFactory } from './client';
import { schema } from './schema';
@@ -9,7 +11,7 @@ export const imessage: PlatformDefinition = {
description: 'Connect iMessage through the local LobeHub Desktop BlueBubbles bridge.',
documentation: {
portalUrl: 'https://bluebubbles.app/',
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/imessage',
+ setupGuideUrl: channelDocUrl('imessage'),
},
schema,
showWebhookUrl: false,
diff --git a/apps/server/src/services/bot/platforms/line/definition.ts b/apps/server/src/services/bot/platforms/line/definition.ts
index 513a45b0c5a..b780bf4a69c 100644
--- a/apps/server/src/services/bot/platforms/line/definition.ts
+++ b/apps/server/src/services/bot/platforms/line/definition.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../types';
import { LineClientFactory } from './client';
import { schema } from './schema';
@@ -9,7 +11,7 @@ export const line: PlatformDefinition = {
description: 'Connect a LINE Messaging API bot for direct and group chats.',
documentation: {
portalUrl: 'https://developers.line.biz/console/',
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/line',
+ setupGuideUrl: channelDocUrl('line'),
},
schema,
showWebhookUrl: true,
diff --git a/apps/server/src/services/bot/platforms/qq/definition.ts b/apps/server/src/services/bot/platforms/qq/definition.ts
index a6e678f43a5..9945d01c494 100644
--- a/apps/server/src/services/bot/platforms/qq/definition.ts
+++ b/apps/server/src/services/bot/platforms/qq/definition.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../types';
import { QQClientFactory } from './client';
import { DEFAULT_QQ_CONNECTION_MODE } from './const';
@@ -10,7 +12,7 @@ export const qq: PlatformDefinition = {
description: 'Connect a QQ bot',
documentation: {
portalUrl: 'https://q.qq.com/',
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/qq',
+ setupGuideUrl: channelDocUrl('qq'),
},
schema,
supportsMarkdown: false,
diff --git a/apps/server/src/services/bot/platforms/slack/definition.ts b/apps/server/src/services/bot/platforms/slack/definition.ts
index aef0141f928..3768b33044f 100644
--- a/apps/server/src/services/bot/platforms/slack/definition.ts
+++ b/apps/server/src/services/bot/platforms/slack/definition.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../types';
import { SlackClientFactory } from './client';
import { DEFAULT_SLACK_CONNECTION_MODE } from './const';
@@ -10,7 +12,7 @@ export const slack: PlatformDefinition = {
description: 'Connect a Slack bot',
documentation: {
portalUrl: 'https://api.slack.com/apps',
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/slack',
+ setupGuideUrl: channelDocUrl('slack'),
},
schema,
clientFactory: new SlackClientFactory(),
diff --git a/apps/server/src/services/bot/platforms/telegram/definition.ts b/apps/server/src/services/bot/platforms/telegram/definition.ts
index 1369f6fd8f8..b0951692c70 100644
--- a/apps/server/src/services/bot/platforms/telegram/definition.ts
+++ b/apps/server/src/services/bot/platforms/telegram/definition.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../types';
import { TelegramClientFactory } from './client';
import { schema } from './schema';
@@ -9,7 +11,7 @@ export const telegram: PlatformDefinition = {
description: 'Connect a Telegram bot',
documentation: {
portalUrl: 'https://t.me/BotFather',
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/telegram',
+ setupGuideUrl: channelDocUrl('telegram'),
},
schema,
clientFactory: new TelegramClientFactory(),
diff --git a/apps/server/src/services/bot/platforms/wechat/definition.ts b/apps/server/src/services/bot/platforms/wechat/definition.ts
index b3d4cc939fb..745f79043fb 100644
--- a/apps/server/src/services/bot/platforms/wechat/definition.ts
+++ b/apps/server/src/services/bot/platforms/wechat/definition.ts
@@ -1,3 +1,5 @@
+import { channelDocUrl } from '@lobechat/const';
+
import type { PlatformDefinition } from '../types';
import { WechatClientFactory } from './client';
import { schema } from './schema';
@@ -8,7 +10,7 @@ export const wechat: PlatformDefinition = {
connectionMode: 'polling',
description: 'Connect a WeChat bot via iLink API',
documentation: {
- setupGuideUrl: 'https://lobehub.com/docs/usage/channels/wechat',
+ setupGuideUrl: channelDocUrl('wechat'),
},
schema,
supportsMessageEdit: false,
diff --git a/apps/server/src/services/discover/index.ts b/apps/server/src/services/discover/index.ts
index 27c7e4eb20e..65d9a744c00 100644
--- a/apps/server/src/services/discover/index.ts
+++ b/apps/server/src/services/discover/index.ts
@@ -4,7 +4,9 @@ import {
DEFAULT_DISCOVER_ASSISTANT_ITEM,
DEFAULT_DISCOVER_PLUGIN_ITEM,
DEFAULT_DISCOVER_PROVIDER_ITEM,
+ discoverUrl,
isDesktop,
+ OFFICIAL_SITE,
} from '@lobechat/const';
import {
type AgentStatus,
@@ -593,9 +595,7 @@ export class DiscoverService {
: [],
forkCount: (data as any).forkCount,
forkedFromAgentId: (data as any).forkedFromAgentId,
- homepage:
- (data as any).homepage ||
- `https://lobehub.com/discover/assistant/${(data as any).identifier}`,
+ homepage: (data as any).homepage || discoverUrl('assistant', (data as any).identifier),
identifier: (data as any).identifier,
isValidated: (data as any).isValidated,
knowledgeCount:
@@ -748,7 +748,7 @@ export class DiscoverService {
createdAt: item.createdAt || item.updatedAt || new Date().toISOString(),
description: item.description || item.summary || '',
forkCount: item.forkCount,
- homepage: item.homepage || `https://lobehub.com/discover/assistant/${item.identifier}`,
+ homepage: item.homepage || discoverUrl('assistant', item.identifier),
identifier: item.identifier,
installCount: item.installCount,
knowledgeCount: item.knowledgeCount ?? item.config?.knowledgeBases?.length ?? 0,
@@ -961,7 +961,7 @@ export class DiscoverService {
config: {} as any,
createdAt: item.createdAt || item.updatedAt || new Date().toISOString(),
description: item.description || '',
- homepage: `https://lobehub.com/discover/assistant/${item.identifier}`,
+ homepage: discoverUrl('assistant', item.identifier),
identifier: item.identifier,
installCount: item.installCount,
knowledgeCount: item.knowledgeCount || 0,
@@ -1152,7 +1152,7 @@ export class DiscoverService {
category: undefined,
createdAt: '',
description: builtinTool.manifest.meta.description || '',
- homepage: 'https://lobehub.com',
+ homepage: OFFICIAL_SITE,
identifier: builtinTool.identifier,
manifest: undefined,
related: [],
@@ -1841,7 +1841,7 @@ export class DiscoverService {
createdAt: agent.createdAt,
description: agent.description || '',
forkCount: agent.forkCount,
- homepage: `https://lobehub.com/discover/assistant/${agent.identifier}`,
+ homepage: discoverUrl('assistant', agent.identifier),
identifier: agent.identifier,
installCount: agent.installCount,
isValidated: agent.isValidated,
@@ -1862,7 +1862,7 @@ export class DiscoverService {
createdAt: group.createdAt,
description: group.description || '',
forkCount: group.forkCount,
- homepage: `https://lobehub.com/discover/group_agent/${group.identifier}`,
+ homepage: discoverUrl('group_agent', group.identifier),
identifier: group.identifier,
installCount: group.installCount || 0,
isFeatured: group.isFeatured || false,
@@ -1887,7 +1887,7 @@ export class DiscoverService {
description: agent.description || '',
forkCount: agent.forkCount || 0,
forkedFromAgentId: agent.forkedFromAgentId || null,
- homepage: `https://lobehub.com/discover/assistant/${agent.identifier}`,
+ homepage: discoverUrl('assistant', agent.identifier),
identifier: agent.identifier,
installCount: agent.installCount,
isValidated: agent.isValidated,
@@ -1910,7 +1910,7 @@ export class DiscoverService {
description: group.description || '',
forkCount: group.forkCount || 0,
forkedFromGroupId: group.forkedFromGroupId || null,
- homepage: `https://lobehub.com/discover/group_agent/${group.identifier}`,
+ homepage: discoverUrl('group_agent', group.identifier),
identifier: group.identifier,
installCount: group.installCount || 0,
isFeatured: group.isFeatured || false,
@@ -1935,7 +1935,7 @@ export class DiscoverService {
description: agent.description || '',
forkCount: agent.forkCount || 0,
forkedFromAgentId: agent.forkedFromAgentId || null,
- homepage: `https://lobehub.com/discover/assistant/${agent.identifier}`,
+ homepage: discoverUrl('assistant', agent.identifier),
identifier: agent.identifier,
installCount: agent.installCount,
isValidated: agent.isValidated,
@@ -1958,7 +1958,7 @@ export class DiscoverService {
description: group.description || '',
forkCount: group.forkCount || 0,
forkedFromGroupId: group.forkedFromGroupId || null,
- homepage: `https://lobehub.com/discover/group_agent/${group.identifier}`,
+ homepage: discoverUrl('group_agent', group.identifier),
identifier: group.identifier,
installCount: group.installCount || 0,
isFeatured: group.isFeatured || false,
@@ -2004,7 +2004,7 @@ export class DiscoverService {
category: plugin.category,
createdAt: plugin.createdAt,
description: plugin.description || '',
- homepage: `https://lobehub.com/discover/plugin/${plugin.identifier}`,
+ homepage: discoverUrl('plugin', plugin.identifier),
identifier: plugin.identifier,
installCount: plugin.installCount || 0,
isClaimed: plugin.isClaimed || false,
diff --git a/apps/server/src/services/toolExecution/preprocessLhCommand.ts b/apps/server/src/services/toolExecution/preprocessLhCommand.ts
index a76ef06a585..8c81180e2d0 100644
--- a/apps/server/src/services/toolExecution/preprocessLhCommand.ts
+++ b/apps/server/src/services/toolExecution/preprocessLhCommand.ts
@@ -1,3 +1,4 @@
+import { OFFICIAL_URL } from '@lobechat/const';
import debug from 'debug';
import { appEnv } from '@/envs/app';
@@ -35,7 +36,7 @@ export const preprocessLhCommand = async (
try {
const jwt = await signUserJWT(userId);
- const serverUrl = isDev ? 'https://app.lobehub.com' : appEnv.APP_URL;
+ const serverUrl = isDev ? OFFICIAL_URL : appEnv.APP_URL;
const envParts = [`LOBEHUB_JWT=${jwt}`, `LOBEHUB_SERVER=${serverUrl}`];
if (workspaceId) envParts.push(`LOBEHUB_WORKSPACE_ID=${workspaceId}`);
diff --git a/packages/builtin-tool-creds/src/ExecutionRuntime/index.ts b/packages/builtin-tool-creds/src/ExecutionRuntime/index.ts
index c0219835aa3..dbbdef3415d 100644
--- a/packages/builtin-tool-creds/src/ExecutionRuntime/index.ts
+++ b/packages/builtin-tool-creds/src/ExecutionRuntime/index.ts
@@ -1,4 +1,8 @@
-import { getComposioAppByIdentifier, getLobehubSkillProviderById } from '@lobechat/const';
+import {
+ getComposioAppByIdentifier,
+ getLobehubSkillProviderById,
+ OFFICIAL_URL,
+} from '@lobechat/const';
import type { BuiltinServerRuntimeOutput } from '@lobechat/types';
import type {
@@ -164,7 +168,7 @@ export class CredsExecutionRuntime {
// Get the authorization URL
// Note: In background execution, we cannot use window.location.origin
// Normalize APP_URL by removing trailing slash to avoid double-slash in redirectUri
- const appUrl = (process.env.APP_URL || 'https://app.lobehub.com').replace(/\/+$/, '');
+ const appUrl = (process.env.APP_URL || OFFICIAL_URL).replace(/\/+$/, '');
const redirectUri = `${appUrl}/oauth/callback/success?provider=${provider}`;
const response = await this.credsService.getOAuthAuthorizeUrl(provider, redirectUri);
diff --git a/packages/const/src/lobehubSkill.ts b/packages/const/src/lobehubSkill.ts
index 52f39ba6c2a..fecf96b2e7a 100644
--- a/packages/const/src/lobehubSkill.ts
+++ b/packages/const/src/lobehubSkill.ts
@@ -1,6 +1,8 @@
import type { IconType } from '@icons-pack/react-simple-icons';
import { SiGithub, SiLinear, SiPosthog, SiVercel, SiX } from '@icons-pack/react-simple-icons';
+import { OFFICIAL_SITE } from './url';
+
export interface LobehubSkillProviderType {
/**
* Author/Developer of the integration
@@ -49,7 +51,7 @@ export type LobehubConnectorProviderType = LobehubSkillProviderType;
export const LOBEHUB_SKILL_PROVIDERS: LobehubSkillProviderType[] = [
{
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
defaultVisible: true,
description:
'GitHub is a platform for version control and collaboration, enabling developers to host, review, and manage code repositories.',
@@ -61,7 +63,7 @@ export const LOBEHUB_SKILL_PROVIDERS: LobehubSkillProviderType[] = [
},
{
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
defaultVisible: true,
description:
'Linear is a modern issue tracking and project management tool designed for high-performance teams to build better software faster',
@@ -73,7 +75,7 @@ export const LOBEHUB_SKILL_PROVIDERS: LobehubSkillProviderType[] = [
},
{
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
defaultVisible: true,
description:
'Outlook Calendar is an integrated scheduling tool within Microsoft Outlook that enables users to create appointments, organize meetings with others, and manage their time and events effectively.',
@@ -85,7 +87,7 @@ export const LOBEHUB_SKILL_PROVIDERS: LobehubSkillProviderType[] = [
},
{
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
defaultVisible: true,
description: 'Notion is a collaborative productivity and note-taking application.',
icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/notion.svg',
@@ -96,7 +98,7 @@ export const LOBEHUB_SKILL_PROVIDERS: LobehubSkillProviderType[] = [
},
{
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
defaultVisible: true,
description:
'PostHog is an open-source product analytics platform for analyzing events, funnels, cohorts, feature flags, experiments, and user behavior.',
@@ -108,7 +110,7 @@ export const LOBEHUB_SKILL_PROVIDERS: LobehubSkillProviderType[] = [
},
{
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
defaultVisible: true,
description:
'X (Twitter) is a social media platform for sharing real-time updates, news, and engaging with your audience through posts, replies, and direct messages.',
@@ -120,7 +122,7 @@ export const LOBEHUB_SKILL_PROVIDERS: LobehubSkillProviderType[] = [
},
{
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
defaultVisible: true,
description:
'Vercel is a cloud platform for frontend developers, providing hosting and serverless functions to deploy web applications with ease.',
diff --git a/packages/const/src/url.ts b/packages/const/src/url.ts
index 67262888cf7..7cba80b4c05 100644
--- a/packages/const/src/url.ts
+++ b/packages/const/src/url.ts
@@ -4,6 +4,9 @@ export const OFFICIAL_URL = 'https://app.lobehub.com';
export const OFFICIAL_SITE = 'https://lobehub.com';
export const OFFICIAL_DOMAIN = 'lobehub.com';
+export const OFFICIAL_DEVICE_GATEWAY_URL = 'https://device-gateway.lobehub.com';
+export const OFFICIAL_AGENT_GATEWAY_URL = 'https://agent-gateway.lobehub.com';
+
export const OG_URL = '/og/og.webp?v=1';
export const LobeHubPath = {
@@ -88,3 +91,8 @@ export const DOWNLOAD_URL = {
mobile: urlJoin(OFFICIAL_SITE, '/mobile'),
ios: 'https://testflight.apple.com/join/2ZbjX4Qp',
} as const;
+
+export const channelDocUrl = (platform: string) => urlJoin(USAGE_DOCUMENTS, 'channels', platform);
+
+export const discoverUrl = (type: string, identifier: string) =>
+ urlJoin(OFFICIAL_SITE, 'discover', type, identifier);
diff --git a/src/components/BrandWatermark/index.tsx b/src/components/BrandWatermark/index.tsx
index e56078cd2db..18b8253e686 100644
--- a/src/components/BrandWatermark/index.tsx
+++ b/src/components/BrandWatermark/index.tsx
@@ -7,6 +7,7 @@ import { LobeHub } from '@lobehub/ui/brand';
import { createStaticStyles, cssVar } from 'antd-style';
import { memo } from 'react';
+import { OFFICIAL_SITE } from '@/const/url';
import { isCustomORG } from '@/const/version';
const styles = createStaticStyles(({ css, cssVar }) => ({
@@ -37,7 +38,7 @@ const BrandWatermark = memo<Omit<FlexboxProps, 'children'>>(({ style, ...rest })
) : (
<a
className={styles.logoLink}
- href={`https://lobehub.com?utm_source=${UTM_SOURCE}&utm_content=brand_watermark`}
+ href={`${OFFICIAL_SITE}?utm_source=${UTM_SOURCE}&utm_content=brand_watermark`}
rel="noreferrer"
target="_blank"
>
diff --git a/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx b/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx
index 88fda0ed6bd..180cc315801 100644
--- a/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx
+++ b/src/features/ChatInput/ControlBar/HeteroDeviceSwitcher.tsx
@@ -24,6 +24,7 @@ import {
import { memo, type ReactNode, useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { DOWNLOAD_URL } from '@/const/url';
import { useSelectExecutionTarget } from '@/features/ChatInput/hooks/useSelectExecutionTarget';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { resolveExecutionTarget } from '@/helpers/executionTarget';
@@ -568,7 +569,7 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {
) : (
<a
className={styles.headerLink}
- href="https://lobehub.com/downloads"
+ href={DOWNLOAD_URL.default}
rel="noreferrer"
target="_blank"
>
@@ -661,7 +662,7 @@ const HeteroDeviceSwitcher = memo<HeteroDeviceSwitcherProps>(({ agentId }) => {
{showWebDownloadCard ? (
<a
className={styles.downloadCard}
- href="https://lobehub.com/downloads"
+ href={DOWNLOAD_URL.default}
rel="noreferrer"
target="_blank"
>
diff --git a/src/features/CreatePlatformAgent/index.tsx b/src/features/CreatePlatformAgent/index.tsx
index 5b3b21092e2..ee9cd09004b 100644
--- a/src/features/CreatePlatformAgent/index.tsx
+++ b/src/features/CreatePlatformAgent/index.tsx
@@ -29,6 +29,7 @@ import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router';
import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';
+import { DOWNLOAD_URL } from '@/const/url';
import { lambdaQuery } from '@/libs/trpc/client';
import { deviceService } from '@/services/device';
import { useAgentStore } from '@/store/agent';
@@ -395,7 +396,7 @@ const CreatePlatformAgentContent = memo<CreatePlatformAgentContentProps>(
<Flexbox gap={12}>
<Flexbox gap={6}>
<span>{t('platformAgent.create.noDevicesDesktopHint')}</span>
- <a href="https://lobehub.com/downloads" rel="noreferrer" target="_blank">
+ <a href={DOWNLOAD_URL.default} rel="noreferrer" target="_blank">
<Button
icon={<Icon icon={Download} size={13} />}
size="small"
diff --git a/src/features/SkillStore/SkillDetail/BuiltinAgentSkillDetailProvider.tsx b/src/features/SkillStore/SkillDetail/BuiltinAgentSkillDetailProvider.tsx
index 8563c20e345..247a4a6cbae 100644
--- a/src/features/SkillStore/SkillDetail/BuiltinAgentSkillDetailProvider.tsx
+++ b/src/features/SkillStore/SkillDetail/BuiltinAgentSkillDetailProvider.tsx
@@ -4,6 +4,7 @@ import isEqual from 'fast-deep-equal';
import { type ReactNode, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import { OFFICIAL_SITE } from '@/const/url';
import { useToolStore } from '@/store/tool';
import { DetailContext, type DetailContextValue } from './DetailContext';
@@ -40,7 +41,7 @@ export const BuiltinAgentSkillDetailProvider = ({
const value: DetailContextValue = {
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
config: null as any,
description: skill.description,
icon: skill.avatar || '',
diff --git a/src/features/SkillStore/SkillDetail/BuiltinDetailProvider.tsx b/src/features/SkillStore/SkillDetail/BuiltinDetailProvider.tsx
index 1efba375828..e7b687a48e0 100644
--- a/src/features/SkillStore/SkillDetail/BuiltinDetailProvider.tsx
+++ b/src/features/SkillStore/SkillDetail/BuiltinDetailProvider.tsx
@@ -5,6 +5,7 @@ import { type ReactNode } from 'react';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import { OFFICIAL_SITE } from '@/const/url';
import { useToolStore } from '@/store/tool';
import { builtinToolSelectors } from '@/store/tool/selectors';
@@ -58,7 +59,7 @@ export const BuiltinDetailProvider = ({ children, identifier }: BuiltinDetailPro
const value: DetailContextValue = {
author: 'LobeHub',
- authorUrl: 'https://lobehub.com',
+ authorUrl: OFFICIAL_SITE,
config: null as any, // Builtin tools don't have provider config
description: meta?.description || '',
icon: meta?.avatar || '',
diff --git a/src/routes/(main)/agent/channel/list.tsx b/src/routes/(main)/agent/channel/list.tsx
index 7bae8fc57bf..f4ade48ea5c 100644
--- a/src/routes/(main)/agent/channel/list.tsx
+++ b/src/routes/(main)/agent/channel/list.tsx
@@ -9,6 +9,7 @@ import { Book, Download, MoreHorizontal, Trash2, Upload } from 'lucide-react';
import { memo, useCallback, useRef } from 'react';
import { useTranslation } from 'react-i18next';
+import { channelDocUrl } from '@/const/url';
import { useAgentStore } from '@/store/agent';
import type { BotProviderItem } from '@/store/agent/slices/bot/action';
@@ -315,7 +316,7 @@ const PlatformList = memo<PlatformListProps>(
}}
>
<a
- href="https://lobehub.com/docs/usage/channels/overview"
+ href={channelDocUrl('overview')}
rel="noopener noreferrer"
target="_blank"
style={{
diff --git a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx
index 1cb63e5d823..006a1c6577f 100644
--- a/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx
+++ b/src/routes/(main)/community/(detail)/agent/features/Details/Capabilities/PluginItem.tsx
@@ -4,6 +4,7 @@ import {
type ComposioAppType,
getLobehubSkillProviderById,
type LobehubSkillProviderType,
+ OFFICIAL_SITE,
} from '@lobechat/const';
import { type DiscoverPluginDetail, type PluginSource } from '@lobechat/types';
import { Avatar, Block, Flexbox, Icon, Image, Skeleton, Tag, Text } from '@lobehub/ui';
@@ -124,7 +125,7 @@ const PluginItem = memo<PluginItemProps>(({ identifier }) => {
category: undefined,
createdAt: '',
description: lobehubSkill.description,
- homepage: lobehubSkill.authorUrl || 'https://lobehub.com',
+ homepage: lobehubSkill.authorUrl || OFFICIAL_SITE,
identifier: lobehubSkill.id,
manifest: undefined,
related: [],
@@ -143,7 +144,7 @@ const PluginItem = memo<PluginItemProps>(({ identifier }) => {
category: undefined,
createdAt: '',
description: builtinTool.description || '',
- homepage: 'https://lobehub.com',
+ homepage: OFFICIAL_SITE,
identifier: builtinTool.identifier,
manifest: undefined,
related: [],
diff --git a/src/routes/(main)/community/(detail)/model/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/model/features/Details/Nav.tsx
index b3faca2bab3..2a52a06b73f 100644
--- a/src/routes/(main)/community/(detail)/model/features/Details/Nav.tsx
+++ b/src/routes/(main)/community/(detail)/model/features/Details/Nav.tsx
@@ -7,7 +7,9 @@ import { createStaticStyles } from 'antd-style';
import { BookOpenIcon, ListIcon, Settings2Icon } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import urlJoin from 'url-join';
+import { GITHUB, GITHUB_ISSUES } from '@/const/url';
import { ModelNavKey } from '@/types/discover';
const styles = createStaticStyles(({ css, cssVar }) => {
@@ -75,18 +77,13 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = ModelNavKey.Over
</a>
<a
className={styles.link}
- href="https://github.com/lobehub/lobe-chat/tree/main/src/config/aiModels"
+ href={urlJoin(GITHUB, 'tree/main/src/config/aiModels')}
rel="noreferrer"
target="_blank"
>
{t('mcp.details.nav.viewSourceCode')}
</a>
- <a
- className={styles.link}
- href="https://github.com/lobehub/lobe-chat/issues/new/choose"
- rel="noreferrer"
- target="_blank"
- >
+ <a className={styles.link} href={GITHUB_ISSUES} rel="noreferrer" target="_blank">
{t('mcp.details.nav.reportIssue')}
</a>
</Flexbox>
diff --git a/src/routes/(main)/community/(detail)/model/features/Details/Parameter/ParameterItem.tsx b/src/routes/(main)/community/(detail)/model/features/Details/Parameter/ParameterItem.tsx
index e5f171ba5cd..b11151eaa1e 100644
--- a/src/routes/(main)/community/(detail)/model/features/Details/Parameter/ParameterItem.tsx
+++ b/src/routes/(main)/community/(detail)/model/features/Details/Parameter/ParameterItem.tsx
@@ -3,10 +3,13 @@ import { Divider } from 'antd';
import { cssVar } from 'antd-style';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import urlJoin from 'url-join';
+
+import { USAGE_DOCUMENTS } from '@/const/url';
import Statistic from '../../../../../components/Statistic';
-const DEFAULT_DOC_URL = 'https://lobehub.com/docs/usage/agents/model';
+const DEFAULT_DOC_URL = urlJoin(USAGE_DOCUMENTS, 'agents/model');
export interface ParameterItemProps {
defaultValue: string | number;
diff --git a/src/routes/(main)/community/(detail)/provider/features/Details/Nav.tsx b/src/routes/(main)/community/(detail)/provider/features/Details/Nav.tsx
index 0bc11e6fcd4..71c6231aea6 100644
--- a/src/routes/(main)/community/(detail)/provider/features/Details/Nav.tsx
+++ b/src/routes/(main)/community/(detail)/provider/features/Details/Nav.tsx
@@ -9,6 +9,7 @@ import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import urlJoin from 'url-join';
+import { GITHUB, GITHUB_ISSUES } from '@/const/url';
import { ProviderNavKey } from '@/types/discover';
import { useDetailContext } from '../DetailProvider';
@@ -93,23 +94,15 @@ const Nav = memo<NavProps>(({ mobile, setActiveTab, activeTab = ProviderNavKey.O
{identifier && (
<a
className={styles.link}
+ href={urlJoin(GITHUB, 'tree/main/src/config/modelProviders', `${identifier}.ts`)}
rel="noreferrer"
target="_blank"
- href={urlJoin(
- 'https://github.com/lobehub/lobe-chat/tree/main/src/config/modelProviders',
- `${identifier}.ts`,
- )}
>
{t('mcp.details.nav.viewSourceCode')}
<Icon icon={SquareArrowOutUpRight} size={12} />
</a>
)}
- <a
- className={styles.link}
- href="https://github.com/lobehub/lobe-chat/issues/new/choose"
- rel="noreferrer"
- target="_blank"
- >
+ <a className={styles.link} href={GITHUB_ISSUES} rel="noreferrer" target="_blank">
{t('mcp.details.nav.reportIssue')}
<Icon icon={SquareArrowOutUpRight} size={12} />
</a>
diff --git a/src/routes/(main)/community/(detail)/skill/features/Sidebar/index.tsx b/src/routes/(main)/community/(detail)/skill/features/Sidebar/index.tsx
index 4e043a00bf1..5b89c678979 100644
--- a/src/routes/(main)/community/(detail)/skill/features/Sidebar/index.tsx
+++ b/src/routes/(main)/community/(detail)/skill/features/Sidebar/index.tsx
@@ -5,6 +5,8 @@ import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import urlJoin from 'url-join';
+import { OFFICIAL_SITE } from '@/const/url';
+
import ShareButton from '../../../features/ShareButton';
import { useDetailContext } from '../DetailProvider';
import { SkillNavKey } from '../types';
@@ -27,7 +29,7 @@ const Sidebar = memo<{ activeTab?: SkillNavKey; mobile?: boolean }>(
desc: description,
hashtags: tags,
title: name,
- url: urlJoin('https://lobehub.com/skills', identifier || ''),
+ url: urlJoin(OFFICIAL_SITE, 'skills', identifier || ''),
}}
>
{t('share')}
diff --git a/src/routes/(main)/community/(list)/(home)/features/CreatorRewardBanner.tsx b/src/routes/(main)/community/(list)/(home)/features/CreatorRewardBanner.tsx
index 137d3d98c9a..6a0b43f2fca 100644
--- a/src/routes/(main)/community/(list)/(home)/features/CreatorRewardBanner.tsx
+++ b/src/routes/(main)/community/(list)/(home)/features/CreatorRewardBanner.tsx
@@ -6,6 +6,7 @@ import { createStaticStyles, cx, responsive } from 'antd-style';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import { OFFICIAL_SITE } from '@/const/url';
import { useIsDark } from '@/hooks/useIsDark';
const styles = createStaticStyles(({ css }) => ({
@@ -98,7 +99,7 @@ const CreatorRewardBanner = memo(() => {
</p>
<div style={{ marginBlockStart: 4 }}>
<a
- href={'https://lobehub.com/creator?utm_source=lobehub'}
+ href={`${OFFICIAL_SITE}/creator?utm_source=lobehub`}
rel={'noopener noreferrer'}
target={'_blank'}
>
diff --git a/src/routes/(main)/community/(list)/provider/features/List/Item.tsx b/src/routes/(main)/community/(list)/provider/features/List/Item.tsx
index f2ac5de4ada..9ccc5a8c4e1 100644
--- a/src/routes/(main)/community/(list)/provider/features/List/Item.tsx
+++ b/src/routes/(main)/community/(list)/provider/features/List/Item.tsx
@@ -6,6 +6,7 @@ import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import urlJoin from 'url-join';
+import { GITHUB } from '@/const/url';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
import { type DiscoverProviderItem } from '@/types/discover';
@@ -89,7 +90,7 @@ const ProviderItem = memo<DiscoverProviderItem>(
<ActionIcon color={cssVar.colorTextDescription} icon={GlobeIcon} />
</a>
<a
- href={`https://github.com/lobehub/lobe-chat/blob/main/src/config/modelProviders/${identifier}.ts`}
+ href={urlJoin(GITHUB, 'blob/main/src/config/modelProviders', `${identifier}.ts`)}
rel="noopener noreferrer"
target={'_blank'}
onClick={stopPropagation}
diff --git a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/LinkIconPreview.tsx b/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/LinkIconPreview.tsx
index 8dee569e892..901bd0a76f8 100644
--- a/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/LinkIconPreview.tsx
+++ b/src/routes/(main)/settings/chat-appearance/features/ChatAppearance/LinkIconPreview.tsx
@@ -4,6 +4,7 @@ import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
import { Trans } from 'react-i18next';
+import { OFFICIAL_SITE } from '@/const/url';
import { type LobeLinkKind } from '@/features/Conversation/Markdown/plugins/Link/parse';
import LinkRender from '@/features/Conversation/Markdown/plugins/Link/Render';
@@ -59,7 +60,7 @@ const LinkIconPreview = memo(() => (
site: (
<SampleLink
domain="lobehub.com"
- href="https://lobehub.com"
+ href={OFFICIAL_SITE}
kind="generic"
label="lobehub.com"
/>
diff --git a/src/store/tool/slices/lobehubSkillStore/selectors.ts b/src/store/tool/slices/lobehubSkillStore/selectors.ts
index 6f6c88c0c83..85462d6cd7d 100644
--- a/src/store/tool/slices/lobehubSkillStore/selectors.ts
+++ b/src/store/tool/slices/lobehubSkillStore/selectors.ts
@@ -1,3 +1,7 @@
+import urlJoin from 'url-join';
+
+import { OFFICIAL_SITE } from '@/const/url';
+
import { type ToolStoreState } from '../../initialState';
import { type LobehubSkillServer } from './types';
import { LobehubSkillStatus } from './types';
@@ -96,7 +100,7 @@ export const lobehubSkillStoreSelectors = {
manifest: {
api: apis,
author: 'LobeHub Market',
- homepage: 'https://lobehub.com/market',
+ homepage: urlJoin(OFFICIAL_SITE, 'market'),
identifier: server.identifier,
meta: {
avatar: server.icon || '🔗',