Add function handling for OpenAI model
for now it's querying only time, but in the future there will be more commands
This commit is contained in:
parent
bebef021fb
commit
0df05e2f06
4 changed files with 169 additions and 33 deletions
|
@ -2,17 +2,17 @@ import { ChatCompletionRequestMessage as OpenAIMessage , CreateChatCompletionReq
|
|||
|
||||
// Don't forget to rename the file to config.ts
|
||||
|
||||
const calendarConfig: Intl.DateTimeFormatOptions = {
|
||||
weekday: "short",
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hour12: false,
|
||||
};
|
||||
|
||||
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",
|
||||
|
@ -22,7 +22,7 @@ export default class config {
|
|||
/** 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. Current time (${Intl.DateTimeFormat().resolvedOptions().timeZone}): ${new Date().toLocaleString("en-US", calendarConfig)}` }
|
||||
{ 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.` }
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue