mirror of
https://github.com/aimingmed/aimingmed-ai.git
synced 2026-02-07 15:53:45 +08:00
Merge pull request #26 from aimingmed/feature/backend-frontend-structure
Feature/backend frontend structure
This commit is contained in:
commit
0d7e8456c0
4
.github/workflows/develop.yml
vendored
4
.github/workflows/develop.yml
vendored
@ -1,9 +1,6 @@
|
|||||||
name: CI/CD - develop
|
name: CI/CD - develop
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- develop
|
- develop
|
||||||
@ -83,3 +80,4 @@ jobs:
|
|||||||
# run: docker exec backend pipenv run python -m black . --check
|
# run: docker exec backend pipenv run python -m black . --check
|
||||||
# - name: isort
|
# - name: isort
|
||||||
# run: docker exec backend pipenv run python -m isort . --check-only
|
# run: docker exec backend pipenv run python -m isort . --check-only
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ RUN pip install --upgrade pip setuptools wheel -i https://pypi.tuna.tsinghua.edu
|
|||||||
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv
|
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -i https://pypi.tuna.tsinghua.edu.cn/simple pipenv
|
||||||
RUN pip install --no-cache-dir --find-links=/usr/src/app/wheels pipenv
|
RUN pip install --no-cache-dir --find-links=/usr/src/app/wheels pipenv
|
||||||
COPY ./Pipfile .
|
COPY ./Pipfile .
|
||||||
RUN pipenv install --deploy
|
RUN pipenv lock --pre && pipenv install --deploy
|
||||||
|
|
||||||
# add app
|
# add app
|
||||||
COPY . /usr/src/app
|
COPY . /usr/src/app
|
||||||
@ -68,7 +68,7 @@ COPY --from=builder /usr/src/app/wheels /wheels
|
|||||||
COPY --from=builder /usr/src/app/Pipfile .
|
COPY --from=builder /usr/src/app/Pipfile .
|
||||||
RUN pip install --upgrade pip setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple
|
RUN pip install --upgrade pip setuptools wheel -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||||
RUN pip install --no-cache /wheels/*
|
RUN pip install --no-cache /wheels/*
|
||||||
RUN pipenv install --deploy
|
RUN pipenv lock --pre && pipenv install --deploy
|
||||||
RUN pipenv run pip install "uvicorn[standard]==0.26.0"
|
RUN pipenv run pip install "uvicorn[standard]==0.26.0"
|
||||||
|
|
||||||
# add app
|
# add app
|
||||||
|
|||||||
@ -13,6 +13,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
container_name: backend
|
||||||
platform: linux/amd64
|
platform: linux/amd64
|
||||||
command: pipenv run uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8000
|
command: pipenv run uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8000
|
||||||
volumes:
|
volumes:
|
||||||
@ -22,3 +23,18 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- ENVIRONMENT=dev
|
- ENVIRONMENT=dev
|
||||||
- TESTING=0
|
- TESTING=0
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
dockerfile: Dockerfile.local
|
||||||
|
container_name: frontend
|
||||||
|
platform: linux/amd64
|
||||||
|
volumes:
|
||||||
|
- ./frontend:/usr/src/app
|
||||||
|
ports:
|
||||||
|
- "3004:5173"
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
environment:
|
||||||
|
LOG_LEVEL: "DEBUG"
|
||||||
|
|||||||
1
app/frontend/.dockerignore
Normal file
1
app/frontend/.dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules
|
||||||
1
app/frontend/.env.production
Normal file
1
app/frontend/.env.production
Normal file
@ -0,0 +1 @@
|
|||||||
|
REACT_APP_BASE_URL=https://backend.aimingmed.com/
|
||||||
42
app/frontend/package-lock.json
generated
42
app/frontend/package-lock.json
generated
@ -16,6 +16,7 @@
|
|||||||
"@eslint/js": "^9.21.0",
|
"@eslint/js": "^9.21.0",
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
|
"@types/node": "^22.14.0",
|
||||||
"@types/react": "^19.0.10",
|
"@types/react": "^19.0.10",
|
||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@vitejs/plugin-react": "^4.3.4",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
@ -31,6 +32,9 @@
|
|||||||
"typescript-eslint": "^8.24.1",
|
"typescript-eslint": "^8.24.1",
|
||||||
"vite": "^6.2.0",
|
"vite": "^6.2.0",
|
||||||
"vitest": "^3.1.1"
|
"vitest": "^3.1.1"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@rollup/rollup-linux-x64-gnu": "4.9.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@adobe/css-tools": {
|
"node_modules/@adobe/css-tools": {
|
||||||
@ -1484,13 +1488,12 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
||||||
"version": "4.39.0",
|
"version": "4.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.39.0.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.9.5.tgz",
|
||||||
"integrity": "sha512-t9jqYw27R6Lx0XKfEFe5vUeEJ5pF3SGIM6gTfONSMb7DuG6z6wfj2yjcoZxHg129veTqU7+wOhY6GX8wmf90dA==",
|
"integrity": "sha512-Dq1bqBdLaZ1Gb/l2e5/+o3B18+8TI9ANlA1SkejZqDgdU/jK/ThYaMPMJpVMMXy2uRHvGKbkz9vheVGdq3cJfA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -1711,6 +1714,16 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "22.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.0.tgz",
|
||||||
|
"integrity": "sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~6.21.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/react": {
|
"node_modules/@types/react": {
|
||||||
"version": "19.1.0",
|
"version": "19.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.0.tgz",
|
||||||
@ -4674,6 +4687,20 @@
|
|||||||
"fsevents": "~2.3.2"
|
"fsevents": "~2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/rollup/node_modules/@rollup/rollup-linux-x64-gnu": {
|
||||||
|
"version": "4.39.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.39.0.tgz",
|
||||||
|
"integrity": "sha512-t9jqYw27R6Lx0XKfEFe5vUeEJ5pF3SGIM6gTfONSMb7DuG6z6wfj2yjcoZxHg129veTqU7+wOhY6GX8wmf90dA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
]
|
||||||
|
},
|
||||||
"node_modules/rrweb-cssom": {
|
"node_modules/rrweb-cssom": {
|
||||||
"version": "0.8.0",
|
"version": "0.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz",
|
||||||
@ -5228,6 +5255,13 @@
|
|||||||
"typescript": ">=4.8.4 <5.9.0"
|
"typescript": ">=4.8.4 <5.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "6.21.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
||||||
|
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/update-browserslist-db": {
|
"node_modules/update-browserslist-db": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz",
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
"@eslint/js": "^9.21.0",
|
"@eslint/js": "^9.21.0",
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
|
"@types/node": "^22.14.0",
|
||||||
"@types/react": "^19.0.10",
|
"@types/react": "^19.0.10",
|
||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@vitejs/plugin-react": "^4.3.4",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
@ -35,5 +36,8 @@
|
|||||||
"typescript-eslint": "^8.24.1",
|
"typescript-eslint": "^8.24.1",
|
||||||
"vite": "^6.2.0",
|
"vite": "^6.2.0",
|
||||||
"vitest": "^3.1.1"
|
"vitest": "^3.1.1"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@rollup/rollup-linux-x64-musl": "^3.28.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,8 @@
|
|||||||
import React, { useState, useEffect, useRef } from 'react';
|
import React, { useState, useEffect, useRef } from 'react';
|
||||||
|
|
||||||
|
const BASE_DOMAIN_NAME = process.env.REACT_APP_DOMAIN_NAME || 'localhost';
|
||||||
|
|
||||||
|
|
||||||
interface Message {
|
interface Message {
|
||||||
sender: 'user' | 'bot';
|
sender: 'user' | 'bot';
|
||||||
text: string;
|
text: string;
|
||||||
@ -13,7 +16,7 @@ const App: React.FC = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
mounted.current = true;
|
mounted.current = true;
|
||||||
const ws = new WebSocket('ws://localhost:8000/ws');
|
const ws = new WebSocket(`ws://${BASE_DOMAIN_NAME}:8004/ws`);
|
||||||
setSocket(ws);
|
setSocket(ws);
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
console.log('WebSocket connection opened');
|
console.log('WebSocket connection opened');
|
||||||
|
|||||||
@ -4,9 +4,11 @@ import react from '@vitejs/plugin-react'
|
|||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
test: {
|
|
||||||
globals: true,
|
|
||||||
environment: "jsdom",
|
|
||||||
setupFiles: "./tests/setup.ts",
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// https://vitest.dev/config/
|
||||||
|
export const test = {
|
||||||
|
globals: true,
|
||||||
|
environment: "jsdom",
|
||||||
|
setupFiles: "./tests/setup.ts",
|
||||||
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user