Not getting output of image generation telegram bot






https://replit.com/@avneetkjan

HI~~
While adding the module openai make sure to fill the prompt once you select image generation action in openai. Check the variables and other spellings since python is a case sensitive language also all the required modules must be installed

Hi @avneetkjan

In the telegram chatbot project, it is essential to configure Telegram and MAKE platform correctly. Please make sure that your bot token, channel id is correct. You can re watch the video tutorial to make sure that the configurations are correct.

Also in your repl there are many files with the same code. Ideally there should be only 2 files, main,py and example.py. Once you aare done with the configuration, run the code and type /start in your telegram chat.

Below is the code for your reference:
main.py

import os

from boltiotai import openai

import asyncio
from aiogram import Bot, Dispatcher, types
from aiogram.filters import CommandStart

from example import example

bot = Bot(token='REPLACE THIS WITH YOUR BOT TOKEN ID')

dp = Dispatcher()

openai.api_key = os.environ['OPENAI_API_KEY']

example()


@dp.message(CommandStart(['start', 'help']))
async def welcome(message: types.Message):
  await message.reply('Hello! I am GPT Chat BOT. You can ask me anything :)')


@dp.message()
async def gpt(message: types.Message):
  messages = [{"role": "system", "content": "You are a helpful assistant."}, {"role":"user", "content":message.text}]
  
  response = openai.chat.completions.create(model="gpt-3.5-turbo", messages=messages)

  await message.reply(response['choices'][0]['message']['content'])

async def main():
  await dp.start_polling(bot)

if __name__ == "__main__":
  asyncio.run(main())
  

exmple.py

from flask import Flask, render_template

from threading import Thread

app = Flask(__name__)

@app.route('/')

def index():

 return "example" 

def run():

 app.run(host='0.0.0.0',port=8080) 

def example():

 t = Thread(target=run)

 t.start()

Do try this and let us know. If you still face any issue, please feel free to get back to us

In the telegram chatbot project, it is essential to configure Telegram and MAKE platform correctly. Please make sure that your bot token, channel id is correct. You can re watch the video tutorial to make sure that the configurations are correct.

Also in your repl there are many files with the same code. Ideally there should be only 2 files, main,py and example.py. Once you aare done with the configuration, run the code and type /start in your telegram chat.

Hi @avneetkjan,

Apologies for the incorrect response in the previous message.

Due to the recent discontinuation of free credits from OpenAI, the Telegram image generation project, which relies on MAKE.com and OpenAI, may not work as expected. Currently, the BoltIoT AI library does not support the MAKE.com project and the embedded chain project. Therefore, these projects have been designated as bonus content, available after the training completion exam.

We are actively working on integrating the Telegram image generation project with the BoltIoT AI library. This process will take some time. In the meantime, you can explore and build other projects such as chatbots and image generators that are compatible with the BoltIoT AI library.

If you need any further assistance, please feel free to reach out.