Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/pages/api/chat.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { env } from "../../env/server.mjs";
import { type NextApiRequest, type NextApiResponse } from "next";
import { PromptableApi } from "promptable";
import { getReply } from "../../server/chat/gpt3";
import { BOT_VERSION } from "../../server/chat/botConfig";
import { getReply as getOriginalReply } from "../../server/chat/gpt3";
import { getReply as getAlternateReply } from "../../server/chat/gpt3Alternate";

const getReply = BOT_VERSION === 'original' ? getOriginalReply : getAlternateReply;

import { Configuration, OpenAIApi } from "openai";

export const EMPATHY_PROMPT_ID = "clcj71xae00a0i6eghu9v7xbo";
Expand Down
2 changes: 2 additions & 0 deletions src/server/chat/botConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// src/server/chat/botConfig.ts
export const BOT_VERSION = 'original'; // can be 'original' or 'alternate'
8 changes: 8 additions & 0 deletions src/server/chat/gpt3Alternate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Message } from "../../../types";

export async function getReply(message: Message): Promise<string> {
// TODO: Implement your alternate response generation strategy here.

// For now, let's just return a placeholder message:
return "I'm the alternate version of the chat bot. Nice to meet you!";
}