This commit is contained in:
leehk 2025-04-11 17:27:11 +08:00
parent 4810485a01
commit 835db2eb76
7 changed files with 34 additions and 8 deletions

View File

@ -68,7 +68,7 @@ COPY --from=builder /usr/src/app/wheels /wheels
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 --no-cache /wheels/*
RUN pipenv install --deploy
RUN pipenv install --deploy --ignore-pipfile --dev
RUN pipenv run pip install "uvicorn[standard]==0.26.0"
# add app

View File

@ -13,6 +13,7 @@ services:
build:
context: ./backend
dockerfile: Dockerfile
container_name: backend
platform: linux/amd64
command: pipenv run uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8000
volumes:

View File

@ -0,0 +1 @@
node_modules

View File

@ -16,6 +16,7 @@
"@eslint/js": "^9.21.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@types/node": "^22.14.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@vitejs/plugin-react": "^4.3.4",
@ -1711,6 +1712,16 @@
"dev": true,
"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": {
"version": "19.1.0",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.0.tgz",
@ -5228,6 +5239,13 @@
"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": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz",

View File

@ -20,6 +20,7 @@
"@eslint/js": "^9.21.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@types/node": "^22.14.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@vitejs/plugin-react": "^4.3.4",
@ -36,4 +37,4 @@
"vite": "^6.2.0",
"vitest": "^3.1.1"
}
}
}

View File

@ -1,5 +1,8 @@
import React, { useState, useEffect, useRef } from 'react';
const BASE_DOMAIN_NAME = process.env.REACT_APP_DOMAIN_NAME || 'localhost';
interface Message {
sender: 'user' | 'bot';
text: string;
@ -13,7 +16,7 @@ const App: React.FC = () => {
useEffect(() => {
mounted.current = true;
const ws = new WebSocket('ws://localhost:8004/ws');
const ws = new WebSocket(`ws://${BASE_DOMAIN_NAME}:8004/ws`);
setSocket(ws);
ws.onopen = () => {
console.log('WebSocket connection opened');

View File

@ -4,9 +4,11 @@ import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
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",
};