Commit ·
9433f90
1
Parent(s): 8a68cf3
added new prompt
Browse files- Dockerfile +2 -1
- app.py +18 -4
Dockerfile
CHANGED
|
@@ -10,6 +10,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 10 |
|
| 11 |
# Copy application files
|
| 12 |
COPY app.py .
|
|
|
|
| 13 |
|
| 14 |
# Create chainlit config directory to avoid ContextVar issues
|
| 15 |
RUN mkdir -p /app/.chainlit
|
|
@@ -18,4 +19,4 @@ RUN mkdir -p /app/.chainlit
|
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
# Run Chainlit application
|
| 21 |
-
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"
|
|
|
|
| 10 |
|
| 11 |
# Copy application files
|
| 12 |
COPY app.py .
|
| 13 |
+
COPY prompt.md .
|
| 14 |
|
| 15 |
# Create chainlit config directory to avoid ContextVar issues
|
| 16 |
RUN mkdir -p /app/.chainlit
|
|
|
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
# Run Chainlit application
|
| 22 |
+
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
|
app.py
CHANGED
|
@@ -14,7 +14,21 @@ ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY")
|
|
| 14 |
if not ANTHROPIC_API_KEY:
|
| 15 |
print("WARNING: ANTHROPIC_API_KEY not found in environment variables!")
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Initialize chain components (outside of handlers to avoid ContextVar issues)
|
|
|
|
| 18 |
|
| 19 |
|
| 20 |
def get_chain():
|
|
@@ -29,9 +43,9 @@ def get_chain():
|
|
| 29 |
temperature=0.7
|
| 30 |
)
|
| 31 |
|
| 32 |
-
# Create the prompt template with system message
|
| 33 |
prompt = ChatPromptTemplate.from_messages([
|
| 34 |
-
("system",
|
| 35 |
("human", "{input}")
|
| 36 |
])
|
| 37 |
|
|
@@ -60,9 +74,9 @@ async def on_chat_start():
|
|
| 60 |
# Store the chain in user session
|
| 61 |
cl.user_session.set("chain", chain)
|
| 62 |
|
| 63 |
-
# Send welcome message
|
| 64 |
await cl.Message(
|
| 65 |
-
content="
|
| 66 |
).send()
|
| 67 |
|
| 68 |
|
|
|
|
| 14 |
if not ANTHROPIC_API_KEY:
|
| 15 |
print("WARNING: ANTHROPIC_API_KEY not found in environment variables!")
|
| 16 |
|
| 17 |
+
# Load the system prompt from prompt.md
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def load_system_prompt():
|
| 21 |
+
"""Load the system prompt from prompt.md file."""
|
| 22 |
+
try:
|
| 23 |
+
with open("prompt.md", "r", encoding="utf-8") as f:
|
| 24 |
+
return f.read()
|
| 25 |
+
except FileNotFoundError:
|
| 26 |
+
print("WARNING: prompt.md not found. Using fallback prompt.")
|
| 27 |
+
return "You are an Adaptive Coach guiding a small team through the Design Thinking process."
|
| 28 |
+
|
| 29 |
+
|
| 30 |
# Initialize chain components (outside of handlers to avoid ContextVar issues)
|
| 31 |
+
SYSTEM_PROMPT = load_system_prompt()
|
| 32 |
|
| 33 |
|
| 34 |
def get_chain():
|
|
|
|
| 43 |
temperature=0.7
|
| 44 |
)
|
| 45 |
|
| 46 |
+
# Create the prompt template with system message from prompt.md
|
| 47 |
prompt = ChatPromptTemplate.from_messages([
|
| 48 |
+
("system", SYSTEM_PROMPT),
|
| 49 |
("human", "{input}")
|
| 50 |
])
|
| 51 |
|
|
|
|
| 74 |
# Store the chain in user session
|
| 75 |
cl.user_session.set("chain", chain)
|
| 76 |
|
| 77 |
+
# Send welcome message - according to prompt section 1.6, ask ONE question: "What are you working on?"
|
| 78 |
await cl.Message(
|
| 79 |
+
content="What are you working on?"
|
| 80 |
).send()
|
| 81 |
|
| 82 |
|