seawolf2357 commited on
Commit
01dd380
1 Parent(s): 535a9f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -71,7 +71,11 @@ async def generate_response(message):
71
  def search_in_dataset(query, dataset):
72
  response = []
73
  for record in dataset['train']:
74
- if query in record['사건명']: # 부분 일치 검사
 
 
 
 
75
  detail = (
76
  f"판례정보일련번호: {record['판례정보일련번호']}\n"
77
  f"사건명: {record['사건명']}\n"
@@ -90,6 +94,7 @@ def search_in_dataset(query, dataset):
90
  response.append(detail)
91
  return "\n".join(response) if response else "관련 법률 정보를 찾을 수 없습니다."
92
 
 
93
  if __name__ == "__main__":
94
  discord_client = MyClient(intents=intents)
95
  discord_client.run(os.getenv('DISCORD_TOKEN'))
 
71
  def search_in_dataset(query, dataset):
72
  response = []
73
  for record in dataset['train']:
74
+ if record['사건명'] and query in record['사건명']:
75
+ # 사건명으로 검색 시 사건번호만 반환
76
+ response.append(f"사건번호: {record['사건번호']}")
77
+ elif record['사건번호'] == query:
78
+ # 사건번호로 검색 시 전체 내용 반환
79
  detail = (
80
  f"판례정보일련번호: {record['판례정보일련번호']}\n"
81
  f"사건명: {record['사건명']}\n"
 
94
  response.append(detail)
95
  return "\n".join(response) if response else "관련 법률 정보를 찾을 수 없습니다."
96
 
97
+
98
  if __name__ == "__main__":
99
  discord_client = MyClient(intents=intents)
100
  discord_client.run(os.getenv('DISCORD_TOKEN'))