diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index e0c91c4..4708120 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -75,15 +75,12 @@ jobs: env: DEV_ENV: ${{ secrets.DEV_ENV }} - - - name: Remove old Docker image - run: docker rmi -f $(docker images -aq) || true - - name: Docker run run: | - docker pull ${{ env.DOCKER_IMAGE }}:latest docker stop ${{ env.NAME }} || true docker rm ${{ env.NAME }} || true + docker rmi -f $(docker images -aq) || true + docker pull ${{ env.DOCKER_IMAGE }}:latest docker run -d -p 80:80 --name ${{ env.NAME }} --restart always \ -e CHROMA_DB_IP_ADDRESS=${{ secrets.CHROMA_DB_IP_ADDRESS }} \ -e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \ diff --git a/app/database/chroma_db.py b/app/database/chroma_db.py index c8c1ec2..43d1f5f 100644 --- a/app/database/chroma_db.py +++ b/app/database/chroma_db.py @@ -50,7 +50,7 @@ async def add_db_data(schedule_data: AddScheduleDTO): schedules.add( documents=[schedule_data.data], ids=[str(schedule_data.schedule_id)], - metadatas=[{"datetime": schedule_data.schedule_datetime, "member": schedule_data.member_id, "category": schedule_data.category}] + metadatas=[{"datetime": schedule_data.schedule_datetime, "member": schedule_data.member_id, "category": schedule_data.category, "location": schedule_data.location, "person": schedule_data.person}] ) return True diff --git a/app/dto/db_dto.py b/app/dto/db_dto.py index 5cade05..b931999 100644 --- a/app/dto/db_dto.py +++ b/app/dto/db_dto.py @@ -7,4 +7,6 @@ class AddScheduleDTO(BaseModel): schedule_id: int member_id: int category: str + location: str + person: str diff --git a/app/routers/chat.py b/app/routers/chat.py index 1ac9d2d..1c0b882 100644 --- a/app/routers/chat.py +++ b/app/routers/chat.py @@ -121,9 +121,6 @@ async def get_langchain_rag(data: PromptRequest) -> ChatResponse: case3_template = openai_prompt.Template.case3_template prompt = PromptTemplate.from_template(case3_template) - # 여기서는 chat_model.predict가 비동기 함수인지, 동기 함수인지에 따라 처리가 달라질 수 있습니다. - # 만약 비동기 함수라면 await를 사용해야 합니다. 아래 코드는 동기 함수를 가정하고 작성되었습니다. - # 비동기 함수라면, 예: response = await chat_model.predict(...) 형태로 수정해야 합니다. response = chat_model.predict(prompt.format(output_language="Korean", question=question, schedule=schedule)) print(response) return ChatResponse(ness=response) diff --git a/app/routers/chromadb.py b/app/routers/chromadb.py index 92f6b52..99ce84a 100644 --- a/app/routers/chromadb.py +++ b/app/routers/chromadb.py @@ -2,7 +2,7 @@ import os from dotenv import load_dotenv -from fastapi import APIRouter, HTTPException, Depends +from fastapi import APIRouter, HTTPException, Depends, status from app.dto.db_dto import AddScheduleDTO from app.database.chroma_db import add_db_data, get_chroma_client @@ -22,7 +22,7 @@ config.read(CONFIG_FILE_PATH) -@router.post("/add_schedule") +@router.post("/add_schedule", status_code=status.HTTP_201_CREATED) async def add_schedule_endpoint(schedule_data: AddScheduleDTO, chroma_client=Depends(get_chroma_client)): try: # 직접 `add_db_data` 함수를 비동기적으로 호출합니다.