Update app.py
Browse files
app.py
CHANGED
@@ -68,9 +68,9 @@ def respond(message: str, history: List[Dict[str, str]], system_message: str = "
|
|
68 |
prompt=prompt,
|
69 |
max_new_tokens=max_tokens,
|
70 |
stream=True,
|
71 |
-
temperature=temperature,
|
72 |
top_p=top_p,
|
73 |
-
repetition_penalty=1.2
|
74 |
)
|
75 |
|
76 |
for msg in stream:
|
@@ -354,9 +354,9 @@ with gr.Blocks(css=css) as demo:
|
|
354 |
def handle_message_data_upload(message: str, history: List[Dict[str, str]], system_message: str, max_tokens: int, temperature: float, top_p: float, parquet_data: str):
|
355 |
history = history or []
|
356 |
|
357 |
-
|
358 |
recent_questions = [chat['content'].strip().lower() for chat in history[-3:] if chat['role'] == 'user']
|
359 |
-
|
360 |
yield history + [{"role": "assistant", "content": "동일한 질문이 최근에 있었습니다. 다른 질문을 해주세요."}], ""
|
361 |
return
|
362 |
|
@@ -384,7 +384,7 @@ with gr.Blocks(css=css) as demo:
|
|
384 |
history.append({"role": "assistant", "content": response})
|
385 |
yield history, ""
|
386 |
|
387 |
-
|
388 |
|
389 |
|
390 |
send_data_upload.click(
|
|
|
68 |
prompt=prompt,
|
69 |
max_new_tokens=max_tokens,
|
70 |
stream=True,
|
71 |
+
temperature=temperature,
|
72 |
top_p=top_p,
|
73 |
+
repetition_penalty=1.2
|
74 |
)
|
75 |
|
76 |
for msg in stream:
|
|
|
354 |
def handle_message_data_upload(message: str, history: List[Dict[str, str]], system_message: str, max_tokens: int, temperature: float, top_p: float, parquet_data: str):
|
355 |
history = history or []
|
356 |
|
357 |
+
# 중복 질문 검사
|
358 |
recent_questions = [chat['content'].strip().lower() for chat in history[-3:] if chat['role'] == 'user']
|
359 |
+
if message.strip().lower() in recent_questions:
|
360 |
yield history + [{"role": "assistant", "content": "동일한 질문이 최근에 있었습니다. 다른 질문을 해주세요."}], ""
|
361 |
return
|
362 |
|
|
|
384 |
history.append({"role": "assistant", "content": response})
|
385 |
yield history, ""
|
386 |
|
387 |
+
|
388 |
|
389 |
|
390 |
send_data_upload.click(
|