Skip to content

Commit

Permalink
Merge pull request #74 from studio-recoding/feat/chat-refactor
Browse files Browse the repository at this point in the history
fix: 채팅 필드에 metadata 추가하여 리팩토링
  • Loading branch information
uommou authored Jul 2, 2024
2 parents 3494859 + 1cab01f commit aff157c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/dto/openai_dto.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ChatResponse(BaseModel):
class ChatCaseResponse(BaseModel):
ness: str
case: int
metadata: str

class TagDescription(BaseModel):
tag: str
Expand Down
9 changes: 7 additions & 2 deletions app/routers/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,23 @@ async def get_langchain_case(data: PromptRequest) -> ChatCaseResponse:
case = int(case)
if case == 1:
response = await get_langchain_normal(data, chat_type_prompt)
metadata = "null"

elif case == 2:
response = await get_langchain_schedule(data, chat_type_prompt)
response_with_metadata = await get_langchain_schedule(data, chat_type_prompt)
response = response_with_metadata.split("<separate>")[0]
metadata = response_with_metadata.split("<separate>")[1]

elif case == 3:
response = await get_langchain_rag(data, chat_type_prompt)
metadata = "null"

else:
response = "좀 더 명확한 요구가 필요해요. 다시 한 번 얘기해주실 수 있나요?"
case = "Exception"
metadata = "null"

return ChatCaseResponse(ness=response, case=case)
return ChatCaseResponse(ness=response, case=case, metadata=metadata)


# case 1 : normal
Expand Down

0 comments on commit aff157c

Please sign in to comment.