Created
May 18, 2024 16:50
-
-
Save christopherbauer/f1cb7d5c6dcb03258f8ef16e558e0062 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import OpenAI from "openai"; | |
import { ChatCompletionMessageParam } from "openai/resources"; | |
import { Message } from "../types"; | |
const openai = new OpenAI({ | |
apiKey: process.env.OPEN_AI_API_KEY, | |
}); | |
type StorageMessage = OpenAI.Chat.Completions.ChatCompletionMessageParam & { | |
sent: Date; | |
}; | |
type ConversationStorageData = { persona: string; messages: StorageMessage[] }; | |
const ConversationStorage: Record<string, ConversationStorageData> = {}; | |
export class ChatGptConversationService { | |
/* ... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment