44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { ChatCompletionRequestMessage as OpenAIMessage , CreateChatCompletionRequest as ChatCompletionRequestData } from "openai";
|
|
|
|
// Don't forget to rename the file to config.ts
|
|
|
|
export default class config {
|
|
static readonly calendarConfig: Intl.DateTimeFormatOptions = {
|
|
weekday: "short",
|
|
year: "numeric",
|
|
month: "short",
|
|
day: "numeric",
|
|
hour: "2-digit",
|
|
minute: "2-digit",
|
|
hour12: false,
|
|
};
|
|
|
|
/** Tokens to authenticate with */
|
|
static readonly tokens = {
|
|
Discord: "Discord token here",
|
|
OpenAI: "OpenAI token here",
|
|
};
|
|
|
|
/** Messages to append at the start of every chat when sending to API */
|
|
static systemPrompt(): OpenAIMessage[] {
|
|
return [
|
|
{ role: "system", content: `You are GPTcord, an AI built on top of ChatGPT (a large language model trained by OpenAI) for Discord. Answer as concisely as possible.` }
|
|
];
|
|
}
|
|
|
|
/** OpenAI model config */
|
|
static readonly chatCompletionConfig: Omit<ChatCompletionRequestData, "messages"> = {
|
|
model: "gpt-3.5-turbo",
|
|
max_tokens: 384,
|
|
};
|
|
|
|
/** limits for message selection */
|
|
static readonly limits = {
|
|
/** maximum time in the past for messages (in miliseconds) */
|
|
time: 60*60*1000,
|
|
/** maximum number of messages to select (maximum 100) */
|
|
messages: 50,
|
|
/** maximum total token usage for messages */
|
|
tokens: 2048,
|
|
};
|
|
}
|