Skip to content

Commit 7ecbc25

Browse files
committed
new app frontend to support multi examples adopted from productivity suite
Signed-off-by: cheehook <[email protected]>
1 parent 1e46004 commit 7ecbc25

File tree

131 files changed

+8298
-1554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+8298
-1554
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
test-results/
22
**.log
33
**/report.html
4-
docker-compose
4+
docker-compose
5+
**/node_modules/
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Use node 20.11.1 as the base image
5-
FROM node:latest AS vite-app
6-
7-
COPY react /usr/app/react
5+
FROM node:20.11.1 as vite-app
6+
7+
COPY ./react /usr/app/react
88
WORKDIR /usr/app/react
99

10-
RUN npm install --legacy-peer-deps && npm run build
1110

12-
FROM nginx:1.27.4-alpine-slim
11+
RUN ["npm", "install"]
12+
RUN ["npm", "run", "build"]
13+
1314

14-
# Install uuidgen in the nginx:alpine image
15-
RUN apk add --no-cache util-linux \
16-
&& apk upgrade --no-cache
15+
FROM nginx:alpine
1716

1817
COPY --from=vite-app /usr/app/react/dist /usr/share/nginx/html
1918
COPY ./react/env.sh /docker-entrypoint.d/env.sh
2019

2120
COPY ./react/nginx.conf /etc/nginx/conf.d/default.conf
22-
RUN chmod +x /docker-entrypoint.d/env.sh
21+
RUN chmod +x /docker-entrypoint.d/env.sh

app-frontend/compose.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
services:
5+
app-frontend:
6+
image: app-frontend:ch
7+
container_name: app-frontend
8+
depends_on:
9+
- chathistory-mongo
10+
ports:
11+
- 5175:80
12+
environment:
13+
- no_proxy=${no_proxy}
14+
- https_proxy=${https_proxy}
15+
- http_proxy=${http_proxy}
16+
- APP_BACKEND_SERVICE_URL=http://localhost:8888/v1/app-backend
17+
- APP_DATAPREP_SERVICE_URL=http://localhost:6007/v1/dataprep
18+
- APP_CHAT_HISTORY_SERVICE_URL=http://localhost:6012/v1/chathistory
19+
- APP_UI_SELECTION=chat,summary,code
20+
ipc: host
21+
restart: always
22+
23+
mongo:
24+
image: mongo:7.0.11
25+
container_name: mongodb
26+
ports:
27+
- 27017:27017
28+
environment:
29+
http_proxy: ${http_proxy}
30+
https_proxy: ${https_proxy}
31+
no_proxy: ${no_proxy}
32+
command: mongod --quiet --logpath /dev/null
33+
34+
chathistory-mongo:
35+
image: ${REGISTRY:-opea}/chathistory-mongo:${TAG:-latest}
36+
container_name: chathistory-mongo-server
37+
ports:
38+
- "6012:6012"
39+
ipc: host
40+
environment:
41+
http_proxy: ${http_proxy}
42+
no_proxy: ${no_proxy}
43+
https_proxy: ${https_proxy}
44+
MONGO_HOST: ${MONGO_HOST:-mongo}
45+
MONGO_PORT: ${MONGO_PORT:-27017}
46+
COLLECTION_NAME: ${COLLECTION_NAME:-Conversations}
47+
LOGFLAG: ${LOGFLAG}
48+
restart: unless-stopped
49+
50+
networks:
51+
default:
52+
driver: bridge

app-frontend/react/.env.production

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
VITE_APP_UUID=APP_UUID
1+
VITE_BACKEND_SERVICE_URL=APP_BACKEND_SERVICE_URL
2+
VITE_DATAPREP_SERVICE_URL=APP_DATAPREP_SERVICE_URL
3+
VITE_CHAT_HISTORY_SERVICE_URL=APP_CHAT_HISTORY_SERVICE_URL
4+
VITE_UI_SELECTION=APP_UI_SELECTION
5+
6+
VITE_PROMPT_SERVICE_GET_ENDPOINT=APP_PROMPT_SERVICE_GET_ENDPOINT
7+
VITE_PROMPT_SERVICE_CREATE_ENDPOINT=APP_PROMPT_SERVICE_CREATE_ENDPOINT
8+
VITE_PROMPT_SERVICE_DELETE_ENDPOINT=APP_PROMPT_SERVICE_DELETE_ENDPOINT

