This commit is contained in:
2026-02-16 19:08:19 -06:00
4 changed files with 42 additions and 1 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

BIN
bot/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -286,9 +286,44 @@ async def handle_knowledge(message, session, parsed):
except Exception as e:
await message.channel.send(f"❌ Error processing query: {e}")
elif action == "dbt_evaluate_advice":
advice = parsed.get("advice", "")
if not advice:
await message.channel.send("Please provide the advice you want to evaluate.")
return
await message.channel.send("Processing your request for DBT advice evaluation. This may take a minute...")
system_prompt = """You are an expert in Dialectical Behavior Therapy (DBT).
Your task is to evaluate the provided advice against DBT principles.
Focus on whether the advice aligns with DBT skills, such as mindfulness, distress tolerance, emotion regulation, and interpersonal effectiveness.
Provide a clear "cleared" or "not cleared" judgment, followed by a brief explanation of why, referencing specific DBT principles where applicable.
Example of good advice evaluation:
CLEARED: This advice encourages mindfulness by suggesting to observe thoughts without judgment, which is a core DBT skill.
Example of bad advice evaluation:
NOT CLEARED: This advice promotes suppressing emotions, which is contrary to DBT's emphasis on emotion regulation through healthy expression and understanding.
Evaluate the following advice:
"""
try:
response = client.chat.completions.create(
model=CHAT_MODEL,
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": advice},
],
temperature=0.2, # Slightly higher temperature for more varied explanations, but still grounded
)
evaluation = response.choices[0].message.content
await message.channel.send(f"**DBT Advice Jury Says:**\n{evaluation}")
except Exception as e:
await message.channel.send(f"❌ Error evaluating advice: {e}")
else:
await message.channel.send(
f"Unknown knowledge action: {action}. Try: list, select, or ask a question."
f"Unknown knowledge action: {action}. Try: list, select, query, or dbt_evaluate_advice."
)
@@ -305,6 +340,11 @@ def validate_knowledge_json(data):
if "action" not in data:
errors.append("Missing required field: action")
action = data.get("action")
if action == "dbt_evaluate_advice" and "advice" not in data:
errors.append("Missing required field for dbt_evaluate_advice: advice")
return errors

File diff suppressed because one or more lines are too long