A Next.js application for interacting with AI models through a chat interface. Built with TypeScript, supports multiple model providers (currently Anthropic), and stores configuration in local storage.
- 🚀 Deployable on Vercel
- 💬 Chat interface for AI models
- 🔧 Model-agnostic architecture (extensible for multiple providers)
- 📦 Local storage for configuration (no database required)
- 🔐 Secure API key handling (tokens stored server-side)
- 🎨 Modern UI with Tailwind CSS
- Node.js 18+
- npm or yarn
- API keys for the model providers you want to use
- Clone the repository:
git clone <your-repo-url>
cd parable-pm-assistant- Install dependencies:
npm install- Create a
.env.localfile in the root directory:
# Anthropic API Key
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# Other provider API keys (for future use)
OPENAI_API_KEY=your_openai_api_key_here- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
-
Push your code to a Git repository (GitHub, GitLab, or Bitbucket).
-
Import your project on Vercel:
- Go to https://vercel.com/new
- Import your Git repository
- Vercel will automatically detect Next.js
-
Add environment variables in Vercel:
- Go to your project settings
- Navigate to "Environment Variables"
- Add
ANTHROPIC_API_KEYwith your API key value - Add any other provider keys you plan to use
-
Deploy! Vercel will automatically build and deploy your application.
The application uses local storage to persist user preferences:
- Provider: Choose between Anthropic, OpenAI (coming soon), or Google (coming soon)
- Model: Specify which model to use (e.g.,
claude-3-5-sonnet-20241022) - Temperature: Control randomness (0-2)
- Max Tokens: Maximum response length
Configuration is saved automatically and persists across sessions.
parable-pm-assistant/
├── pages/
│ ├── api/
│ │ └── chat.ts # Backend API route for chat
│ ├── _app.tsx # Next.js app wrapper
│ └── index.tsx # Main chat interface
├── lib/
│ ├── providers.ts # Model provider abstraction
│ ├── config.ts # Local storage config management
│ └── chat.ts # Frontend chat service
├── types/
│ └── index.ts # TypeScript type definitions
└── styles/
└── globals.css # Global styles
The application uses a provider-agnostic architecture:
IModelProvider: Interface that all providers must implementModelProviderFactory: Creates provider instances based on configuration- Currently supports Anthropic (Claude), with OpenAI and Google planned
- API keys are stored server-side only (in environment variables)
- Client never sees or handles API keys
- All API calls go through backend routes (
/api/chat)
- Create a new provider class implementing
IModelProvider:
export class NewProvider implements IModelProvider {
async chat(messages: ChatMessage[], config: ModelConfig): Promise<ChatResponse> {
// Implementation here
}
}- Add the provider to
ModelProviderFactory.create() - Add the provider option to the frontend config UI
- Add the environment variable for the API key
MIT