Customize myAI3 as BudgetBuddy personal finance assistant
- Configure identity, prompts, guardrails for personal finance domain - Add 6 knowledge sources to Pinecone RAG (budgeting, investing, credit, etc.) - Add password protection via Next.js middleware - Add Dockerfile for container deployment - Customize terms of use with financial disclaimers
This commit is contained in:
parent
1d22dc8b25
commit
c88d4ba1a8
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
node_modules/
|
||||
.env*
|
||||
!.env.example
|
||||
next-env.d.ts
|
||||
.next
|
||||
25
Dockerfile
Normal file
25
Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM oven/bun:1 AS base
|
||||
|
||||
FROM base AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=1001:1001 /app/.next/standalone ./
|
||||
COPY --from=builder --chown=1001:1001 /app/.next/static ./.next/static
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
CMD ["bun", "server.js"]
|
||||
@ -13,8 +13,8 @@ const geistMono = Geist_Mono({
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "MyAI3",
|
||||
description: "MyAI3",
|
||||
title: "BudgetBuddy",
|
||||
description: "Your AI-powered personal finance and budgeting assistant",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
|
||||
@ -13,11 +13,11 @@ export default function Terms() {
|
||||
<ArrowLeftIcon className="w-4 h-4" />
|
||||
Back to Chatbot
|
||||
</Link>
|
||||
<h1 className="text-3xl font-bold">MyAI3</h1>
|
||||
<h1 className="text-3xl font-bold">BudgetBuddy</h1>
|
||||
<h2 className="text-2xl font-semibold">Terms of Use / Disclaimer</h2>
|
||||
|
||||
<p className="text-gray-700">
|
||||
The following terms of use govern access to and use of the MyAI3
|
||||
The following terms of use govern access to and use of the BudgetBuddy
|
||||
Assistant ("AI Chatbot"), an artificial intelligence tool provided by
|
||||
{OWNER_NAME} ("I", "me", or "myself"). By engaging with the AI
|
||||
Chatbot, you agree to these terms. If you do not agree, you may not
|
||||
@ -29,10 +29,13 @@ export default function Terms() {
|
||||
<ol className="list-decimal list-inside space-y-3">
|
||||
<li className="text-gray-700">
|
||||
<span className="font-semibold">Provider and Purpose:</span> The
|
||||
AI Chatbot is a tool developed and maintained by {OWNER_NAME}. It
|
||||
is intended solely to assist users with questions and coursework
|
||||
related to courses taught by {OWNER_NAME}. The AI Chatbot is not
|
||||
affiliated with, endorsed by, or operated by the course provider.
|
||||
AI Chatbot is a personal finance and budgeting AI assistant developed
|
||||
and maintained by {OWNER_NAME}. It provides educational information
|
||||
and general guidance about budgeting, saving, investing, credit, and
|
||||
student loans. It is NOT a licensed financial advisor and does NOT
|
||||
provide professional financial, legal, or tax advice. It is intended
|
||||
solely to assist users with questions related to personal finance and
|
||||
budgeting. It was created by {OWNER_NAME}.
|
||||
</li>
|
||||
<li className="text-gray-700">
|
||||
<span className="font-semibold">Third-Party Involvement:</span>{" "}
|
||||
@ -50,6 +53,14 @@ export default function Terms() {
|
||||
information. Users are strongly encouraged to independently verify
|
||||
any information before relying on it for decisions or actions.
|
||||
</li>
|
||||
<li className="text-gray-700">
|
||||
<span className="font-semibold">Not Professional Financial Advice:</span>{" "}
|
||||
The AI Chatbot does not provide professional financial, legal, medical,
|
||||
or tax advice. All information is for educational and informational
|
||||
purposes only. Users should consult qualified professionals before
|
||||
making financial decisions. The AI Chatbot is not a substitute for a
|
||||
licensed financial advisor, accountant, or attorney.
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
@ -199,7 +210,7 @@ export default function Terms() {
|
||||
</div>
|
||||
|
||||
<div className="mt-8 text-sm text-gray-600">
|
||||
<p>Last Updated: November 17, 2025</p>
|
||||
<p>Last Updated: February 11, 2026</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -30,10 +30,10 @@ function getDateAndTime(): string {
|
||||
|
||||
export const DATE_AND_TIME = getDateAndTime();
|
||||
|
||||
export const AI_NAME = "MyAI3";
|
||||
export const OWNER_NAME = "FirstName LastName";
|
||||
export const AI_NAME = "BudgetBuddy";
|
||||
export const OWNER_NAME = "Joey";
|
||||
|
||||
export const WELCOME_MESSAGE = `Hello! I'm ${AI_NAME}, an AI assistant created by ${OWNER_NAME}.`
|
||||
export const WELCOME_MESSAGE = `Hello! I'm ${AI_NAME}, your personal finance and budgeting AI assistant. Whether you need help creating a budget, understanding investing basics, managing student loans, or building credit — I'm here to help! How can I assist you today?`
|
||||
|
||||
export const CLEAR_CHAT_TEXT = "New";
|
||||
|
||||
|
||||
27
middleware.ts
Normal file
27
middleware.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
const authHeader = request.headers.get("authorization");
|
||||
|
||||
if (authHeader) {
|
||||
const [scheme, encoded] = authHeader.split(" ");
|
||||
if (scheme === "Basic" && encoded) {
|
||||
const decoded = atob(encoded);
|
||||
const [, password] = decoded.split(":");
|
||||
if (password === process.env.AUTH_PASSWORD) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new NextResponse("Authentication required", {
|
||||
status: 401,
|
||||
headers: {
|
||||
"WWW-Authenticate": 'Basic realm="BudgetBuddy"',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
|
||||
};
|
||||
@ -1,7 +1,7 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
output: "standalone",
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
12904
package-lock.json
generated
12904
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
prompts.ts
35
prompts.ts
@ -2,21 +2,32 @@ import { DATE_AND_TIME, OWNER_NAME } from './config';
|
||||
import { AI_NAME } from './config';
|
||||
|
||||
export const IDENTITY_PROMPT = `
|
||||
You are ${AI_NAME}, an agentic assistant. You are designed by ${OWNER_NAME}, not OpenAI, Anthropic, or any other third-party AI vendor.
|
||||
You are ${AI_NAME}, a personal finance and budgeting AI assistant. You were created by ${OWNER_NAME}. You specialize in helping college students and young professionals with practical money management, budgeting, saving strategies, investing basics, credit building, and student loan management. You are NOT a licensed financial advisor — you provide educational information and general guidance only.
|
||||
`;
|
||||
|
||||
export const TOOL_CALLING_PROMPT = `
|
||||
- In order to be as truthful as possible, call tools to gather context before answering.
|
||||
- Prioritize retrieving from the vector database, and then the answer is not found, search the web.
|
||||
- Always call tools to gather context before answering financial questions.
|
||||
- Prioritize searching the vector database first for personal finance knowledge and guidance.
|
||||
- If the answer is not found in the vector database, search the web for current financial information, interest rates, or news.
|
||||
- When asked about specific current rates (savings rates, loan rates, market data), always use web search to get the latest information.
|
||||
`;
|
||||
|
||||
export const TONE_STYLE_PROMPT = `
|
||||
- Maintain a friendly, approachable, and helpful tone at all times.
|
||||
- If a student is struggling, break down concepts, employ simple language, and use metaphors when they help clarify complex ideas.
|
||||
- Be friendly, encouraging, and non-judgmental — many people feel anxious about money and finances.
|
||||
- Use simple, clear language and avoid unnecessary financial jargon.
|
||||
- When using financial terms, briefly explain them in parentheses.
|
||||
- Use practical examples with realistic dollar amounts that college students and young professionals can relate to.
|
||||
- Break down complex financial concepts into digestible steps.
|
||||
- Celebrate small wins — even saving $25/month is progress worth acknowledging.
|
||||
`;
|
||||
|
||||
export const GUARDRAILS_PROMPT = `
|
||||
- Strictly refuse and end engagement if a request involves dangerous, illegal, shady, or inappropriate activities.
|
||||
- Never provide specific investment recommendations or stock picks. Instead, explain general investment principles.
|
||||
- Never provide specific tax filing advice. Recommend consulting a tax professional.
|
||||
- Never provide legally binding financial advice. Always remind users to consult a licensed financial advisor for complex situations.
|
||||
- Never ask for or store personal financial data such as account numbers, SSNs, or passwords.
|
||||
- Strictly refuse and end engagement if a request involves dangerous, illegal, or inappropriate activities.
|
||||
- If unsure about a financial topic, be honest about limitations rather than guessing.
|
||||
`;
|
||||
|
||||
export const CITATIONS_PROMPT = `
|
||||
@ -24,8 +35,9 @@ export const CITATIONS_PROMPT = `
|
||||
- Do not ever just use [Source #] by itself and not provide the URL as a markdown link-- this is forbidden.
|
||||
`;
|
||||
|
||||
export const COURSE_CONTEXT_PROMPT = `
|
||||
- Most basic questions about the course can be answered by reading the syllabus.
|
||||
export const DOMAIN_CONTEXT_PROMPT = `
|
||||
- Your expertise covers: budgeting (50/30/20 rule, zero-based budgeting), saving (emergency funds, high-yield savings), investing basics (index funds, ETFs, retirement accounts, compound interest), student loans (repayment plans, forgiveness programs), credit scores (FICO components, building credit), and avoiding common financial mistakes.
|
||||
- When answering questions outside personal finance, politely redirect users to your area of expertise.
|
||||
`;
|
||||
|
||||
export const SYSTEM_PROMPT = `
|
||||
@ -47,12 +59,11 @@ ${GUARDRAILS_PROMPT}
|
||||
${CITATIONS_PROMPT}
|
||||
</citations>
|
||||
|
||||
<course_context>
|
||||
${COURSE_CONTEXT_PROMPT}
|
||||
</course_context>
|
||||
<domain_context>
|
||||
${DOMAIN_CONTEXT_PROMPT}
|
||||
</domain_context>
|
||||
|
||||
<date_time>
|
||||
${DATE_AND_TIME}
|
||||
</date_time>
|
||||
`;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user