|
| 1 | +"""Shared onboarding messaging primitives used across channels.""" |
| 2 | +from __future__ import annotations |
| 3 | + |
| 4 | +from typing import Dict, List, Optional |
| 5 | + |
| 6 | +# Structured capability sections pulled from design docs so UI and LLM share copy |
| 7 | +CAPABILITY_SECTIONS: List[Dict[str, List[str]]] = [ |
| 8 | + { |
| 9 | + "title": "Explore Our Projects", |
| 10 | + "examples": [ |
| 11 | + "Show me our most active repositories.", |
| 12 | + "Give me an overview of the 'Devr.AI-backend' repo.", |
| 13 | + ], |
| 14 | + }, |
| 15 | + { |
| 16 | + "title": "Find Ways to Contribute", |
| 17 | + "examples": [ |
| 18 | + "Are there any 'good first issues' available?", |
| 19 | + "Find issues with the 'bug' label.", |
| 20 | + ], |
| 21 | + }, |
| 22 | + { |
| 23 | + "title": "Answer Project Questions", |
| 24 | + "examples": [ |
| 25 | + "How do I set up the local development environment?", |
| 26 | + "What's the process for submitting a pull request?", |
| 27 | + ], |
| 28 | + }, |
| 29 | +] |
| 30 | + |
| 31 | +CAPABILITIES_INTRO_TEXT = ( |
| 32 | + "You're all set! As the Devr.AI assistant, my main purpose is to help you " |
| 33 | + "navigate and contribute to our projects. Here's a look at what you can ask " |
| 34 | + "me to do." |
| 35 | +) |
| 36 | +CAPABILITIES_OUTRO_TEXT = "Feel free to ask me anything related to the project. What's on your mind?" |
| 37 | + |
| 38 | + |
| 39 | +def render_capabilities_text() -> str: |
| 40 | + """Render the capabilities message as plain text for chat responses.""" |
| 41 | + lines: List[str] = [CAPABILITIES_INTRO_TEXT, ""] |
| 42 | + for section in CAPABILITY_SECTIONS: |
| 43 | + lines.append(f"{section['title']}:") |
| 44 | + for example in section["examples"]: |
| 45 | + lines.append(f"- \"{example}\"") |
| 46 | + lines.append("") |
| 47 | + lines.append(CAPABILITIES_OUTRO_TEXT) |
| 48 | + return "\n".join(lines).strip() |
| 49 | + |
| 50 | + |
| 51 | +def build_new_user_welcome() -> str: |
| 52 | + """Welcome copy when verification is still pending.""" |
| 53 | + return ( |
| 54 | + "👋 Welcome to the Devr.AI community! I'm here to help you get started on your contributor journey.\n\n" |
| 55 | + "To give you the best recommendations for repositories and issues, I first need to link your GitHub account. " |
| 56 | + "This one-time step helps me align tasks with your profile.\n\n" |
| 57 | + "Here's how to verify:\n" |
| 58 | + "- Run `/verify_github` to start verification right away.\n" |
| 59 | + "- Use `/verification_status` to see if you're already linked.\n" |
| 60 | + "- Use `/help` anytime to explore everything I can assist with.\n\n" |
| 61 | + "Would you like to verify your GitHub account now or skip this step for now? You can always do it later." |
| 62 | + ) |
| 63 | + |
| 64 | + |
| 65 | +def build_verified_welcome(github_username: Optional[str] = None) -> str: |
| 66 | + """Welcome copy for returning verified contributors.""" |
| 67 | + greeting = "👋 Welcome back to the Devr.AI community!" |
| 68 | + if github_username: |
| 69 | + greeting += f" I see `{github_username}` is already linked, which is great." |
| 70 | + else: |
| 71 | + greeting += " I see your GitHub account is already verified, which is great." |
| 72 | + return ( |
| 73 | + f"{greeting}\n\nHow can I help you get started today? Ask me for repository overviews, issues to work on, or project guidance whenever you're ready." |
| 74 | + ) |
| 75 | + |
| 76 | + |
| 77 | +def build_encourage_verification_message(reminder_count: int = 0) -> str: |
| 78 | + """Reminder copy for users who haven't verified yet but want to explore.""" |
| 79 | + reminder_prefix = "Quick reminder" if reminder_count else "No worries" |
| 80 | + return ( |
| 81 | + f"{reminder_prefix} — linking your GitHub unlocks personalized suggestions. " |
| 82 | + "Run `/verify_github` when you're ready, and `/verification_status` to check progress.\n\n" |
| 83 | + "While you set that up, I can still show you what's happening across the organization. " |
| 84 | + "Ask for repository highlights, open issues, or anything else you're curious about." |
| 85 | + ) |
| 86 | + |
| 87 | + |
| 88 | +def build_verified_capabilities_intro(github_username: Optional[str] = None) -> str: |
| 89 | + """Intro text shown right before the capability menu for verified users.""" |
| 90 | + if github_username: |
| 91 | + return ( |
| 92 | + f"Awesome — `{github_username}` is linked! You're all set to explore. " |
| 93 | + "Here's a quick menu of what I can help you with right away." |
| 94 | + ) |
| 95 | + return ( |
| 96 | + "Great! Your GitHub account is connected and I'm ready to tailor suggestions. " |
| 97 | + "Here are the top things I can help with." |
| 98 | + ) |
0 commit comments