atolat30 commited on
Commit
e56bc79
·
1 Parent(s): 479bb53

Add default template for when no aspect is selected

Browse files
Files changed (2) hide show
  1. app.py +0 -6
  2. prompt_manager.py +21 -3
app.py CHANGED
@@ -168,12 +168,6 @@ async def main(message: cl.Message):
168
  # Get the selected aspect from the session
169
  selected_aspect = cl.user_session.get("selected_aspect")
170
 
171
- if not selected_aspect:
172
- await cl.Message(
173
- content="Please select an aspect first using the buttons above."
174
- ).send()
175
- return
176
-
177
  settings = {
178
  "model": "gpt-4-turbo-preview", # Upgraded to GPT-4 Turbo
179
  "temperature": 0.7, # Balanced between creativity and consistency
 
168
  # Get the selected aspect from the session
169
  selected_aspect = cl.user_session.get("selected_aspect")
170
 
 
 
 
 
 
 
171
  settings = {
172
  "model": "gpt-4-turbo-preview", # Upgraded to GPT-4 Turbo
173
  "temperature": 0.7, # Balanced between creativity and consistency
prompt_manager.py CHANGED
@@ -10,6 +10,21 @@ class AspectInfo:
10
 
11
  class PromptManager:
12
  def __init__(self):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  self.aspects = {
14
  "Concept Simplification": AspectInfo(
15
  description="Break down complex topics into simple, understandable terms",
@@ -109,7 +124,7 @@ Adapt your communication style to match the user's level of expertise.""",
109
 
110
  def get_aspect_info(self, aspect_name: str) -> AspectInfo:
111
  """Get information for a specific aspect."""
112
- return self.aspects[aspect_name]
113
 
114
  def get_action_description(self, aspect_name: str) -> str:
115
  """Get formatted description for action button."""
@@ -127,7 +142,10 @@ Adapt your communication style to match the user's level of expertise.""",
127
  Try asking something like:
128
  {examples}"""
129
 
130
- def get_templates(self, aspect_name: str) -> tuple[str, str]:
131
  """Get system and user templates for an aspect."""
132
- info = self.aspects[aspect_name]
 
 
 
133
  return info.system_template, info.user_template
 
10
 
11
  class PromptManager:
12
  def __init__(self):
13
+ # Default template for when no aspect is selected
14
+ self.default_aspect = AspectInfo(
15
+ description="General purpose AI assistant with balanced capabilities",
16
+ examples=[
17
+ "What can you help me with?",
18
+ "How do you work?",
19
+ "What are your capabilities?"
20
+ ],
21
+ system_template="""You are a helpful AI assistant with expertise in various domains.
22
+ Your goal is to provide clear, accurate, and helpful responses while maintaining a friendly tone.
23
+ Adapt your communication style based on the user's needs and the complexity of the topic.""",
24
+ user_template="""{input}
25
+ Think through your response step by step."""
26
+ )
27
+
28
  self.aspects = {
29
  "Concept Simplification": AspectInfo(
30
  description="Break down complex topics into simple, understandable terms",
 
124
 
125
  def get_aspect_info(self, aspect_name: str) -> AspectInfo:
126
  """Get information for a specific aspect."""
127
+ return self.aspects.get(aspect_name, self.default_aspect)
128
 
129
  def get_action_description(self, aspect_name: str) -> str:
130
  """Get formatted description for action button."""
 
142
  Try asking something like:
143
  {examples}"""
144
 
145
+ def get_templates(self, aspect_name: str | None) -> tuple[str, str]:
146
  """Get system and user templates for an aspect."""
147
+ if aspect_name is None:
148
+ info = self.default_aspect
149
+ else:
150
+ info = self.aspects.get(aspect_name, self.default_aspect)
151
  return info.system_template, info.user_template