Message Blocks for Normal Message Style (#37)
* add: if check for message length * update: version increment * update: readme
This commit is contained in:
@@ -15,7 +15,7 @@ The project aims to:
|
||||
* [ ] Message Persistance on Channels and Threads
|
||||
* [x] Containerization with Docker
|
||||
* [x] Slash Commands Compatible
|
||||
* [ ] Generated Token Length Handling for >2000 or >6000 characters
|
||||
* [x] Generated Token Length Handling for >2000 ~~or >6000 characters~~
|
||||
* [ ] External WebUI Integration
|
||||
* [ ] Administrator Role Compatible
|
||||
* [ ] Allow others to create their own models personalized for their own servers!
|
||||
|
||||
@@ -8,7 +8,7 @@ services:
|
||||
build: ./ # find docker file in designated path
|
||||
container_name: discord
|
||||
restart: always # rebuild container always
|
||||
image: discord/bot:0.3.6
|
||||
image: discord/bot:0.4.0
|
||||
environment:
|
||||
CLIENT_TOKEN: ${CLIENT_TOKEN}
|
||||
GUILD_ID: ${GUILD_ID}
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "discord-ollama",
|
||||
"version": "0.3.6",
|
||||
"version": "0.4.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "discord-ollama",
|
||||
"version": "0.3.6",
|
||||
"version": "0.4.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"axios": "^1.6.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord-ollama",
|
||||
"version": "0.3.6",
|
||||
"version": "0.4.0",
|
||||
"description": "Ollama Integration into discord",
|
||||
"main": "build/index.js",
|
||||
"exports": "./build/index.js",
|
||||
|
||||
@@ -21,7 +21,7 @@ export async function normalMessage(
|
||||
// bot's respnse
|
||||
let response: ChatResponse
|
||||
|
||||
await message.reply('Generating Response . . .').then(async sentMessage => {
|
||||
await message.channel.send('Generating Response . . .').then(async sentMessage => {
|
||||
try {
|
||||
// Attempt to query model for message
|
||||
response = await ollama.chat({
|
||||
@@ -35,9 +35,13 @@ export async function normalMessage(
|
||||
},
|
||||
stream: false
|
||||
})
|
||||
|
||||
// edit the 'generic' response to new message
|
||||
sentMessage.edit(response.message.content)
|
||||
|
||||
// check if message length > discord max for normal messages
|
||||
if (response.message.content.length > 2000) {
|
||||
sentMessage.edit(response.message.content.slice(0, 2000))
|
||||
message.channel.send(response.message.content.slice(2000))
|
||||
} else // edit the 'generic' response to new message
|
||||
sentMessage.edit(response.message.content)
|
||||
} catch(error: any) {
|
||||
console.log(`[Util: messageNormal] Error creating message: ${error.message}`)
|
||||
sentMessage.edit(`**Response generation failed.**\n\nReason: ${error.message}`)
|
||||
|
||||
Reference in New Issue
Block a user