Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -51,17 +51,18 @@ def respond(message, history, system_message, max_tokens, temperature, top_p, se
|
|
51 |
except Exception as e:
|
52 |
yield truncated_history + [(message, f"오류 발생: {str(e)}")]
|
53 |
|
54 |
-
def continue_writing(history, system_message, max_tokens, temperature, top_p,
|
55 |
if not history:
|
56 |
-
|
57 |
-
|
|
|
58 |
truncated_history = truncate_history(history)
|
59 |
-
last_user_message = truncated_history[-1][0]
|
60 |
last_assistant_message = truncated_history[-1][1]
|
61 |
|
62 |
prompt = f"이전 대화를 간단히 요약하고 이어서 작성해주세요. 마지막 응답: {last_assistant_message[:100]}..."
|
63 |
|
64 |
-
|
|
|
65 |
|
66 |
def stop_generation():
|
67 |
stop_event.set()
|
|
|
51 |
except Exception as e:
|
52 |
yield truncated_history + [(message, f"오류 발생: {str(e)}")]
|
53 |
|
54 |
+
def continue_writing(message, history, system_message, max_tokens, temperature, top_p, selected_model):
|
55 |
if not history:
|
56 |
+
yield [("시스템", "대화 내역이 없습니다.")]
|
57 |
+
return
|
58 |
+
|
59 |
truncated_history = truncate_history(history)
|
|
|
60 |
last_assistant_message = truncated_history[-1][1]
|
61 |
|
62 |
prompt = f"이전 대화를 간단히 요약하고 이어서 작성해주세요. 마지막 응답: {last_assistant_message[:100]}..."
|
63 |
|
64 |
+
async for response in respond(prompt, truncated_history[:-1], system_message, max_tokens, temperature, top_p, selected_model):
|
65 |
+
yield response
|
66 |
|
67 |
def stop_generation():
|
68 |
stop_event.set()
|