Skip to content

Commit 99b94f0

Browse files
committed
Fix markdown rendering in chatbot
1 parent 7110bf9 commit 99b94f0

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

components/chat-widget.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ export function ChatWidget() {
6767
handleSend(input);
6868
};
6969

70+
// Helper to parse **bold** text
71+
const renderMessage = (text: string) => {
72+
const parts = text.split(/(\*\*.*?\*\*)/g);
73+
return parts.map((part, index) => {
74+
if (part.startsWith("**") && part.endsWith("**")) {
75+
return <strong key={index} className="text-purple-300 font-bold">{part.slice(2, -2)}</strong>;
76+
}
77+
return part;
78+
});
79+
};
80+
7081
return (
7182
<>
7283
{/* Floating Toggle Button */}
@@ -159,7 +170,7 @@ export function ChatWidget() {
159170
: "bg-zinc-800/80 text-zinc-200 rounded-bl-none border border-zinc-700/50"
160171
}`}
161172
>
162-
<p className="whitespace-pre-wrap">{msg.text}</p>
173+
<p className="whitespace-pre-wrap">{renderMessage(msg.text)}</p>
163174
</div>
164175
</div>
165176
))}

lib/system-prompt.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,10 @@ CONTEXT:
6666
INSTRUCTIONS:
6767
- Format lists clearly using bullet points.
6868
- If asked about specific projects, highlight the key technologies used.
69+
- **UNKNOWN SKILLS STRATEGY**:
70+
- If asked about a skill NOT listed in the context (e.g., Go, R, React Native):
71+
- Do NOT just say "I don't know."
72+
- **Pivot to related skills**: (e.g., "While Devendra hasn't used React Native professionally, his deep expertise in React and System Architecture makes him capable of picking it up rapidly.")
73+
- **Highlight Learning Agility**: Emphasize that as a Master's graduate and System Architect, he is a "Quick Learner" who masters new tools as needed for the job.
74+
- Always end with a confident statement about his engineering foundation.
6975
`;

0 commit comments

Comments
 (0)