Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -94,14 +94,11 @@ async def generate_response(message):
|
|
94 |
logging.debug(f'Full model response sent: {full_response_text}')
|
95 |
conversation_history.append({"role": "assistant", "content": full_response_text})
|
96 |
|
97 |
-
|
98 |
def search_in_dataset(query, dataset):
|
99 |
-
# 사용자의 쿼리와 관련된 모든 필드를 검색하고 상세 정보를 반환합니다.
|
100 |
response = []
|
101 |
for record in dataset['train']:
|
102 |
-
# 사건명
|
103 |
-
if query in record['사건명']:
|
104 |
-
# 정보가 발견되면, 모든 필드의 상세한 정보를 포맷팅하여 response 리스트에 추가합니다.
|
105 |
detail = (
|
106 |
f"판례정보일련번호: {record['판례정보일련번호']}\n"
|
107 |
f"사건명: {record['사건명']}\n"
|
@@ -118,8 +115,10 @@ def search_in_dataset(query, dataset):
|
|
118 |
f"전문: {record['전문']}\n"
|
119 |
)
|
120 |
response.append(detail)
|
121 |
-
|
122 |
-
|
|
|
|
|
123 |
return "\n".join(response) if response else "관련 법률 정보를 찾을 수 없습니다."
|
124 |
|
125 |
|
|
|
94 |
logging.debug(f'Full model response sent: {full_response_text}')
|
95 |
conversation_history.append({"role": "assistant", "content": full_response_text})
|
96 |
|
|
|
97 |
def search_in_dataset(query, dataset):
|
|
|
98 |
response = []
|
99 |
for record in dataset['train']:
|
100 |
+
# '사건명' 필드가 None이 아니고, 쿼리가 '사건명' 필드 내에 포함되어 있는 경우만 처리
|
101 |
+
if record['사건명'] and query in record['사건명']:
|
|
|
102 |
detail = (
|
103 |
f"판례정보일련번호: {record['판례정보일련번호']}\n"
|
104 |
f"사건명: {record['사건명']}\n"
|
|
|
115 |
f"전문: {record['전문']}\n"
|
116 |
)
|
117 |
response.append(detail)
|
118 |
+
elif not record['사건명']:
|
119 |
+
# '사건명' 필드가 None인 경우 로깅
|
120 |
+
logging.debug(f"Skipped a record with None in '사건명': {record}")
|
121 |
+
|
122 |
return "\n".join(response) if response else "관련 법률 정보를 찾을 수 없습니다."
|
123 |
|
124 |
|