Skip to content

Commit

Permalink
Merge pull request #504 from Team-WeQuiz/feat/#493
Browse files Browse the repository at this point in the history
[ML] 코드 리팩토링,. 메모리 약간 최적화
  • Loading branch information
noooey authored May 27, 2024
2 parents 9ef3d67 + 8fe8dbd commit b70475e
Show file tree
Hide file tree
Showing 15 changed files with 338 additions and 493 deletions.
1 change: 0 additions & 1 deletion .github/workflows/fe-docker-buildx-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,5 @@ jobs:
build-args: |
AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID }}
cache-from: type=gha
cache-to: type=gha, mode=max
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ AI가 생성한 퀴즈를 친구들과 함께 푸는 서비스
</br>

## 🎮 Demo
[![Video Label](http://img.youtube.com/vi/_8EoD0a8urQ/0.jpg)](https://www.youtube.com/watch?v=L84IS3E5d7Y)
준비 중...

</br>
</br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@

public enum ModelExceptionType implements ExceptionType {

INSUFFICIENT_TOKENS(Status.BAD_REQUEST, 9001, "토큰이 적어서 요청을 처리할 수 없습니다"),
TOO_MANY_TOKENS(Status.BAD_REQUEST, 9002, "토큰이 너무 많아서 요청을 처리할 수 없습니다"),
TOO_MANY_PAGES(Status.BAD_REQUEST, 9003, "페이지가 너무 많아서 요청을 처리할 수 없습니다"),
FILE_NOT_AVAILABLE(Status.BAD_REQUEST, 9004, "사용할 수 없는 파일입니다"),
FAILED_TO_CREATE(Status.SERVER_ERROR, 9005, "서버에서 퀴즈를 생성하는데 실패했습니다");
//토큰이 적을때 오류
LACK_OF_TOKEN(Status.BAD_REQUEST, 9001, "토큰이 적어서 요청을 처리할 수 없습니다");

private final Status status;
private final int exceptionCode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
package com.chatty.chatty.game.service.model;

import static com.chatty.chatty.game.exception.ModelExceptionType.FAILED_TO_CREATE;
import static com.chatty.chatty.game.exception.ModelExceptionType.FILE_NOT_AVAILABLE;
import static com.chatty.chatty.game.exception.ModelExceptionType.INSUFFICIENT_TOKENS;
import static com.chatty.chatty.game.exception.ModelExceptionType.TOO_MANY_PAGES;
import static com.chatty.chatty.game.exception.ModelExceptionType.TOO_MANY_TOKENS;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static com.chatty.chatty.game.exception.ModelExceptionType.LACK_OF_TOKEN;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
import static org.springframework.http.HttpStatus.PAYLOAD_TOO_LARGE;
import static org.springframework.http.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE;
import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
import static org.springframework.http.MediaType.APPLICATION_JSON;

import com.chatty.chatty.config.minio.MinioRepository;
Expand Down Expand Up @@ -53,31 +45,7 @@ public QuizDocIdMLResponse requestQuizDocId(
.onStatus(INTERNAL_SERVER_ERROR::equals,
(req, res) -> {
minioRepository.deleteFiles(fileNames);
throw new ModelException(FAILED_TO_CREATE);
}
)
.onStatus(UNPROCESSABLE_ENTITY::equals,
(req, res) -> {
minioRepository.deleteFiles(fileNames);
throw new ModelException(INSUFFICIENT_TOKENS);
}
)
.onStatus(PAYLOAD_TOO_LARGE::equals,
(req, res) -> {
minioRepository.deleteFiles(fileNames);
throw new ModelException(TOO_MANY_TOKENS);
}
)
.onStatus(REQUESTED_RANGE_NOT_SATISFIABLE::equals,
(req, res) -> {
minioRepository.deleteFiles(fileNames);
throw new ModelException(TOO_MANY_PAGES);
}
)
.onStatus(BAD_REQUEST::equals,
(req, res) -> {
minioRepository.deleteFiles(fileNames);
throw new ModelException(FILE_NOT_AVAILABLE);
throw new ModelException(LACK_OF_TOKEN);
}
)
.body(QuizDocIdMLResponse.class);
Expand Down
2 changes: 0 additions & 2 deletions chatty-fe/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ COPY . .

ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
ARG NEXT_PUBLIC_GOOGLE_ANALYTICS_ID

ENV AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
ENV NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=${NEXT_PUBLIC_GOOGLE_ANALYTICS_ID}

RUN npm run build

Expand Down
22 changes: 22 additions & 0 deletions chatty-fe/Empty_profile.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 0 additions & 18 deletions chatty-fe/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion chatty-fe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@aws-sdk/client-s3": "^3.511.0",
"@aws-sdk/client-secrets-manager": "^3.543.0",
"@aws-sdk/s3-request-presigner": "^3.511.0",
"@next/third-parties": "^14.2.3",
"@stomp/stompjs": "^7.0.0",
"@types/formidable": "^3.4.5",
"@types/sockjs-client": "^1.5.4",
Expand Down
4 changes: 0 additions & 4 deletions chatty-fe/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import './globals.css';
import './layout.css';
import { Suspense } from 'react';
import BgmComponent from './_components/BgmComponent/BgmComponent';
import { GoogleAnalytics } from '@next/third-parties/google';

const pretendard = localFont({
src: '../../public/fonts/PretendardVariable.ttf',
Expand Down Expand Up @@ -43,9 +42,6 @@ export default function RootLayout({
</Suspense>
</div>
</body>
{process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID ? (
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID} />
) : null}
</html>
);
}
Binary file modified docs/presentation.pdf
Binary file not shown.
Loading

0 comments on commit b70475e

Please sign in to comment.