app-frontend/react/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ yarn-error.log*
77
pnpm-debug.log*
88
lerna-debug.log*
99

10-
# dependencies
11-
package-lock.json
1210
node_modules
1311
dist
1412
dist-ssr

app-frontend/react/env.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
# Copyright (C) 2024 Intel Corporation
33
# SPDX-License-Identifier: Apache-2.0
44

5-
# Generate a random UUID for the application
6-
export APP_UUID=$(uuidgen)
7-
8-
# Print the generated UUID for verification
9-
echo "Generated UUID: $APP_UUID"
10-
115
for i in $(env | grep APP_) #// Make sure to use the prefix MY_APP_ if you have any other prefix in env.production file variable name replace it with MY_APP_
126
do
137
key=$(echo $i | cut -d '=' -f 1)
@@ -16,6 +10,6 @@ do
1610
# sed All files
1711
# find /usr/share/nginx/html -type f -exec sed -i "s|${key}|${value}|g" '{}' +
1812

19-
# sed JS, CSS, and HTML files
20-
find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' -o -name '*.html' \) -exec sed -i "s|${key}|${value}|g" '{}' +
13+
# sed JS and CSS only
14+
find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' +
2115
done

app-frontend/react/index.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
<!--
2-
Copyright (C) 2024 Intel Corporation
2+
Copyright (C) 2025 Intel Corporation
33
SPDX-License-Identifier: Apache-2.0
44
-->
55

66
<!doctype html>
77
<html lang="en">
88
<head>
9-
<meta charset="UTF-8" />
10-
<link rel="icon" type="image/svg+xml" href="/src/assets/opea-icon-color.svg" />
11-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
12-
<title>Conversations UI</title>
9+
<meta charset="utf-8" />
10+
<link rel="shortcut icon" href="/favicon.ico" />
11+
<link rel="preconnect" href="https://fonts.googleapis.com" />
12+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
13+
<link
14+
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
15+
rel="stylesheet"
16+
/>
17+
<meta name="viewport" content="width=device-width, initial-scale=1" />
18+
<meta name="theme-color" content="#000000" />
19+
<meta name="description" content="RAG ui for demonstrating LLM functionality" />
20+
<link rel="apple-touch-icon" href="logo192.png" />
21+
<link rel="manifest" href="/manifest.json" />
22+
<title>OPEA Studio APP</title>
1323
</head>
1424
<body>
25+
<noscript>You need to enable JavaScript to run this app.</noscript>
1526
<div id="root"></div>
16-
<script type="module" src="/src/main.tsx?v=APP_UUID"></script>
27+
<script type="module" src="/src/index.tsx"></script>
1728
</body>
1829
</html>

app-frontend/react/nginx.conf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ server {
1212
root /usr/share/nginx/html;
1313
index index.html index.htm;
1414
try_files $uri $uri/ /index.html =404;
15-
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
1615

1716
location ~* \.(gif|jpe?g|png|webp|ico|svg|css|js|mp4|woff2)$ {
1817
expires 1d;
1918
}
2019
}
21-
}
20+
}

