AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Chat plugin capability

Open Wladastic opened this issue 1 year ago • 12 comments

Background

As I am currently building the telegram chat plugin, the plugin capabilities for logs, userinput etc were missing.

Changes

anywhere the user gets feedback and get asked for input, the input is sent to the according plugin method

Documentation

can_handle_report and can_handle_user_input needed in plugin init.py

handle_input(str) is a sync method that is supposed to work similar to the "input()" method, only that it can be used for example for asking the User a question and waiting for the answer.

report(str) just sends the user a message like a log or in my case with telegram chat it will just forward all messages that would normally only be visible in the terminal.

To enable, set CHAT_MESSAGES_ENABLED=True in your .env file

Test Plan

I will finish my telegram chat plugin and then set the missing ticks. Feel free to also test then, as this is supposed to be available to every type of plugin that needs those methods.

PR Quality Checklist

  • [x] My pull request is atomic and focuses on a single change.
  • [x] I have thoroughly tested my changes with multiple different prompts.
  • [x] I have considered potential risks and mitigations for my changes.
  • [x] I have documented my changes clearly and comprehensively.
  • [x] I have not snuck in any "extra" small tweaks changes

Wladastic avatar Apr 22 '23 16:04 Wladastic

@BillSchumacher You can also give feedback to the naming of the methods. I am not 100% satisfied with "report(str)" It could also be send_message(str), but not sure if any other plugins are actually being chat plugins then..

Wladastic avatar Apr 22 '23 16:04 Wladastic

Codecov Report

Patch coverage: 13.72% and project coverage change: -0.15 :warning:

Comparison is base (4a20616) 41.66% compared to head (4cc4843) 41.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2929      +/-   ##
==========================================
- Coverage   41.66%   41.51%   -0.15%     
==========================================
  Files          65       65              
  Lines        3029     3076      +47     
  Branches      507      525      +18     
==========================================
+ Hits         1262     1277      +15     
- Misses       1702     1734      +32     
  Partials       65       65              
Impacted Files Coverage Δ
autogpt/agent/agent.py 19.37% <5.55%> (+6.10%) :arrow_up:
autogpt/utils.py 61.44% <14.28%> (-22.77%) :arrow_down:
autogpt/logs.py 38.65% <25.00%> (-0.29%) :arrow_down:
autogpt/config/config.py 75.00% <100.00%> (+0.16%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Apr 23 '23 14:04 codecov[bot]

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Apr 23 '23 19:04 github-actions[bot]

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

github-actions[bot] avatar Apr 23 '23 19:04 github-actions[bot]

@desojo for context

ntindle avatar Apr 23 '23 22:04 ntindle

@desojo to test this, you can use my plugin: https://github.com/Wladastic/Auto-GPT-Telegram-Plugin

The Plugin Template PR is through, needs some waiting for it to be updated on pip, otherwise hasattr() will just pass

Feel free to contact me, I have received multiple questions and messages regarding this feature :)

Wladastic avatar Apr 24 '23 11:04 Wladastic

Codecov Report

Patch coverage: 20.00% and project coverage change: -7.97 :warning:

Comparison is base (a0cfdb0) 51.17% compared to head (8df3a43) 43.21%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2929      +/-   ##
==========================================
- Coverage   51.17%   43.21%   -7.97%     
==========================================
  Files          65       65              
  Lines        2935     2976      +41     
  Branches      424      504      +80     
==========================================
- Hits         1502     1286     -216     
- Misses       1310     1615     +305     
+ Partials      123       75      -48     
Impacted Files Coverage Δ
autogpt/agent/agent.py 24.64% <8.33%> (-21.57%) :arrow_down:
autogpt/utils.py 61.17% <16.66%> (-26.55%) :arrow_down:
autogpt/config/config.py 74.49% <100.00%> (-1.18%) :arrow_down:
autogpt/logs.py 65.46% <100.00%> (-14.83%) :arrow_down:

... and 12 files with indirect coverage changes

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Apr 25 '23 07:04 codecov[bot]

I had to change enumerate to make the plugin work. Otherwise it was turned into a tuple which didn't work.

Wladastic avatar Apr 25 '23 19:04 Wladastic

proof of work: https://cdn.discordapp.com/attachments/1100128423541747722/1100509590606590112/RPReplay_Final1682452290.mov

Wladastic avatar Apr 25 '23 20:04 Wladastic

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Apr 26, 2023 7:18pm

vercel[bot] avatar Apr 26 '23 10:04 vercel[bot]

I have no concerns about the config usage after the update at @BillSchumacher 's request. Will leave it to you guys to work through any remaining concerns.

collijk avatar Apr 26 '23 16:04 collijk

Requested Changes are done! :)

Wladastic avatar Apr 26 '23 18:04 Wladastic