Skip to content

Commit

Permalink
Merge pull request #35 from studio-recoding/feat/cicd
Browse files Browse the repository at this point in the history
Feat/cicd
  • Loading branch information
uommou authored Mar 24, 2024
2 parents d45cd8d + fbb3740 commit 842fc01
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }} \
Expand Down
2 changes: 1 addition & 1 deletion app/database/chroma_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions app/dto/db_dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ class AddScheduleDTO(BaseModel):
schedule_id: int
member_id: int
category: str
location: str
person: str

3 changes: 0 additions & 3 deletions app/routers/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions app/routers/chromadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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` 함수를 비동기적으로 호출합니다.
Expand Down

0 comments on commit 842fc01

Please sign in to comment.