app-frontend/react/package.json

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,85 @@
11
{
2-
"name": "ui",
2+
"name": "ProductivitySuite",
3+
"version": "0.0.1",
4+
"description": "ProductivitySuite UI - OPEA",
5+
"homepage": ".",
36
"private": true,
4-
"version": "0.0.0",
57
"type": "module",
8+
"engines": {
9+
"node": "20.x"
10+
},
611
"scripts": {
7-
"dev": "vite",
8-
"build": "tsc && vite build",
9-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10-
"preview": "vite preview",
11-
"test": "vitest"
12+
"dev": "vite --port 5173",
13+
"build": "vite build",
14+
"preview": "vite preview --port 5173",
15+
"prettier:write": "prettier --write .",
16+
"test": "vitest run"
17+
},
18+
"eslintConfig": {
19+
"extends": [
20+
"react-app",
21+
"react-app/jest"
22+
]
23+
},
24+
"browserslist": {
25+
"production": [
26+
">0.2%",
27+
"not dead",
28+
"not op_mini all"
29+
],
30+
"development": [
31+
"last 1 chrome version",
32+
"last 1 firefox version",
33+
"last 1 safari version"
34+
]
1235
},
1336
"dependencies": {
14-
"@mantine/charts": "7.17.2",
15-
"@mantine/core": "^7.17.2",
16-
"@mantine/hooks": "^7.17.2",
17-
"@mantine/notifications": "^7.17.2",
1837
"@microsoft/fetch-event-source": "^2.0.1",
19-
"@reduxjs/toolkit": "^2.2.5",
20-
"@tabler/icons-react": "3.7.0",
21-
"axios": "^1.7.2",
22-
"luxon": "^3.4.4",
38+
"@mui/icons-material": "^6.4.1",
39+
"@mui/material": "^6.4.1",
40+
"@mui/styled-engine-sc": "^6.4.0",
41+
"@reduxjs/toolkit": "^2.5.0",
42+
"axios": "^1.7.9",
43+
"notistack": "^3.0.2",
2344
"react": "^18.2.0",
2445
"react-dom": "^18.2.0",
25-
"react-redux": "^9.1.2",
26-
"uuid": "^10.0.0"
46+
"react-markdown": "^8.0.7",
47+
"react-redux": "^9.2.0",
48+
"react-router-dom": "^7.1.1",
49+
"react-syntax-highlighter": "^15.6.1",
50+
"remark-breaks": "^4.0.0",
51+
"remark-frontmatter": "^5.0.0",
52+
"remark-gfm": "^3.0.1",
53+
"styled-components": "^6.1.14"
2754
},
2855
"devDependencies": {
29-
"@testing-library/react": "^16.0.0",
30-
"@types/luxon": "^3.4.2",
31-
"@types/node": "^20.12.12",
32-
"@types/react": "^18.2.66",
33-
"@types/react-dom": "^18.2.22",
34-
"@typescript-eslint/eslint-plugin": "^7.2.0",
35-
"@typescript-eslint/parser": "^7.2.0",
36-
"@vitejs/plugin-react": "^4.2.1",
37-
"eslint": "^8.57.0",
38-
"eslint-plugin-react-hooks": "^4.6.0",
39-
"eslint-plugin-react-refresh": "^0.4.6",
40-
"jsdom": "^24.1.0",
41-
"postcss": "^8.4.38",
42-
"postcss-preset-mantine": "^1.15.0",
43-
"postcss-simple-vars": "^7.0.1",
44-
"sass": "1.64.2",
45-
"typescript": "^5.2.2",
46-
"vite": "^5.2.13",
47-
"vitest": "^1.6.0"
56+
"@rollup/plugin-terser": "^0.4.4",
57+
"@testing-library/jest-dom": "^5.16.5",
58+
"@testing-library/react": "^13.4.0",
59+
"@testing-library/user-event": "^14.4.3",
60+
"@types/jest": "^29.4.0",
61+
"@types/node": "^18.13.0",
62+
"@types/react": "^19.0.2",
63+
"@types/react-dom": "^19.0.2",
64+
"@types/react-syntax-highlighter": "^15.5.13",
65+
"@vitejs/plugin-react": "^4.3.4",
66+
"concurrently": "^7.6.0",
67+
"cors": "^2.8.5",
68+
"cross-env": "^7.0.3",
69+
"dotenv": "^16.4.7",
70+
"express": "^4.21.2",
71+
"nodemon": "^3.1.9",
72+
"prettier": "^3.5.3",
73+
"rollup-plugin-visualizer": "^5.14.0",
74+
"sass": "^1.83.1",
75+
"typescript": "^5.7.3",
76+
"vite": "^5.3.1",
77+
"vite-plugin-compression": "^0.5.1",
78+
"vite-plugin-mkcert": "^1.17.6",
79+
"vite-plugin-sass-dts": "^1.3.30",
80+
"vite-plugin-svgr": "^4.3.0",
81+
"vitest": "^3.1.2",
82+
"wait-on": "^7.0.1",
83+
"webpack-bundle-analyzer": "^4.10.2"
4884
}
4985
}

app-frontend/react/postcss.config.cjs

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)