EdgeGPT for AHK - no api key required

Post your working scripts, libraries and tools.
sashaatx
Posts: 333
Joined: 27 May 2021, 08:27
Contact:

EdgeGPT for AHK - no api key required

Post by sashaatx » 01 Jun 2023, 02:00

I've been working with AI chatbots for months between GPT, Bard, and others. This has been by far the best insofar as capabilities and flexibility. It's been on Github for a few months, I've been watching to ensure everything is above board and I have no reason to believe otherwise. it's all done via selenium without a window, cycling cookies automatically, its quite ingenious.



Advantages:
- access to the internet
- access to github
- ability to review pdfs, csvs, etc when hosted online for summary, and questions

For an explainer, Use the simple example, Youll need the full release here: https://github.com/samfisherirl/EdgeGPT_forAHK

I have two example on the github, one is 10 lines and just asks via ahk and responds with a msgbox, the latter provides a GUI.
AHK writes the request to text => python bot (adopted from this gentlemans creation https://github.com/acheong08/EdgeGPT) processes the request, handles cookies, streams response to ahk.

My other projects
https://github.com/samfisherirl/Google-Bard-for-AHK-v2
https://github.com/samfisherirl/AutoHot-GPT

Ahk scripts - these were thrown together quickly, and will get worked on. They are by far not the best of their kind, most time was spent on the pyside. Now that that's finished I'll clean these up. I will likely switch to a socket.


Simple_Example.ahk

Code: Select all

botpath := A_ScriptDir "\bot\EdgeGPT_forAHK.exe"
E := EdgeGPT(botpath)
answer := E.Ask("whats the weather in fiji?")
MsgBox(answer)

E.asyncAsk("How can I travel there?")
loop {
    ans := E.answer ; streams to string the answer in pieces
    if E.finished {
        MsgBox(ans)
    }
}
GUI chat window

Code: Select all

#Include %A_ScriptDir%\lib\EdgeGPT.ahk
botpath := A_ScriptDir "\bot\EdgeGPT_forAHK.exe"
g := Gui()
g.OnEvent("close", gui_close)
g.OnEvent("escape", gui_close)
display := g.Add("Edit", "w500 h500 ReadOnly", "")
question_field := g.Add("Edit", "w500 h100", "Enter your question")
button := g.Add("Button", "Default", "Submit Question")
button.OnEvent("Click", Asker)
question_field.Focus()
g.Title := "BingGPT"
g.Show()

Asker(*) 
{
   global display, question_field
   E := EdgeGPT(botpath)
   E.asyncAsk(question_field.Value)
   Loop 
   {
      if E.answer != "" {
      display.Value := E.answer
      Sleep(100)
      if (E.finished)
      {
         break
      }
   }
   }
}
gui_close(*) 
{
   ExitApp
}
image.png
image.png (37.82 KiB) Viewed 2980 times

Update 10/2/23: this required I rewrite and compile the python. I have not done it in the same method as before as I don't have time. It will not stream responses.

Simply write one question to "ask.txt" in the same dir as the exe file posted in the github release here. https://github.com/samfisherirl/EdgeGPT_forAHK/releases/tag/v1.1
Upon close, the app will write the response in "answer.txt".
To track the response from ahk, just track the processexist PID.

This update was done for one person. If this has any additional users, Ill recompile with the original ahk gui methods.
Attachments
VIRUSTOTAL.PNG
VIRUSTOTAL.PNG (101.63 KiB) Viewed 2979 times
Last edited by sashaatx on 03 Oct 2023, 04:42, edited 7 times in total.
https://github.com/samfisherirl
? /Easy-Auto-GUI-for-AHK-v2 ? /Useful-AHK-v2-Libraries-and-Classes : /Pulovers-Macro-Creator-for-AHKv2 :

sashaatx
Posts: 333
Joined: 27 May 2021, 08:27
Contact:

Re: ChatGPT-4 Reverse Engineered, No Daily Limit, No APIKey [release, not for generating ahk code]

Post by sashaatx » 02 Jun 2023, 09:14

Example use case: Get GPT to retrieve answer from specific documentation, github, or PDF. (GPT3.5 from the website does not allow internet access)

I am experimenting with how to get GPT to write good AHKv2.

Usually you will always get "ComObjCreate()" in code, which is from AHKv1, even when you ask for ahkv2.

But if I use this prompt:

Code: Select all

#Include EdgeGPT.ahk
E := EdgeGPT()
E.asyncAsk("I have a question regarding this documentation: https://www.autohotkey.com/docs/v2/ how do you call a comobject? and are there any ways to debug it")

Loop {
    Sleep(100)
    if (E.finished){
        Msgbox(E.answer)
    }
}
/*

*/
I actually get a partial right answer!
image.png
image.png (54.66 KiB) Viewed 2814 times
Problem being the bottom where it pulls from the automator.

So Ill be working on a way to pass it through a prompt handler to return good code, as well as a debug syntax highlighter so the mods dont get overwhelmed with shitty questions.
https://github.com/samfisherirl
? /Easy-Auto-GUI-for-AHK-v2 ? /Useful-AHK-v2-Libraries-and-Classes : /Pulovers-Macro-Creator-for-AHKv2 :

fdeferia
Posts: 4
Joined: 23 Mar 2022, 04:19

Re: ChatGPT-4 Reverse Engineered, No Daily Limit, No APIKey [release, not for generating ahk code]

Post by fdeferia » 20 Sep 2023, 07:16

What a great idea, it worked flawlessly for a limited time, unfortunately it stopped working a while ago. I can see that the original project has been archived, so I suppose I'll have to wait for something comparable :)
In the meantime I will use my own prompt generator that interact with chrome.

Thanks!

sashaatx
Posts: 333
Joined: 27 May 2021, 08:27
Contact:

Re: ChatGPT-4 Reverse Engineered, No Daily Limit, No APIKey [release, not for generating ahk code]

Post by sashaatx » 02 Oct 2023, 11:40

fdeferia wrote:
20 Sep 2023, 07:16
What a great idea, it worked flawlessly for a limited time, unfortunately it stopped working a while ago. I can see that the original project has been archived, so I suppose I'll have to wait for something comparable :)
In the meantime I will use my own prompt generator that interact with chrome.

@fdeferia

Thanks!
I recompiled it with update just for you. It doesnt stream like before, as I dont have time. But hope its useful. Instructions:

Simply write one question to "ask.txt" in the same dir as the exe file posted in the github release here. https://github.com/samfisherirl/EdgeGPT_forAHK/releases/tag/v1.1
Upon close, the app will write the response in "answer.txt".
To track the response from ahk, just track the processexist PID.
https://github.com/samfisherirl
? /Easy-Auto-GUI-for-AHK-v2 ? /Useful-AHK-v2-Libraries-and-Classes : /Pulovers-Macro-Creator-for-AHKv2 :

ShiningCraft
Posts: 3
Joined: 10 May 2023, 11:11

Re: ChatGPT-4 Reverse Engineered, No Daily Limit, No APIKey [release, not for generating ahk code]

Post by ShiningCraft » 21 Mar 2024, 11:45

sashaatx wrote:
02 Oct 2023, 11:40
fdeferia wrote:
20 Sep 2023, 07:16
What a great idea, it worked flawlessly for a limited time, unfortunately it stopped working a while ago. I can see that the original project has been archived, so I suppose I'll have to wait for something comparable :)
In the meantime I will use my own prompt generator that interact with chrome.

@fdeferia

Thanks!
I recompiled it with update just for you. It doesnt stream like before, as I dont have time. But hope its useful. Instructions:

Simply write one question to "ask.txt" in the same dir as the exe file posted in the github release here. https://github.com/samfisherirl/EdgeGPT_forAHK/releases/tag/v1.1
Upon close, the app will write the response in "answer.txt".
To track the response from ahk, just track the processexist PID.
Hello! I'm not sure if anyone else is having issues or not, but when I'm running main.exe it modifies the answer.txt but it's blank. Is this suppose to happen? Sorry for what is probably a silly question. If it is suppose to be blank, where / how would I get the reply with ahk? To track the response from ahk, just track the processexist PID. Do you mean I should have ahk delete the answer.txt file after I take it's contents, and then every time answer.txt is created/exists, take it's contents again to get the newer answers? I can do that, but I don't think the answer.txt should be empty then, but idk, sorry.
I am using the ask.txt to ask what the weather is in fiji? same in the example

Post Reply

Return to “Scripts and Functions (v2)”