|
6 | 6 | from config import config
|
7 | 7 | from modules.logs import get_logger, log_gui_general_message, log_gui_model_message
|
8 | 8 | from modules.servers.tf2 import send_say_command_to_tf2
|
9 |
| -from modules.typing import MessageHistory |
| 9 | +from modules.typing import MessageHistory, Message |
10 | 10 | from modules.utils.text import add_prompts_by_flags, remove_hashtags
|
11 | 11 |
|
12 | 12 | main_logger = get_logger("main")
|
@@ -64,6 +64,9 @@ def handle_cgpt_request(
|
64 | 64 | gui_logger.error(f"Request '{user_prompt}' violates OPENAI TOS. Skipping...")
|
65 | 65 | return conversation_history
|
66 | 66 |
|
| 67 | + if not conversation_history: |
| 68 | + conversation_history.append(Message(role="assistant", content=config.GREETING)) |
| 69 | + |
67 | 70 | conversation_history.append({"role": "user", "content": message})
|
68 | 71 |
|
69 | 72 | response = get_response(conversation_history, username, model)
|
@@ -94,7 +97,10 @@ def handle_gpt_request(
|
94 | 97 | )
|
95 | 98 | return
|
96 | 99 |
|
97 |
| - response = get_response([{"role": "user", "content": message}], username, model) |
| 100 | + response = get_response([ |
| 101 | + Message(role="assistant", content=config.GREETING), |
| 102 | + Message(role="user", content=message) |
| 103 | + ], username, model) |
98 | 104 |
|
99 | 105 | if response:
|
100 | 106 | main_logger.info(
|
|
0 commit comments