diff --git a/Dockerfile b/Dockerfile index 266f125..5ec7d65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11.1 +FROM python:3.11 WORKDIR /code COPY ./requirements.txt /code/requirements.txt diff --git a/app/api/v1/endpoints/stt.py b/app/api/v1/endpoints/stt.py index 9a06ead..c04f7a5 100644 --- a/app/api/v1/endpoints/stt.py +++ b/app/api/v1/endpoints/stt.py @@ -20,7 +20,7 @@ def get_speech_to_text( ) -> SpeechText: prefix = '.'.join(audio.key.split('.')[:-1]) - s3_controller.download_file(S3_BUCKET_NAME, AUDIO_S3_PREFIX + audio.key, f'stt/static/{audio.key}') + s3_controller.download_file(S3_BUCKET_NAME, AUDIO_S3_PREFIX + audio.key, f'app/static/{audio.key}') stt_controller.convert_to_wav(prefix) stt_controller.speech_to_text(prefix) diff --git a/app/controller/keywords.py b/app/controller/keywords.py index 2b8bb69..92480a3 100644 --- a/app/controller/keywords.py +++ b/app/controller/keywords.py @@ -12,4 +12,4 @@ def __init__(self, llm: LLMController = Depends(LLMController)): def get_keywords(self, document: Document) -> Keywords: self.llm.set_document(document) answer = self.llm.request(self.prompt).content - return Keywords(keywords=list(map(lambda word: word.strip()[1:-1], list(answer[1:-1].split(','))))) \ No newline at end of file + return Keywords(keywords=list(map(lambda word: word.strip(), list(answer[1:-1].split(','))))) \ No newline at end of file diff --git a/app/controller/mindmap.py b/app/controller/mindmap.py index f6b1446..3ceea15 100644 --- a/app/controller/mindmap.py +++ b/app/controller/mindmap.py @@ -5,12 +5,12 @@ from app.schemas.mindmap import MindMap from app.schemas.context import Keywords -from bs4 import BeautifulSoup +import re from typing import List class MindMapController: - prompt = "Question: 문맥 내에서 %s들의 계층 구조를 html의 ': stack.pop(len(stack)-1) + lines = markdown.split('\n') + for line in lines: + sep = line.split('- ')[0] + word = line.split('- ')[-1] if word in keywords: - if len(stack) == 0: - stack.append(word) - mindmap.root = keyword2index[stack[0]] + sep = len(sep) + mindmap.graph[str(keyword2index[word])] = [] + print(stack) + + if sep == 0: + mindmap.root = sep + + if current == sep: + if len(stack) != 0: stack.pop() + if len(stack) != 0: mindmap.graph[str(stack[-1])].append(keyword2index[word]) + stack.append(keyword2index[word]) + elif current < sep: + mindmap.graph[str(stack[-1])].append(keyword2index[word]) + stack.append(keyword2index[word]) else: - if prettified_html[index-1] != '