Generalize from health-specific to universal personal assistant
The app manages multiple life areas (health, finance, personal, work), not just health. Updated all health-specific language throughout: Backend: - Default system prompt: general personal assistant (not health-only) - AI tool descriptions: generic (not health records/medications) - Memory categories: health, finance, personal, work, document_summary, other (replaces condition, medication, allergy, vital) - PDF template: "Prepared for" (not "Patient"), "Key Information" (not "Health Profile") - Renamed generate_health_pdf -> generate_pdf_report, health_report.html -> report.html - Renamed run_daily_health_review -> run_daily_review - Context assembly: "User Profile" (not "Health Profile") - OpenAPI: generic descriptions Frontend: - Dashboard subtitle: "Your personal AI assistant" - Memory categories: Health, Finance, Personal, Work - Document types: Report, Contract, Receipt, Certificate (not lab_result, etc.) - Updated en + ru translations throughout Documentation: - README: general personal assistant description - Removed health-only feature descriptions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""Daily job: proactive health review for all users with health data."""
|
||||
"""Daily job: proactive review for all users with stored data."""
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
@@ -17,8 +17,8 @@ logger = logging.getLogger(__name__)
|
||||
client = AsyncAnthropic(api_key=settings.ANTHROPIC_API_KEY)
|
||||
|
||||
|
||||
async def run_daily_health_review():
|
||||
"""Review each user's health profile and generate reminder notifications."""
|
||||
async def run_daily_review():
|
||||
"""Review each user's profile and generate reminder notifications."""
|
||||
if not settings.ANTHROPIC_API_KEY:
|
||||
return
|
||||
|
||||
@@ -31,7 +31,7 @@ async def run_daily_health_review():
|
||||
await _review_user(user)
|
||||
await asyncio.sleep(1) # Rate limit
|
||||
except Exception:
|
||||
logger.exception(f"Health review failed for user {user.id}")
|
||||
logger.exception(f"Daily review failed for user {user.id}")
|
||||
|
||||
|
||||
async def _review_user(user: User):
|
||||
@@ -45,13 +45,12 @@ async def _review_user(user: User):
|
||||
response = await client.messages.create(
|
||||
model=settings.CLAUDE_MODEL,
|
||||
max_tokens=500,
|
||||
system="You are a health assistant. Based on the user's health profile, suggest any upcoming checkups, medication reviews, or health actions that should be reminded. Respond with a JSON array of objects with 'title' and 'body' fields. If no reminders are needed, return an empty array [].",
|
||||
messages=[{"role": "user", "content": f"User health profile:\n{memory_text}"}],
|
||||
system="You are a personal assistant. Based on the user's stored information, suggest any upcoming actions, deadlines, follow-ups, or reminders that would be helpful. Respond with a JSON array of objects with 'title' and 'body' fields. If no reminders are needed, return an empty array [].",
|
||||
messages=[{"role": "user", "content": f"User profile data:\n{memory_text}"}],
|
||||
)
|
||||
|
||||
try:
|
||||
text = response.content[0].text.strip()
|
||||
# Extract JSON from response
|
||||
if "[" in text:
|
||||
json_str = text[text.index("["):text.rindex("]") + 1]
|
||||
reminders = json.loads(json_str)
|
||||
@@ -60,7 +59,7 @@ async def _review_user(user: User):
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
return
|
||||
|
||||
for reminder in reminders[:5]: # Max 5 reminders per user per day
|
||||
for reminder in reminders[:5]:
|
||||
if "title" in reminder and "body" in reminder:
|
||||
notif = await create_notification(
|
||||
db,
|
||||
|
||||
Reference in New Issue
Block a user