Skip to content

Commit 5b456c1

Browse files
authored
Merge pull request #1110 from refly-ai/fix/web-dockerfile
fix: update Dockerfile config for web-next
2 parents 158aea0 + 96986e3 commit 5b456c1

File tree

12 files changed

+29
-20
lines changed

12 files changed

+29
-20
lines changed

.github/workflows/deploy-web-prod.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
VITE_SUBSCRIPTION_ENABLED: true
4848
VITE_CANVAS_TEMPLATE_ENABLED: true
4949
VITE_SENTRY_ENABLED: true
50+
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
51+
VITE_GTAG_ID: ${{ secrets.GTAG_ID }}
5052
VITE_RUNTIME: web
5153
VITE_STATIC_PUBLIC_ENDPOINT: https://static.refly.ai
5254
VITE_STATIC_PRIVATE_ENDPOINT: https://api.refly.ai/v1/misc

.github/workflows/deploy-web-staging.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
VITE_SUBSCRIPTION_ENABLED: true
3939
VITE_CANVAS_TEMPLATE_ENABLED: true
4040
VITE_SENTRY_ENABLED: true
41+
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
42+
VITE_GTAG_ID: ${{ secrets.GTAG_ID }}
4143
VITE_RUNTIME: web
4244
VITE_STATIC_PUBLIC_ENDPOINT: https://static.refly.ai
4345
VITE_STATIC_PRIVATE_ENDPOINT: https://staging-api.refly.ai/v1/misc

apps/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "nodemon",
88
"dev:electron": "nodemon",
99
"start": "tsc && tsc-alias --project tsconfig.json && electron .",
10-
"copy-renderer": "ncp ../web/dist dist/renderer",
10+
"copy-renderer": "ncp ../web-next/dist dist/renderer",
1111
"build:mac": "tsc && electron-builder --mac --dir",
1212
"build:mac:x64": "tsc && electron-builder --mac --x64 --dir",
1313
"build:mac:arm64": "tsc && electron-builder --mac --arm64 --dir",

apps/extension/src/entrypoints/main-csui.content/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { AppRouter } from '@/routes/index';
1919

2020
// 加载国际化
2121
import '@/i18n/config';
22-
import { SENTRY_DSN } from '@refly/utils/url';
2322

2423
// 样式
2524
import '@/styles/style.css';
@@ -29,9 +28,10 @@ import { getPopupContainer } from '@refly-packages/ai-workspace-common/utils/ui'
2928
import { getEnv, setRuntime } from '@refly/utils/env';
3029
const Sentry = _Sentry;
3130

32-
if (process.env.NODE_ENV !== 'development') {
31+
const sentryDsn = process.env.VITE_SENTRY_DSN;
32+
if (process.env.NODE_ENV !== 'development' && sentryDsn) {
3333
Sentry.init({
34-
dsn: SENTRY_DSN,
34+
dsn: sentryDsn,
3535
environment: getEnv(),
3636
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
3737
tracesSampleRate: 1.0, // Capture 100% of the transactions

apps/web-next/.env.example

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ VITE_STATIC_PUBLIC_ENDPOINT=http://localhost:5800/v1/misc/public
1616
# Static private endpoint
1717
VITE_STATIC_PRIVATE_ENDPOINT=http://localhost:5800/v1/misc
1818

19-
19+
# Sentry configuration
2020
VITE_SENTRY_ENABLED=
21+
VITE_SENTRY_DSN=
22+
23+
# Google tag manager ID
24+
VITE_GTAG_ID=
25+
2126
VITE_RUNTIME=

apps/web-next/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ COPY deploy/docker/nginx.conf /etc/nginx/conf.d/default.conf
99

1010
# Copy static files
1111
WORKDIR /usr/share/nginx/html
12-
COPY apps/web/dist .
12+
COPY apps/web-next/dist .
1313

1414
# Create config.js template
1515
RUN echo 'window.ENV = { \

apps/web-next/rsbuild.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { publicVars } = loadEnv({ prefixes: ['VITE_'] });
1010

1111
import path from 'node:path';
1212

13-
const GTAG_ID = 'G-ER782LXJ5F';
13+
const gtagId = process.env.VITE_GTAG_ID;
1414

1515
const isProduction = process.env.NODE_ENV === 'production';
1616

@@ -74,13 +74,13 @@ export default defineConfig({
7474
},
7575
html: {
7676
template: './public/index.html',
77-
tags: isProduction
77+
tags: gtagId
7878
? [
7979
{
8080
tag: 'script',
8181
attrs: {
8282
async: true,
83-
src: `https://www.googletagmanager.com/gtag/js?id=${GTAG_ID}`,
83+
src: `https://www.googletagmanager.com/gtag/js?id=${gtagId}`,
8484
},
8585
},
8686
{
@@ -91,7 +91,7 @@ export default defineConfig({
9191
dataLayer.push(arguments);
9292
}
9393
gtag('js', new Date());
94-
gtag('config', '${GTAG_ID}');
94+
gtag('config', '${gtagId}');
9595
`,
9696
},
9797
]

apps/web/src/main.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ window.addEventListener('unhandledrejection', (event) => {
6565

6666
// Move Sentry initialization to a separate function
6767
const initSentry = async () => {
68-
if (process.env.NODE_ENV !== 'development') {
68+
const sentryDsn = process.env.VITE_SENTRY_DSN;
69+
if (process.env.NODE_ENV !== 'development' && sentryDsn) {
6970
const Sentry = await import('@sentry/react');
7071
Sentry.init({
71-
dsn: 'https://a687291d5ba3a77b0fa559e6d197eac8@o4507205453414400.ingest.us.sentry.io/4507208398602240',
72+
dsn: sentryDsn,
7273
environment: getEnv(),
7374
integrations: [
7475
Sentry.browserTracingIntegration(),

apps/web/vite-gtag-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Plugin } from 'vite';
22

3-
const GTAG_ID = 'G-ER782LXJ5F';
3+
const GTAG_ID = process.env.VITE_GTAG_ID;
44

55
export function gtagPlugin(): Plugin {
66
return {

packages/ai-workspace-common/src/components/project/project-knowledge-toggle/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export const ProjectKnowledgeToggle: React.FC<ProjectKnowledgeToggleProps> = ({
9090
const projectName = currentProject?.name || t('common.untitled');
9191

9292
return (
93-
<div className={`project-kb-toggle mt-auto border-t border-gray-100 pt-2 pb-2 ${className}`}>
94-
<div className="rounded-lg flex items-center justify-between bg-gray-50 p-2 pt-0 pb-0 border border-solid dark:border-gray-700 dark:bg-gray-800 hover:border-[#00968F]/30 transition-all cursor-pointer">
93+
<div className={`project-kb-toggle mt-auto pt-2 pb-2 ${className}`}>
94+
<div className="rounded-lg flex items-center justify-between bg-gray-100 p-2 pt-0 pb-0 dark:bg-gray-800 hover:border-[#00968F]/30 transition-all cursor-pointer">
9595
<div className="flex items-center gap-2 flex-shrink overflow-hidden">
9696
<LuBrain
9797
className={`transition-colors duration-300 flex-shrink-0 ${enabledKnowledgeBase ? 'text-[#00968F]' : 'text-gray-500'}`}

0 commit comments

Comments
 (0)