From f06e536f656d302889b2d0d8a8bd597a7063d9bb Mon Sep 17 00:00:00 2001 From: Dinh Long Nguyen Date: Mon, 3 Nov 2025 16:29:06 +0700 Subject: [PATCH] Web: Rename Jan Namespace (#6860) * Web: Rename Jan Namespace * Update extensions-web/src/mcp-web/index.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/jan-server-web-ci-dev.yml | 4 ++-- .github/workflows/jan-server-web-ci-prod.yml | 4 ++-- .github/workflows/jan-server-web-ci-stag.yml | 5 +++-- Dockerfile | 4 ++-- docs/src/pages/docs/desktop/index.mdx | 2 +- extensions-web/src/conversational-web/api.ts | 12 ++++++------ extensions-web/src/jan-provider-web/api.ts | 8 ++++---- extensions-web/src/mcp-web/index.ts | 6 +++--- extensions-web/src/shared/auth/api.ts | 8 ++++---- extensions-web/src/shared/auth/providers/api.ts | 6 +++--- extensions-web/src/shared/auth/service.ts | 4 ++-- extensions-web/src/types/global.d.ts | 2 +- extensions-web/vite.config.ts | 2 +- 13 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.github/workflows/jan-server-web-ci-dev.yml b/.github/workflows/jan-server-web-ci-dev.yml index 720ce4834..2b8bbb7aa 100644 --- a/.github/workflows/jan-server-web-ci-dev.yml +++ b/.github/workflows/jan-server-web-ci-dev.yml @@ -12,7 +12,7 @@ jobs: build-and-preview: runs-on: [ubuntu-24-04-docker] env: - MENLO_PLATFORM_BASE_URL: "https://api-dev.jan.ai/v1" + JAN_BASE_URL: "https://api-dev.jan.ai/v1" permissions: pull-requests: write contents: write @@ -52,7 +52,7 @@ jobs: - name: Build docker image run: | - docker build --build-arg MENLO_PLATFORM_BASE_URL=${{ env.MENLO_PLATFORM_BASE_URL }} -t ${{ steps.vars.outputs.FULL_IMAGE }} . + docker build --build-arg JAN_BASE_URL=${{ env.JAN_BASE_URL }} -t ${{ steps.vars.outputs.FULL_IMAGE }} . - name: Push docker image if: github.event_name == 'push' diff --git a/.github/workflows/jan-server-web-ci-prod.yml b/.github/workflows/jan-server-web-ci-prod.yml index 97ce1c8b7..cc4d31895 100644 --- a/.github/workflows/jan-server-web-ci-prod.yml +++ b/.github/workflows/jan-server-web-ci-prod.yml @@ -13,7 +13,7 @@ jobs: deployments: write pull-requests: write env: - MENLO_PLATFORM_BASE_URL: "https://api.jan.ai/v1" + JAN_BASE_URL: "https://api.jan.ai/v1" GA_MEASUREMENT_ID: "G-YK53MX8M8M" CLOUDFLARE_PROJECT_NAME: "jan-server-web" steps: @@ -43,7 +43,7 @@ jobs: - name: Install dependencies run: make config-yarn && yarn install && yarn build:core && make build-web-app env: - MENLO_PLATFORM_BASE_URL: ${{ env.MENLO_PLATFORM_BASE_URL }} + JAN_BASE_URL: ${{ env.JAN_BASE_URL }} GA_MEASUREMENT_ID: ${{ env.GA_MEASUREMENT_ID }} - name: Publish to Cloudflare Pages Production diff --git a/.github/workflows/jan-server-web-ci-stag.yml b/.github/workflows/jan-server-web-ci-stag.yml index 3d4abac3c..b113bf30c 100644 --- a/.github/workflows/jan-server-web-ci-stag.yml +++ b/.github/workflows/jan-server-web-ci-stag.yml @@ -12,7 +12,8 @@ jobs: build-and-preview: runs-on: [ubuntu-24-04-docker] env: - MENLO_PLATFORM_BASE_URL: "https://api-stag.jan.ai/v1" + JAN_BASE_URL: "https://api-stag.jan.ai/v1" + GA_MEASUREMENT_ID: "G-YK53MX8M8M" permissions: pull-requests: write contents: write @@ -52,7 +53,7 @@ jobs: - name: Build docker image run: | - docker build --build-arg MENLO_PLATFORM_BASE_URL=${{ env.MENLO_PLATFORM_BASE_URL }} -t ${{ steps.vars.outputs.FULL_IMAGE }} . + docker build --build-arg JAN_BASE_URL=${{ env.JAN_BASE_URL }} --build-arg GA_MEASUREMENT_ID=${{ env.GA_MEASUREMENT_ID }} -t ${{ steps.vars.outputs.FULL_IMAGE }} . - name: Push docker image if: github.event_name == 'push' diff --git a/Dockerfile b/Dockerfile index ad14af852..5b2c7cb42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ # Stage 1: Build stage with Node.js and Yarn v4 FROM node:20-alpine AS builder -ARG MENLO_PLATFORM_BASE_URL=https://api-dev.menlo.ai/v1 -ENV MENLO_PLATFORM_BASE_URL=$MENLO_PLATFORM_BASE_URL +ARG JAN_BASE_URL=https://api-dev.jan.ai/v1 +ENV JAN_BASE_URL=$JAN_BASE_URL # Install build dependencies RUN apk add --no-cache \ diff --git a/docs/src/pages/docs/desktop/index.mdx b/docs/src/pages/docs/desktop/index.mdx index 3c225abb3..852f097a5 100644 --- a/docs/src/pages/docs/desktop/index.mdx +++ b/docs/src/pages/docs/desktop/index.mdx @@ -41,7 +41,7 @@ Jan is an open-source replacement for ChatGPT: Jan is a full [product suite](https://en.wikipedia.org/wiki/Software_suite) that offers an alternative to Big AI: - [Jan Desktop](/docs/desktop/quickstart): macOS, Windows, and Linux apps with offline mode -- [Jan Web](https://chat.menlo.ai): Jan on browser, a direct alternative to chatgpt.com +- [Jan Web](https://chat.jan.ai): Jan on browser, a direct alternative to chatgpt.com - Jan Mobile: iOS and Android apps (Coming Soon) - [Jan Server](/docs/server): deploy locally, in your cloud, or on-prem - [Jan Models](/docs/models): Open-source models optimized for deep research, tool use, and reasoning diff --git a/extensions-web/src/conversational-web/api.ts b/extensions-web/src/conversational-web/api.ts index bdd147edd..bfbfde09d 100644 --- a/extensions-web/src/conversational-web/api.ts +++ b/extensions-web/src/conversational-web/api.ts @@ -16,7 +16,7 @@ import { ListConversationItemsResponse } from './types' -declare const MENLO_PLATFORM_BASE_URL: string +declare const JAN_BASE_URL: string export class RemoteApi { private authService: JanAuthService @@ -28,7 +28,7 @@ export class RemoteApi { async createConversation( data: Conversation ): Promise { - const url = `${MENLO_PLATFORM_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATIONS}` + const url = `${JAN_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATIONS}` return this.authService.makeAuthenticatedRequest( url, @@ -43,7 +43,7 @@ export class RemoteApi { conversationId: string, data: Conversation ): Promise { - const url = `${MENLO_PLATFORM_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATION_BY_ID(conversationId)}` + const url = `${JAN_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATION_BY_ID(conversationId)}` return this.authService.makeAuthenticatedRequest( url, @@ -70,7 +70,7 @@ export class RemoteApi { } const queryString = queryParams.toString() - const url = `${MENLO_PLATFORM_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATIONS}${queryString ? `?${queryString}` : ''}` + const url = `${JAN_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATIONS}${queryString ? `?${queryString}` : ''}` return this.authService.makeAuthenticatedRequest( url, @@ -114,7 +114,7 @@ export class RemoteApi { } async deleteConversation(conversationId: string): Promise { - const url = `${MENLO_PLATFORM_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATION_BY_ID(conversationId)}` + const url = `${JAN_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATION_BY_ID(conversationId)}` await this.authService.makeAuthenticatedRequest( url, @@ -141,7 +141,7 @@ export class RemoteApi { } const queryString = queryParams.toString() - const url = `${MENLO_PLATFORM_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATION_ITEMS(conversationId)}${queryString ? `?${queryString}` : ''}` + const url = `${JAN_BASE_URL}${CONVERSATION_API_ROUTES.CONVERSATION_ITEMS(conversationId)}${queryString ? `?${queryString}` : ''}` return this.authService.makeAuthenticatedRequest( url, diff --git a/extensions-web/src/jan-provider-web/api.ts b/extensions-web/src/jan-provider-web/api.ts index ded8f3214..1b00f4edb 100644 --- a/extensions-web/src/jan-provider-web/api.ts +++ b/extensions-web/src/jan-provider-web/api.ts @@ -8,7 +8,7 @@ import { ApiError } from '../shared/types/errors' import { JAN_API_ROUTES } from './const' import { JanModel, janProviderStore } from './store' -// MENLO_PLATFORM_BASE_URL is defined in vite.config.ts +// JAN_BASE_URL is defined in vite.config.ts // Constants const TEMPORARY_CHAT_ID = 'temporary-chat' @@ -20,7 +20,7 @@ const TEMPORARY_CHAT_ID = 'temporary-chat' */ function getChatCompletionConfig(request: JanChatCompletionRequest, stream: boolean = false) { const isTemporaryChat = request.conversation_id === TEMPORARY_CHAT_ID - const endpoint = `${MENLO_PLATFORM_BASE_URL}${JAN_API_ROUTES.CHAT_COMPLETIONS}` + const endpoint = `${JAN_BASE_URL}${JAN_API_ROUTES.CHAT_COMPLETIONS}` const payload = { ...request, @@ -162,7 +162,7 @@ export class JanApiClient { this.modelsFetchPromise = (async () => { const response = await this.authService.makeAuthenticatedRequest( - `${MENLO_PLATFORM_BASE_URL}${JAN_API_ROUTES.MODELS}` + `${JAN_BASE_URL}${JAN_API_ROUTES.MODELS}` ) const summaries = response.data || [] @@ -327,7 +327,7 @@ export class JanApiClient { private async fetchSupportedParameters(modelId: string): Promise { try { - const endpoint = `${MENLO_PLATFORM_BASE_URL}${JAN_API_ROUTES.MODEL_CATALOGS}/${this.encodeModelIdForCatalog(modelId)}` + const endpoint = `${JAN_BASE_URL}${JAN_API_ROUTES.MODEL_CATALOGS}/${this.encodeModelIdForCatalog(modelId)}` const catalog = await this.authService.makeAuthenticatedRequest(endpoint) return this.extractSupportedParameters(catalog) } catch (error) { diff --git a/extensions-web/src/mcp-web/index.ts b/extensions-web/src/mcp-web/index.ts index 6545fd426..7d5c2ba46 100644 --- a/extensions-web/src/mcp-web/index.ts +++ b/extensions-web/src/mcp-web/index.ts @@ -12,8 +12,8 @@ import { JanMCPOAuthProvider } from './oauth-provider' import { WebSearchButton } from './components' import type { ComponentType } from 'react' -// MENLO_PLATFORM_BASE_URL is defined in vite.config.ts (defaults to 'https://api-dev.menlo.ai/jan/v1') -declare const MENLO_PLATFORM_BASE_URL: string +// JAN_BASE_URL is defined in vite.config.ts (defaults to 'https://api-dev.jan.ai/v1') +declare const JAN_BASE_URL: string export default class MCPExtensionWeb extends MCPExtension { private mcpEndpoint = '/mcp' @@ -77,7 +77,7 @@ export default class MCPExtensionWeb extends MCPExtension { // Create transport with OAuth provider (handles token refresh automatically) const transport = new StreamableHTTPClientTransport( - new URL(`${MENLO_PLATFORM_BASE_URL}${this.mcpEndpoint}`), + new URL(`${JAN_BASE_URL}${this.mcpEndpoint}`), { authProvider: this.oauthProvider // No sessionId needed - server will generate one automatically diff --git a/extensions-web/src/shared/auth/api.ts b/extensions-web/src/shared/auth/api.ts index a14617190..f28355952 100644 --- a/extensions-web/src/shared/auth/api.ts +++ b/extensions-web/src/shared/auth/api.ts @@ -6,13 +6,13 @@ import { AuthTokens } from './types' import { AUTH_ENDPOINTS } from './const' -declare const MENLO_PLATFORM_BASE_URL: string +declare const JAN_BASE_URL: string /** * Logout user on server */ export async function logoutUser(): Promise { - const response = await fetch(`${MENLO_PLATFORM_BASE_URL}${AUTH_ENDPOINTS.LOGOUT}`, { + const response = await fetch(`${JAN_BASE_URL}${AUTH_ENDPOINTS.LOGOUT}`, { method: 'GET', credentials: 'include', headers: { @@ -29,7 +29,7 @@ export async function logoutUser(): Promise { * Guest login */ export async function guestLogin(): Promise { - const response = await fetch(`${MENLO_PLATFORM_BASE_URL}${AUTH_ENDPOINTS.GUEST_LOGIN}`, { + const response = await fetch(`${JAN_BASE_URL}${AUTH_ENDPOINTS.GUEST_LOGIN}`, { method: 'POST', credentials: 'include', headers: { @@ -51,7 +51,7 @@ export async function guestLogin(): Promise { */ export async function refreshToken(): Promise { const response = await fetch( - `${MENLO_PLATFORM_BASE_URL}${AUTH_ENDPOINTS.REFRESH_TOKEN}`, + `${JAN_BASE_URL}${AUTH_ENDPOINTS.REFRESH_TOKEN}`, { method: 'GET', credentials: 'include', diff --git a/extensions-web/src/shared/auth/providers/api.ts b/extensions-web/src/shared/auth/providers/api.ts index f63b5a915..d0f4909b7 100644 --- a/extensions-web/src/shared/auth/providers/api.ts +++ b/extensions-web/src/shared/auth/providers/api.ts @@ -5,10 +5,10 @@ import { AuthTokens, LoginUrlResponse } from './types' -declare const MENLO_PLATFORM_BASE_URL: string +declare const JAN_BASE_URL: string export async function getLoginUrl(endpoint: string): Promise { - const response: Response = await fetch(`${MENLO_PLATFORM_BASE_URL}${endpoint}`, { + const response: Response = await fetch(`${JAN_BASE_URL}${endpoint}`, { method: 'GET', credentials: 'include', headers: { @@ -30,7 +30,7 @@ export async function handleOAuthCallback( code: string, state?: string ): Promise { - const response: Response = await fetch(`${MENLO_PLATFORM_BASE_URL}${endpoint}`, { + const response: Response = await fetch(`${JAN_BASE_URL}${endpoint}`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/extensions-web/src/shared/auth/service.ts b/extensions-web/src/shared/auth/service.ts index fc12b5ffd..6da9e546d 100644 --- a/extensions-web/src/shared/auth/service.ts +++ b/extensions-web/src/shared/auth/service.ts @@ -3,7 +3,7 @@ * Handles authentication flows for any OAuth provider */ -declare const MENLO_PLATFORM_BASE_URL: string +declare const JAN_BASE_URL: string import { User, AuthState, AuthBroadcastMessage, AuthTokens } from './types' import { @@ -429,7 +429,7 @@ export class JanAuthService { private async fetchUserProfile(): Promise { try { return await this.makeAuthenticatedRequest( - `${MENLO_PLATFORM_BASE_URL}${AUTH_ENDPOINTS.ME}` + `${JAN_BASE_URL}${AUTH_ENDPOINTS.ME}` ) } catch (error) { console.error('Failed to fetch user profile:', error) diff --git a/extensions-web/src/types/global.d.ts b/extensions-web/src/types/global.d.ts index 22dea22d0..bd63ea3d3 100644 --- a/extensions-web/src/types/global.d.ts +++ b/extensions-web/src/types/global.d.ts @@ -1,5 +1,5 @@ export {} declare global { - declare const MENLO_PLATFORM_BASE_URL: string + declare const JAN_BASE_URL: string } diff --git a/extensions-web/vite.config.ts b/extensions-web/vite.config.ts index b68fc4d5a..b1e54e439 100644 --- a/extensions-web/vite.config.ts +++ b/extensions-web/vite.config.ts @@ -14,6 +14,6 @@ export default defineConfig({ emptyOutDir: false // Don't clean the output directory }, define: { - MENLO_PLATFORM_BASE_URL: JSON.stringify(process.env.MENLO_PLATFORM_BASE_URL || 'https://api-dev.menlo.ai/v1'), + JAN_BASE_URL: JSON.stringify(process.env.JAN_BASE_URL || 'https://api-dev.jan.ai/v1'), } })