changes to src/events/messageCreate.ts, Dockerfile, Modelfile, docker-compose.yml
This commit is contained in:
@@ -132,9 +132,9 @@ export default event(Events.MessageCreate, async ({ log, msgHist, ollama, client
|
||||
if (chatMessages.length === 0) {
|
||||
chatMessages = await new Promise((resolve, reject) => {
|
||||
openChannelInfo(message.channelId, message.channel as TextChannel, message.author.tag)
|
||||
getChannelInfo(`${message.channelId}-${message.author.username}.json`, (channelInfo) => {
|
||||
if (channelInfo?.messages) {
|
||||
resolve(channelInfo.messages)
|
||||
getChannelInfo(`${message.channelId}-${message.author.username}.json`, (config) => {
|
||||
if (config?.messages) {
|
||||
resolve(config.messages)
|
||||
} else {
|
||||
reject(new Error(`Failed to find ${message.author.username}'s history. Try chatting again.`))
|
||||
}
|
||||
@@ -160,7 +160,6 @@ export default event(Events.MessageCreate, async ({ log, msgHist, ollama, client
|
||||
// Load personality
|
||||
let personality: string
|
||||
try {
|
||||
// Point to /app/src/personality.json
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
const personalityPath = path.join(__dirname, '../personality.json')
|
||||
@@ -248,7 +247,9 @@ export default event(Events.MessageCreate, async ({ log, msgHist, ollama, client
|
||||
}
|
||||
} catch (error) {
|
||||
log(`Failed to parse model response: ${error}`)
|
||||
throw new Error(`Invalid JSON response from model: ${error}`)
|
||||
message.reply('Sorry, I’m having trouble thinking right now. Try again?')
|
||||
msgHist.pop()
|
||||
return
|
||||
}
|
||||
|
||||
if (jsonResponse.status === 'error') {
|
||||
|
||||
Reference in New Issue
Block a user