JackBekket / Hellper

Telegram bot which can work with both openAI and LocalAI modes, it also uses UncensoredGPT models like Wizard-Uncensored. It can be launch at ordinary gamer PC without specific ai-gpu hardware
7 stars 1 forks source link

GitHelper test 3 #43

Open JackBekket opened 4 days ago

JackBekket commented 4 days ago

I want to change UI menu button rendering. Right now it's render telegram inline keyboards. I thinking about making a .yaml file with dialog structure of some sort. I think maybe I need some function to generate inline keyboards from this .yaml file. In any case provide me info about where is located UI functions and what should I do to make it work as I proposed earlier.

githelperbot[bot] commented 4 days ago

Here's the response from our 3rd service: You're on the right track! To change the UI menu button rendering and use a .yaml file for the dialog structure, you'll need to modify the functions responsible for generating the inline keyboards. Let's dive into the details.

First, you'll want to locate the functions that generate the inline keyboards. Based on the provided context, these functions are likely located within the "command" package. Specifically, look for functions like "Render OpenAI Model Menu with Inline Keyboard," "Render LLaMA-based Model Menu with Inline Keyboard," "Render Various AI Models Menu with Inline Keyboard," and "Render Language Menu with Inline Keyboard."

Now, let's discuss how to implement your proposed solution using a .yaml file. Here's a step-by-step guide:

  1. Create a .yaml file to store your dialog structure. This file should contain the menu items and their corresponding actions. For example, you could have a .yaml file like this:
menu:
  - item1:
      action: open_ai_model
  - item2:
      action: llama_model
  - item3:
      action: various_models
  1. Create a new function to parse the .yaml file and generate the inline keyboard. This function should take the .yaml file as input and return a list of inline keyboard buttons.

  2. Modify the existing functions that generate inline keyboards to use the new function you created. Instead of directly creating the inline keyboard buttons, they should call the new function to get the buttons from the .yaml file.

  3. Update the code to send the message with the generated inline keyboard to the chat using the bot.

By following these steps, you'll be able to change the UI menu button rendering and use a .yaml file for the dialog structure. This approach will allow you to easily manage and update your menu items without having to modify the code directly.