A Kotlin-based web application built with Spring Boot that allows you to switch between multiple Generative AI APIs (e.g., DeepSeek, ChatGPT, Claude) and customize AI settings. 🤖
The app features a clean and structured frontend with a side menu for AI parameters and a main content area for chat interactions.
- Multi-Chat Sessions: Create, switch, and delete chat sessions.
- Customizable AI Settings: Adjust parameters like
temperature,max_tokens, andtop_p. - Multiple APIs: Choose between different Generative AI APIs (DeepSeek, ChatGPT, Claude).
- Chat History: Stores chat sessions locally for retrieval and visualization.
- Clean JSON Serialization: Uses Kotlin data classes and Jackson for seamless API communication.
- Backend: Spring Boot (Kotlin, v.2.0.10, java 21)
- Frontend: HTML, CSS (Bootstrap), JavaScript (to be perhaps replaced by React later on, but I am not a frontend dev)
- API Integration: DeepSeek, ChatGPT, Claude
- Build Tool: Gradle (v. 8.12)
Pre-requisites: You will need these (or at least 1) environment variables set:
export DEEPSEEK_API_KEY=your_deepseek_api_key
export CHATGPT_API_KEY=your_chatgpt_api_key
export CLAUDE_API_KEY=your_claude_api_key# Just use the bash script to start both frontend and backend
./start.shIf you want more control over the installation, you can follow these steps:
- Clone the repository:
git clone https://github.com/your-username/generative-ai-switcher-kotlin.git cd generative-ai-switcher-kotlin
- Run the application:
./gradlew bootRun
-
Open a new terminal and navigate to the
frontenddirectory:cd frontend -
Install the dependencies:
pnpm install
-
Start the frontend:
pnpm run build start
| Endpoint | Method | Description |
|---|---|---|
/api/create-session |
POST | Creates a new chat session. |
/api/get-session/{sessionId} |
GET | Retrieves a chat session by ID. |
/api/delete-session/{sessionId} |
POST | Deletes a chat session by ID. |
/api/generate |
POST | Sends a prompt to the AI and gets a response. |
{
"sessionId": "2024-12-28T18:43:33.174034",
"apiName": "DeepSeek",
"systemPrompt": "You are a helpful assistant.",
"userPrompt": "Hello!",
"temperature": 0.0,
"maxTokens": 3000,
"topP": 1.0
}{
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I assist you today?"
},
"logprobs": null,
"finish_reason": "stop"
}
]
}
Side menu with AI settings and main chat area.
- DeepSeek, OpenAI, Anthropic, Perplexity: For their Generative AI APIs.
Enjoy experimenting with different Generative AI models! 🚀