innightwolfsleep / text-generation-webui-telegram_bot

LLM telegram bot
MIT License
108 stars 21 forks source link

It can't send links and code on telegram #14

Closed TruthSearchers closed 1 year ago

TruthSearchers commented 1 year ago

I asked it to send reference link (i can see links in console ) , but it can't send it in telegram (it working perfectly in webui)

Code syntax highlight extension for codes Also if you can add features of using extensions of text generation web ui like sd_picture_api, TTS and send_picture one that would be amazing bro

PrincelyDread commented 1 year ago

I realized it burps errors whenever a unusual character is in the response. Works fine on webui though.

innightwolfsleep commented 1 year ago

You can add "Code syntax highlight" by adding in run_server function: tg_server.html_tag = ['<pre language="c++">', "</pre>"] If you want get URLS - this may help: tg_server.html_tag = ["", ""] Write me if it help or not.

Currently, i use HTML markup for bot message, but it is seems cant processing some symbols properly. Thats a problem during sending links. May be some preprocessing can be added... TBC.

sd api, tts, send picture - currently, this goals is too far

TruthSearchers commented 1 year ago

Screenshot_2023-04-27-11-21-45-53_948cd9899890cbd5c2798760b2b95377 Nope links (url ) still not working Plus i am noticing text generation stop after ':' colon (i think it's because of model-button_click) function and after press continue it only able to generate a single incomplete line (only for code output) So can't see whole code in single message because of it so can't tell if code syntax working Also bro you working on discord bot

innightwolfsleep commented 1 year ago

Added text preprocessing. Some chars (<>#) changes to its html codes. If you know where to find more "broken" symbols - send me please. (^ and % works without replacing) 2 1

TruthSearchers commented 1 year ago

Here some problems i found just now

  1. It's giving url now but like in a image Screenshot_2023-04-27-22-55-15-53_948cd9899890cbd5c2798760b2b95377

  2. Same code thing (it's not generating code in single text message Screenshot_2023-04-27-22-54-21-24_948cd9899890cbd5c2798760b2b95377

  3. It's stop generating token (text ) after loading new generation parameters preset as you loaded ! Screenshot_2023-04-27-22-57-08-55_948cd9899890cbd5c2798760b2b95377

innightwolfsleep commented 1 year ago

1) It's giving url now but like in a image Hmm... what do you see in webui when getting same URL? Bot didnt preprocess URLs, just send like a text. Perhaps, we need more complicated conversion of generated text to HTML... Or may be we can just cut off parse_mode="HTML".

2) Same code thing (it's not generating code in single text message)

I added code to prevent too long generation fo chat mode here:

        if self.bot_mode in ["chat", "chat-restricted"]:
            eos_token = '\n'

Try to replace eos_token = '\n' on eos_token = None (or eos_token = '')

3) It's stop generating token (text ) after loading new generation parameters preset as you loaded Just fixed.

TruthSearchers commented 1 year ago

No problem now Btw bro are you planning for discord bot too?

innightwolfsleep commented 1 year ago

There is atready one discord bot: https://github.com/ChobPT/text-generation-webui-discord_bot

TruthSearchers commented 1 year ago

Actually that on webhook can only give output can't take input haha

I was adding TTS and sd_api_pic in telegram bot just like web ui

innightwolfsleep commented 1 year ago

If you already added TTS and sd_api_pic to text-generation-webui-telegram_bot - send pull request)

TruthSearchers commented 1 year ago

Definitely gonna tell you when i completed ☺️ Just testing it for now

TruthSearchers commented 1 year ago

Hey bro You should also update it to latest web ui like end of turn replaced by turn_template , it's giving better result

innightwolfsleep commented 1 year ago

I have an idea with prefix... Like # is impersonate, - , ! or $ can be replacing order prefix.

UPD. Added ! prefix to replace last bot message.

TruthSearchers commented 1 year ago

That's cool bro i like it , it will be more easy you also have to update params

'end_of_turn' to 'turn_template' according to latest ooobaboga update for more accurate responses

TruthSearchers commented 1 year ago

Hey there @innightwolfsleep got the new error hehe When i change mode to chat from admin it giving me Attribute error (changing it in telegram_config.cfg) "AttributeError : 'TelegramBotWrapper' object has no attribute 'admin_list' "

Also i noticed some wierd replies like last when i use telegram bot , it give me replies same to it , but now when i ask hey there , it says who are you, or write article it say i will write then i tap continue - topic change (did you changed the parameters?) Its working fine with older version giving perfect replies (older version)

innightwolfsleep commented 1 year ago

some wierd replies like last when i use telegram bot , it give me replies same to it , but now when i ask hey there , it says who are you, or write article it say i will write then i tap continue - topic change (did you changed the parameters?) Its working fine with older versi

Added

innightwolfsleep commented 1 year ago

Hey there @innightwolfsleep got the new error hehe When i change mode to chat from admin it giving me Attribute error (changing it in telegram_config.cfg) "AttributeError : 'TelegramBotWrapper' object has no attribute 'admin_list' "

fixed

innightwolfsleep commented 1 year ago

Also i noticed some wierd replies like last when i use telegram bot , it give me replies same to it , but now when i ask hey there , it says who are you, or write article it say i will write then i tap continue - topic change (did you changed the parameters?) Its working fine with older version giving perfect replies (older version)

Hm... I made bunch of commits during and rework structure this holiday, so it is not easy to find problem. Can you send me "perfect" variant of script or link to last "perfect" commit?

I have tested bot just now, but didnt find a problem. Perhaps it was problem with erased "context", it is just solved.

TruthSearchers commented 1 year ago

Sure i will help gonna test the new commit , will let you know all errors

TruthSearchers commented 1 year ago

That problem still occuring here the screen shot Old response Screenshot_2023-05-01-14-27-33-63_948cd9899890cbd5c2798760b2b95377 Screenshot_2023-05-01-14-49-25-05_948cd9899890cbd5c2798760b2b95377

new response coming (3 screenshots ) after the update you done yesterday Screenshot_2023-05-01-14-27-21-51_948cd9899890cbd5c2798760b2b95377 Screenshot_2023-05-01-14-32-05-72_948cd9899890cbd5c2798760b2b95377 Screenshot_2023-05-01-14-46-26-54_948cd9899890cbd5c2798760b2b95377

No change in models or anything everything same from parameters to etc

TruthSearchers commented 1 year ago

One more problem after pressing continue its giving output out of topic like this Screenshot_2023-05-01-14-59-48-94_948cd9899890cbd5c2798760b2b95377

This problem occuring before you changed to latest one (telegram wrapper ) I forgot to tell here

innightwolfsleep commented 1 year ago

Hm... I spent about three hours to find simple answer - need to add space after "{Char}:" image

TruthSearchers commented 1 year ago

Thanks @innightwolfsleep bro ,sorry i made you work hard on it. But it was cooool i loved the telegram bot Gonna check the new updated code

innightwolfsleep commented 1 year ago

SileroTTS added. Cant reuse silero stright from ooba, so it is not need to acticvate silero extension.