-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
93 additions
and
132 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@callstack/byorg-discord': minor | ||
'discord-example': minor | ||
--- | ||
|
||
discord: changed passing bot token variable and discord login |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
// TODO | ||
// import readline from 'readline'; | ||
// import { Message, VercelChatModelAdapter, createApp } from '@callstack/byorg-core'; | ||
// import { createOpenAI } from '@ai-sdk/openai'; | ||
// import { requireEnv } from '@callstack/byorg-utils'; | ||
// import { createDiscordApp } from '@callstack/byorg-discord'; | ||
import { VercelChatModelAdapter, createApp } from '@callstack/byorg-core'; | ||
import { createOpenAI } from '@ai-sdk/openai'; | ||
import { logger, requireEnv } from '@callstack/byorg-utils'; | ||
import { createDiscordApp } from '@callstack/byorg-discord'; | ||
|
||
// const LANGUAGE_MODEL = 'gpt-4o-2024-11-20'; | ||
// const API_KEY = requireEnv('OPENAI_API_KEY'); | ||
const LANGUAGE_MODEL = 'gpt-4o-2024-11-20'; | ||
const API_KEY = requireEnv('OPENAI_API_KEY'); | ||
const DISCORD_BOT_TOKEN = requireEnv('DISCORD_BOT_TOKEN'); | ||
|
||
// const openAiProvider = createOpenAI({ | ||
// apiKey: API_KEY, | ||
// compatibility: 'strict', // strict mode, enable when using the OpenAI API | ||
// }); | ||
const openAiProvider = createOpenAI({ | ||
apiKey: API_KEY, | ||
compatibility: 'strict', // strict mode, enable when using the OpenAI API | ||
}); | ||
|
||
// const openAiModel = openAiProvider.languageModel(LANGUAGE_MODEL); | ||
const chatModel = new VercelChatModelAdapter({ | ||
languageModel: openAiProvider.languageModel(LANGUAGE_MODEL), | ||
}); | ||
|
||
// const chatModel = new VercelChatModelAdapter({ | ||
// languageModel: openAiModel, | ||
// }); | ||
const systemPrompt = () => { | ||
return 'Your name is Byorg. You are a helpful AI Assistant.'; | ||
}; | ||
|
||
// const systemPrompt = () => { | ||
// return 'Your name is Cassandra. You are an AI Assistant.'; | ||
// }; | ||
const app = createApp({ | ||
chatModel, | ||
systemPrompt, | ||
}); | ||
|
||
// const app = createApp({ | ||
// chatModel, | ||
// systemPrompt, | ||
// }); | ||
const discord = await createDiscordApp({ app }); | ||
|
||
// // const discord = createDiscordApp({ | ||
// // app, | ||
// // }); | ||
void (async () => { | ||
try { | ||
await discord.login(DISCORD_BOT_TOKEN); | ||
logger.info('Discord ready.'); | ||
} catch (error) { | ||
logger.error('Dev Slack start error:', error); | ||
} | ||
})(); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.