Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix server dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
seu1a authored Aug 26, 2024
2 parents db9bc40 + 43f78e5 commit c98eb17
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
2 changes: 1 addition & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ubuntu:latest

COPY server-0.0.1-SNAPSHOT.jar app.jar
COPY ./build/libs/server-0.0.1-SNAPSHOT.jar app.jar

ENTRYPOINT ["java","-jar","/app.jar"]
37 changes: 19 additions & 18 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import React, { useEffect } from "react";
import { GlobalStyle } from "@style/globalStyle";
import React, {useEffect} from "react";
import {GlobalStyle} from "@style/globalStyle";
import AppStateProvider from "@provider/theme/AppStateProvider";
import { BrowserRouter } from "react-router-dom";
import {BrowserRouter} from "react-router-dom";
import Routes from "@src/routes";
import axios from "axios";

function App() {
useEffect(() => {
axios
.get(`${process.env.SERVER_BASE_URL ?? "http://localhost:8080"}/test`)
.then((res) => {
console.log(res.data);
});
}, []);
useEffect(() => {
axios
.get(`${process.env.SERVER_BASE_URL ?? "http://localhost:8080"}/test`)
.then((res) => {
console.log(res.data);
})
.catch(e => console.log(e));
}, []);

return (
<AppStateProvider>
<BrowserRouter>
<GlobalStyle />
<Routes />
</BrowserRouter>
</AppStateProvider>
);
return (
<AppStateProvider>
<BrowserRouter>
<GlobalStyle/>
<Routes/>
</BrowserRouter>
</AppStateProvider>
);
}

export default App;
7 changes: 7 additions & 0 deletions web/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as process from "node:process";

const config = {
baseUrl: process.env.REACT_APP_SERVER_URL,
};

export default config;
29 changes: 29 additions & 0 deletions web/src/data/Repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import axios from "axios";
import config from "@src/config";

const usAxios = axios.create({
baseURL: config.baseUrl,
})

class Repository {
async ai1(prompt: string): Promise<Response> {
const {data} = await usAxios.post('ai/1', {
text: prompt
});
return data;
}

async ai2(prompt: string): Promise<Response> {
const {data} = await usAxios.post('ai/2', {
text: prompt
});
return data;
}

async ai3(prompt: string): Promise<Response> {
const {data} = await usAxios.post('ai/3', {
text: prompt
});
return data;
}
}
4 changes: 4 additions & 0 deletions web/src/data/Response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default interface Response {
state: number;
message: string;
}
8 changes: 4 additions & 4 deletions web/src/page/play/scene/ScenePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ export default function ScenePage(
<S.Name>
{user.name ?? name}
</S.Name>
{chat.isLoading == true && (
<Loader></Loader>
{chat.isLoading === true && (
<Loader/>
)}
{typeof chat.message === "string" && chat.isLoading != true && (
{typeof chat.message === "string" && chat.isLoading !== true && (
<TypingText
text={chat.message}
speed={50}
onEnded={handleKeyDown}
/>
)}
{typeof chat.message === "object" && chat.isLoading != true && (
{typeof chat.message === "object" && chat.isLoading !== true && (
<SelectText
texts={chat.message}
onEnded={(text: string) => {
Expand Down
6 changes: 3 additions & 3 deletions web/src/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {Route, Routes as Switch} from "react-router-dom";
import {Navigate, Route, Routes as Switch} from "react-router-dom";
import StartPage from "@src/page/start/StartPage";
import PlayPage from "@src/page/play/PlayPage";

export default function Routes() {
return (
<Switch>
<Route path={"/"} element={<StartPage/>} />
<Route path={"/"} index={true} element={<StartPage/>} />
<Route path={"/play"} element={<PlayPage/>} />
<Route path={'*'} element={<div>404</div>}/>
<Route path={'*'} element={<Navigate to={'/'} replace={true}/>}/>
</Switch>
);
}

0 comments on commit c98eb17

Please sign in to comment.