vSiddi
commited on
Commit
·
fdd9d07
1
Parent(s):
eb669b4
fix issue
Browse files- modules/app_constants.py +1 -1
- modules/common_utils.py +3 -4
modules/app_constants.py
CHANGED
@@ -55,7 +55,7 @@ SYSTEM_CONTENT_DATA = "app-content.json"
|
|
55 |
SYSTEM_DEPLOYMENT_MODE = 0
|
56 |
ZYSEC_DEMO = "http://zysec.is-a-geek.com:8000/v1" #not enabled yet
|
57 |
ENCHANCE_PROMPT = (
|
58 |
-
"
|
59 |
"1. Expand on Key Points: Elaborate on the main ideas in the original answer. Provide more depth and detail to each point.\n"
|
60 |
"2. Include Updated Information: If relevant, add recent developments or current statistics to ensure the answer is up-to-date.\n"
|
61 |
"3. Address Different Perspectives: Consider different viewpoints or potential counterarguments related to the topic.\n"
|
|
|
55 |
SYSTEM_DEPLOYMENT_MODE = 0
|
56 |
ZYSEC_DEMO = "http://zysec.is-a-geek.com:8000/v1" #not enabled yet
|
57 |
ENCHANCE_PROMPT = (
|
58 |
+
"When you talk about CyberSecurity, ensure provided answer is comprehensive and insightful. Follow these steps:\n"
|
59 |
"1. Expand on Key Points: Elaborate on the main ideas in the original answer. Provide more depth and detail to each point.\n"
|
60 |
"2. Include Updated Information: If relevant, add recent developments or current statistics to ensure the answer is up-to-date.\n"
|
61 |
"3. Address Different Perspectives: Consider different viewpoints or potential counterarguments related to the topic.\n"
|
modules/common_utils.py
CHANGED
@@ -61,7 +61,7 @@ def construct_messages_to_send(page, message_store, prompt):
|
|
61 |
system_message_content = message_store.get_message(page, "system")
|
62 |
greeting_message_content = message_store.get_message(page, "greeting")
|
63 |
if system_message_content:
|
64 |
-
messages_to_send.append({"role": "system", "content": system_message_content})
|
65 |
if greeting_message_content:
|
66 |
messages_to_send.append({"role": "assistant", "content": greeting_message_content})
|
67 |
|
@@ -69,21 +69,20 @@ def construct_messages_to_send(page, message_store, prompt):
|
|
69 |
history_messages = message_store.get_history(page)
|
70 |
|
71 |
# Check if there are enough messages in the history, if not, adjust the slicing
|
72 |
-
num_messages_to_include =
|
73 |
if len(history_messages) < num_messages_to_include:
|
74 |
num_messages_to_include = len(history_messages)
|
75 |
|
76 |
recent_history = history_messages[-num_messages_to_include:]
|
77 |
for msg in recent_history:
|
78 |
messages_to_send.append({"role": msg["role"], "content": msg["content"]})
|
79 |
-
|
80 |
# Append the current user prompt
|
81 |
messages_to_send.append({"role": "user", "content": prompt})
|
82 |
|
83 |
return messages_to_send
|
84 |
|
85 |
|
86 |
-
|
87 |
def get_content_mapping_to_module(content_type):
|
88 |
content_type_lower = content_type.lower()
|
89 |
# Iterate through each page in PAGE_CONFIG
|
|
|
61 |
system_message_content = message_store.get_message(page, "system")
|
62 |
greeting_message_content = message_store.get_message(page, "greeting")
|
63 |
if system_message_content:
|
64 |
+
messages_to_send.append({"role": "system", "content": system_message_content +'\n\n'+app_constants.ENCHANCE_PROMPT})
|
65 |
if greeting_message_content:
|
66 |
messages_to_send.append({"role": "assistant", "content": greeting_message_content})
|
67 |
|
|
|
69 |
history_messages = message_store.get_history(page)
|
70 |
|
71 |
# Check if there are enough messages in the history, if not, adjust the slicing
|
72 |
+
num_messages_to_include = 5 # Include last two pairs (user and assistant)
|
73 |
if len(history_messages) < num_messages_to_include:
|
74 |
num_messages_to_include = len(history_messages)
|
75 |
|
76 |
recent_history = history_messages[-num_messages_to_include:]
|
77 |
for msg in recent_history:
|
78 |
messages_to_send.append({"role": msg["role"], "content": msg["content"]})
|
79 |
+
#print(messages_to_send)
|
80 |
# Append the current user prompt
|
81 |
messages_to_send.append({"role": "user", "content": prompt})
|
82 |
|
83 |
return messages_to_send
|
84 |
|
85 |
|
|
|
86 |
def get_content_mapping_to_module(content_type):
|
87 |
content_type_lower = content_type.lower()
|
88 |
# Iterate through each page in PAGE_CONFIG
|