-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
163 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from pathlib import Path | ||
from typing import Dict | ||
|
||
|
||
class PromptLoader: | ||
def __init__(self, prompt_dir: str = "prompts"): | ||
self.prompt_dir = Path(__file__).parent / prompt_dir | ||
|
||
def load_prompts(self) -> Dict[str, str]: | ||
prompts = {} | ||
for txt_file in self.prompt_dir.glob("*.txt"): | ||
key = txt_file.stem # use the filename without extension as the key | ||
with open(txt_file, "r", encoding="utf-8") as f: | ||
prompts[key] = f.read().strip() | ||
return prompts | ||
|
||
def get_prompt(self, name: str) -> str: | ||
prompts = self.load_prompts() | ||
return prompts.get(name, "") |
17 changes: 17 additions & 0 deletions
17
server/intelligence-service/app/mentor/prompts/mentor_persona.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
You are a friendly, approachable AI mentor focused on helping a student with their software engineering project. Your goal is to provide constructive guidance, support, and encouragement. Follow these rules and guidelines: | ||
|
||
- **Stay On-Topic**: Only answer questions related to the student’s software engineering project. Avoid unrelated topics and general advice that does not support their specific work. | ||
|
||
- **Focus on Guidance**: Offer actionable suggestions. If the student’s explanation is unclear, ask clarifying questions. Help them break down complex issues into manageable steps, and encourage them to think critically about their problem-solving approach. | ||
|
||
- **Tone**: Maintain a friendly, supportive, and empathetic demeanor. Keep the conversation casual and encouraging, rather than formal or distant. Show understanding and reassure them when they face challenges. | ||
|
||
- **Personality**: Be positive and motivating. Praise the student’s progress and offer constructive feedback when needed. Support them in reflecting on their decisions and thought processes to improve their project outcomes. | ||
|
||
- **Empathy and Accountability**: Acknowledge any difficulties and provide practical strategies to overcome obstacles. Encourage the student to take responsibility for their learning and project development, while remaining patient and understanding. | ||
|
||
- **Context for the Conversation**: | ||
- If the student is stuck, ask questions to pinpoint their confusion and then suggest targeted steps to move forward. | ||
- If the student is making good progress, recognize their achievements and continue to motivate them. | ||
|
||
**Remember**: Your primary objective is to help the student succeed in their software engineering project. Do not deviate from this focus. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,48 @@ | ||
<div class="flex flex-col gap-4"> | ||
@for (message of messages(); track message.id) { | ||
<div class="flex w-full" [ngClass]="{ 'justify-end': message.sender === Message.SenderEnum.User, 'justify-start': message.sender === Message.SenderEnum.Mentor }"> | ||
<div class="flex space-x-2 md:w-3/5" [ngClass]="{ 'flex-row-reverse': message.sender === Message.SenderEnum.User }"> | ||
@if (message.sender === Message.SenderEnum.Mentor) { | ||
<div class="mr-2 flex flex-col"> | ||
<div class="w-10 h-10 bg-transparent border-2 border-cyan-500 rounded-full flex items-center justify-center"> | ||
<lucide-angular [img]="BotMessageSquare" class="size-6 text-cyan-500" /> | ||
@if (isLoading()) { | ||
@for (i of [1, 2, 3, 4]; track i) { | ||
<div class="flex w-full" [ngClass]="{ 'justify-end': i % 2 === 0 }"> | ||
@if (i % 2 === 0) { | ||
<div> | ||
<hlm-skeleton class="rounded-lg inline-block w-64 h-12" /> | ||
<div class="flex justify-end"> | ||
<hlm-skeleton class="h-4 w-32 justify-end" /> | ||
</div> | ||
</div> | ||
} @else { | ||
<hlm-skeleton class="w-10 h-10 rounded-full" /> | ||
<div class="ml-3"> | ||
<hlm-skeleton class="rounded-lg inline-block w-64 h-12" /> | ||
<hlm-skeleton class="h-4 w-32" /> | ||
</div> | ||
} | ||
<div class="flex flex-col space-y-2" [ngClass]="{ 'items-end': message.sender === Message.SenderEnum.User, 'items-start': message.sender === Message.SenderEnum.Mentor }"> | ||
<div | ||
[ngClass]="{ | ||
'bg-cyan-500 dark:bg-cyan-600 text-white': message.sender === Message.SenderEnum.User, | ||
'bg-muted text-primary': message.sender === Message.SenderEnum.Mentor | ||
}" | ||
class="p-3 px-4 rounded-lg inline-block w-fit" | ||
> | ||
<p>{{ message.content }}</p> | ||
</div> | ||
} | ||
} @else { | ||
@for (message of messages(); track message.id) { | ||
<div class="flex w-full" [ngClass]="{ 'justify-end': message.sender === Message.SenderEnum.User, 'justify-start': message.sender === Message.SenderEnum.Mentor }"> | ||
<div class="flex space-x-2 md:w-3/5" [ngClass]="{ 'flex-row-reverse': message.sender === Message.SenderEnum.User }"> | ||
@if (message.sender === Message.SenderEnum.Mentor) { | ||
<div class="mr-2 flex flex-col"> | ||
<div class="w-10 h-10 bg-transparent border-2 border-cyan-500 rounded-full flex items-center justify-center"> | ||
<lucide-angular [img]="BotMessageSquare" class="size-6 text-cyan-500" /> | ||
</div> | ||
</div> | ||
} | ||
<div class="flex flex-col space-y-2" [ngClass]="{ 'items-end': message.sender === Message.SenderEnum.User, 'items-start': message.sender === Message.SenderEnum.Mentor }"> | ||
<div | ||
[ngClass]="{ | ||
'bg-cyan-500 dark:bg-cyan-600 text-white': message.sender === Message.SenderEnum.User, | ||
'bg-muted text-primary': message.sender === Message.SenderEnum.Mentor | ||
}" | ||
class="p-3 px-4 rounded-lg inline-block w-fit" | ||
> | ||
<p>{{ message.content }}</p> | ||
</div> | ||
<span class="text-xs text-muted-foreground"> {{ message.sender === Message.SenderEnum.User ? 'You' : 'AI Mentor' }} · {{ message.sentAt | date: 'shortTime' }} </span> | ||
</div> | ||
<span class="text-xs text-muted-foreground"> {{ message.sender === Message.SenderEnum.User ? 'You' : 'AI Mentor' }} · {{ message.sentAt | date: 'shortTime' }} </span> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters