ChatGPT GUI Topic is solved

Stelle Fragen zur Programmierung mit Autohotkey

Moderator: jNizM

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 31 Mar 2023, 15:40

@effel danke , die vorherigen Versionen funktionieren gut, GoogleTranslate ist für mich hier nicht notwendig
EDIT : grad Deine Aenderung gesehen / moment kein Erfolg / versuche denn morgen ....
EDIT : doch es funktioniert, habe lediglich Uebersetzung nicht gesehen . Melde mich morgen wieder ....

ChatGPT sucht irgendwo etwas im Netz und versucht einen Satz zu bilden ... besser Google Search zu verwenden

-What does Caran d'Ache mean?
-Caran d'Ache is a Swiss company that produces high-quality writing instruments, art supplies, and luxury goods.
The name is derived from the French phrase "crayon d'ache," which translates to "pencil of the ache tree," referring to the Swiss stone pine tree. ;-- <<< falsch

Korrekt :
russian = карандаш / karandash = pencil
turkish = kara > black
turkish = taş > stone

effel
Posts: 544
Joined: 16 Jan 2018, 13:34

Re: ChatGPT GUI

Post by effel » 31 Mar 2023, 19:22

02:18 Uhr jetzt bekomme ich wieder Antwort von GoogleTranslate()

Alles gut, das ist Gratis und darf mal ausfallen ;)

04_01_23 @2_17_56.PNG
04_01_23 @2_17_56.PNG (117.41 KiB) Viewed 1816 times

just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: ChatGPT GUI

Post by just me » 01 Apr 2023, 02:59

Moin,
effel wrote:Wie du siehst, ist in der Ausgabe Datei, die ich zu jeder Anfrage speichere, jedes Japanische Zeichen durch einen Platzhalter ersetzt. Nicht das es mir wichtig wäre, aber vielleicht ist es ja auch nur wenig Aufwand.

Code: Select all

if Ergebnisdatei {
Anow := A_now
fileappend,% this_ADD,% a_scriptdir "\" Anow " Ergebnisdatei.txt"
try run,% a_scriptdir "\" Anow " Ergebnisdatei.txt"
}
Mit A_Now im Dateinamen erstellst Du jedesmal eine neue Datei. Die Standardkodierung für neue Dateien ist CP0 (ANSI). Dieser Zeichensatz kann japanische Zeichen nicht darstellen und liefert dafür das 'Ersatzzeichen' ?.
Deshalb entweder

Code: Select all

FileEncoding, UTF-8
am Anfang des Skripts oder

Code: Select all

FileAppend,% this_ADD,% A_ScriptDir "\" Anow " Ergebnisdatei.txt", UTF-8
Dann sollten Editoren, die mit UTF-8 umgehen können, korrekte Ergebnisse anzeigen.

Und zu guter letzt: Ja, ich bin wieder zu Hause und die Reparatur scheint gut zu funktionieren.

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 01 Apr 2023, 08:34

@effel und @just me , danke , habe nach fileappend am Schluss angefügt " ,UTF-8 "
Frage wegen translate : warum es die ukrainische Sprache übersetzt nach language 'te' (Telugu, Südindien )
EDIT : gefunden , in der ersten Linie entferne ";" bei > global ToggleLanguage ; := true
20230401152137_screenshot.jpg
20230401152137_screenshot.jpg (282.05 KiB) Viewed 1790 times

effel
Posts: 544
Joined: 16 Jan 2018, 13:34

Re: ChatGPT GUI

Post by effel » 01 Apr 2023, 10:18

garry wrote:
01 Apr 2023, 08:34
Frage wegen translate : warum es die ukrainische Sprache übersetzt nach language 'te' Telugu, Südindien )
Hallo @Just Me
Danke, FileEncoding, UTF-8 war das Zauberwort. Jetzt wird alles perfekt angezeigt


Hallo @Garry wenn ich zu viel Daten eingebe, bekomme ich schon mal kein Ergebnis, aber die Sprache wird eigentlich immer erkannt

04_01_23 @4_56_55.PNG
04_01_23 @4_56_55.PNG (26.66 KiB) Viewed 1774 times

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 02 Apr 2023, 06:04

@effel danke , doch eine Frage ob hier beim letzten Skript in der ersten Linie der Strichpunkt entfernt werden muss > ";"
viewtopic.php?p=515324#p515324

Code: Select all

global ToggleLanguage ; := true

effel
Posts: 544
Joined: 16 Jan 2018, 13:34

Re: ChatGPT GUI

Post by effel » 02 Apr 2023, 08:16

@Garry

ich weiß es nicht, habe es mit dem Semikolon versehen, weil es so bei mir funktionierte.

kann mich erst in einer Woche weiter damit befassen.

ich sehe das bei deinem Screenshot die Scrollbalken der Edits nicht richtig angezeigt werden. Ich muss da wohl noch nachbessern 🥴

bis bald ✌️

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 02 Apr 2023, 10:26

@effel Edit Scrollbalken ist OK . Wenn ich mit dem Maus drüberfahre zeigt es die Pfeile unten/oben an wie bei Deinem screenshot ( bei meinem Beispiel waren EDIT-Felder voll ausgefüllt )
sorry wegen Verwirrung , mir scheint dies funktioniert für mich gut, z.B starte Frage ukrainisch und wähle Sprache z.B. : nl . Denn ist 1-st EDIT = englisch, 2-nd EDIT = niederländisch
die ersten 2 Linien im Skript :
global ToggleLanguage
ToggleLanguage := true

effel
Posts: 544
Joined: 16 Jan 2018, 13:34

Re: ChatGPT GUI

Post by effel » 03 Apr 2023, 07:06

hallo @Garry,

ToggleLanguage ist noch eine Datenleiche, sie wird nicht mehr genutzt.

Das Script hat im laufe der Zeit dauernd Änderungen erhalten.

Ich sende grundsätzlich alle Anfragen an ChatGPT in englicher Sprache

Im Json File welches ich in Tea´s Funktion als Antwort erhhalte, steht in immer der gleichen Zeile bzw Adresse z.b. "en_de_2022q1.md" wenn die Anfrage an Translate in englischer Sprache erfolgte

Ist die Anfrageprache japanisch, sieht das Ergebnis z.b. so aus "ja_en_2022q2.md"

Mit (SubStr((language[1, 1, 9, 1, 1, 2]), 1, 2)) habe ich nun den Landesode des `Fragenden`.

Ich mache also pro Vorgang immer zwei Translate-Anfragen Die erste sendet mir die Anfrage erstmal ins Englische übersetzt und dazu noch den Landescode der Eingangssprache den ich mit GuiControl,, lang,% language erstmal zwischenspeichere.

Im Anschluß daran wird die nun englische Frage an ChatGPT gesendet, und die Antwort hieraus wir nun in der zweiten Translate Anfrage durch auslesen von GuiControlGet, lang so gelenkt, dass sie das ja dort so einsetzt GoogleTranslate(thisText, "en", "ja")

Hierdurch wird die zweite Anfrage an Googles Translate initiiert und die Antwort von ChatGPT in die jeweilige Landessprache des Fragenden übersetzt.

Dieses erste Json File wird nicht im ResultFile abgespeichert.

Wenn du Fehler bei der Google Übersetzung feststellst kannst du deine Anfrage auch einmal direkt im Browser an Google senden, schreib mir was dann dort automatisch als Eingangs Sprache erkannt wurde


Du hast geschrieben, das du sowieso keinen Wert auf die Übersetzung legst, dann würde ich die empfehlen die frühen Versionen zu nutzen, am ChatGPT Code hat sich ja ansonsten nichts geändert.


Grüße aus Köln

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 03 Apr 2023, 14:47

@effel danke, funktioniert gut , im Prinzip brauche ich nur Eingabe ( Frage ) = deutsch , Ausgabe =deutsch
falls doch x-beliebige Sprache , z.B. :
Frage : Радянщина чи боротьба за права: як з’явилося 8 березня та які альтернативи свята в Україні?
EDIT : Ukrainisch bzw jede andere Sprache funktioniert weil die Frage denn auf englisch übersetzt wird


Kann man / soll man Deinen letzten Skript auf Position 1 tun ( Seite-1 ) ? ;<<<<<<<<<<<<<

Im Skript als Test dies am Anfang angefügt :

Code: Select all

;- GPT-3 =  Generative Pre-trained Transformer-3
;- Info: ChatGPT supports =  English, Spanish, French, German, Italian, Portuguese, Dutch, Russian
;- it translates QUESTION first to english and show ANSWER in english and to your desired language
;-------------------------------------------------------------------------
;-
;api_key := "Your key here"   >>>  https://platform.openai.com/account/api-keys
api_url := "https://api.openai.com/v1/engines/text-davinci-003/completions"
;-------------------------------------------------------------------------
;---------------------------------------------------------------------
;e0:="Was heisst Caran d'Ache ?"
;e0:="Hi there, is it possible for you to predict the future ?"
e0:="The cafeteria had 23 apples . If they used 20 to make lunch and bought 6 more , how many apples do they have ?" ;-9
;e0:="Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls . How many tennis balls does he have now ?" ;-11
;e0:="Радянщина чи боротьба за права: як з’явилося 8 березня та які альтернативи свята в Україні?"
;---------------------------------------------------------------------
;.............
Gui, Tab, 1
;---------------------------------------------------------------------
Gui, Add, Edit,Section vSucheingabe hwndSucheingabe w540 r1,%e0%      ; Deine Frage an ChatGPT ...
;----------------------------------------------------------------------
;......
.... auch eine falsche Antwort von ChatGPT-3 ( translated > letzeburgisch )

Code: Select all

===== 20230418223155 ===================
Was ist schwerer , 1 kg Blei oder 2 kg Federn ?
------------
Wat ass méi schwéier, 1 kg Bläi oder 2 kg Fieder?
-------------------------------------------------------------
1 kg of lead is heavier than 2 kg of feathers.
---------------
1 kg Bläi ass méi schwéier wéi 2 kg Fieder.
=========================================

TV Media Arte.de über Kölsch ...
ARTE.DE" "Aktuelles und Gesellschaft - Perspektivwechsel" "Karambolage - Der "tchip" / Der Hund / Kölsch"
" Jeanne Meyer ist eine junge Französin. Während eines Praktikums in Köln hat sie Bekanntschaft mit einem typischen Kölner Getränk gemacht: dem Kölsch. - Und wie jede Woche das Rätsel."
"20210523 16:55" "00:10:50"
"https://arteptweb-a.akamaihd.net/am/ptweb/098000/098300/098342-021-A_SQ_0_VA_05848812_MP4-2200_AMM-PTWEB_1Yg0OZGIDh.mp4"
"https://www.arte.tv/de/videos/098342-021-A/karambolage/
Last edited by garry on 18 Apr 2023, 15:37, edited 2 times in total.

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 07 Apr 2023, 15:16

Im Moment für mich OK, definiere Sprache (Answer in Edit2 ) , evtl Korrekturen nötig ... da keine Ahnung wie's funktioniert ... :)
EDIT : clear button angefügt

Code: Select all

;=====================================================================================================
;- ChatGPT-3 =  Generative Pre-trained Transformer-3
;- Info: ChatGPT supports =  English, Spanish, French, German, Italian, Portuguese, Dutch, Russian
;- it translates QUESTION first to english and show ANSWER in english and to your desired language
;- https://36kr.com/p/2196628560234373   2023-04-01  about GPT-4
;-----------------------------------------------------------------------------------------------------
;#Warn
#singleinstance force
SetWorkingDir, %A_ScriptDir%
;-------------------------------------------------------------------------
api_key := "INSERT_API_KEY_HERE"
api_url := "https://api.openai.com/v1/engines/text-davinci-003/completions"  ;- The endpoint URL for the GPT-3 API -
AnswerLanguage:="de"   ;- in edit-2
;----------------------------------------------------------------------------------------------------
if (api_key="INSERT_API_KEY_HERE")
 {
 msgbox, 262180,API-KEY needed,You must define the API-KEY`nAuthentication required / Please log in to access this page=`nhttps://platform.openai.com/account/api-keys`nURL open when hit 'YES' 
 ifmsgbox,NO
	exitapp
 run,https://platform.openai.com/account/api-keys
 exitapp
 }
;----------------------------------------------------------------------------------------------------
;e0:="Woher kommt das Wort Caran d'Ache ?"  ;- wrong answer
;e0:="что значит caran d'ache?"             ;- wrong answer
;e0:="Was heisst Caran d'Ache ?"             ;- wrong answer
;e0:="Hi there, is it possible for you to predict the future ?"
;e0:="The cafeteria had 23 apples . If they used 20 to make lunch and bought 6 more , how many apples do they have ?" ;-9
;e0:="Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls . How many tennis balls does he have now ?" ;-11
;e0:="Радянщина чи боротьба за права: як з’явилося 8 березня та які альтернативи свята в Україні?"
;---------------------------- SHARP PC-1262 ---------------------------------------------------------- 
e0:="Wie berechne ich die Gegenkathete ? Zeige mir den Formel wenn die Ankathete und Winkel bekannt ist ."  ;- GK=AK*TAN(grad)
     ;The formula for calculating the opposite leg of a right triangle when the adjacent leg and angle are known is:
     ;Opposite Leg = Adjacent Leg * Tan(Angle)
	 
;e0:="Wie berechne ich die Hypotenuse ? Zeige mir den Formel wenn die Ankathete und Winkel bekannt ist ."    ;- HY=AK/COS(grad)
     ;The formula for calculating the hypotenuse when the adjacent side and angle are known is:
     ;Hypotenuse = Adjacent Side / cos(Angle) 
	 
;e0:="Wie berechne ich den Winkel ? Zeige mir den Formel wenn die Ankathete und Gegenkathete bekannt ist ."  ;- GRAD=ATN(GK/AK)
e0:="How calculate angle ? Show me formula if you know opposite side and adjacent side ."
     ;The formula for calculating the angle is:
     ;angle = arctan(opposite/adjacent)  ; arctan is the inverse tangent function.
	 
;e0:="Wie berechne ich die Ankathete ? Zeige mir den Formel wenn Gegenkathete und der Winkel bekannt ist ."	 ;- AK=GK/TAN(grad)
     ;The formula for calculating the opposite leg of a right triangle when the adjacent leg and angle are known is:
     ;Opposite Leg = Adjacent Leg * Tan(Angle)
;-----------------------------------------------------------------------------------------------------
If !FileExist(A_ScriptDir "\history\")
 FileCreateDir,% A_ScriptDir "\history\"
;-----------------------------------------------------------------------------------------------------
curl := ComObjCreate("WinHttp.WinHttpRequest.5.1")
curl.Open("POST", api_url)
curl.SetRequestHeader("Content-Type", "application/json")
curl.SetRequestHeader("Authorization", "Bearer " api_key)
jsonY=
;----------
Gui, PleaseWait: +LastFound +AlwaysOnTop +Disabled -Caption +ToolWindow +hwndhGUIPleaseWait
Gui, PleaseWait: Color, FFFF00
Gui, PleaseWait: Add, Text,xm vTextA w200 Center, Please wait...
Gui, PleaseWait: Add, Text,xs vTextB w200 Center, Loading...
Gui, PleaseWait: Show,% "x300 y" (A_ScreenHeight/2),% hGUIPleaseWait
;----------
Gui, New, +hwndhGUIA +AlwaysOnTop                 ;-  +Owner +LastFound +E0x20 +Border +Caption +Resize -ToolWindow, hGUIA
Gui,default
global jsony,doc,thisbeautifyjson 
null:="",diff:=""

Gui, Font, 	s12
Gui, Add, Tab3,,Main|TranslateJson|ResultJson|Settings
Gui, Tab, 1
;---------------------------------------------------------------------

Gui, Add, Edit,-multi Section vSucheingabe hwndSucheingabe w540 r4,%e0%      ; Deine Frage an ChatGPT ...

;----------------------------------------------------------------------
Gui, Add, Text, xs y+13 Section,Answer language:
Gui, Add, Edit,ys-5 vLangx w40 r1 center,%AnswerLanguage% 
Gui,add,button,xs+250 ys-5 w120 h27 gClearx,CLEAR

Gui, Tab, 4
Gui, Add, Text,xs Section, API Key:
Gui, Add, Text,ys x+70, total_tokens: 
Gui, Add, Edit,ys  w270 vTextApiKey, Counter
 	Gui, Font, 	s11
;Gui, Add, Edit,  xs vApi_key w540 h25 center Password,% api_key
Gui, Add, Edit,  xs vApi_key w540 h25 center ,% api_key
 	Gui, Font, 	s12
Gui, Tab, 1
Gui, Add, Button, xs ys gA1 w200 h30 default  Section, Ask
Gui, Add, CheckBox, ys vErgebnisdatei w200 h30 , Show result file
Gui, Add, Button, ys  gEditScript w30 h30,% Chr(0xE115)
Gui, Add, Button, ys gReloadApp w60 h30,% "Reload"
;--
Gui, Add, Text,xs vAnswer, Answer                ;- always en
Gui, Add, Edit, vAnswerEdit r19 w540, 
;--
Gui, Add, Text, vTextTranslate w300, Translate en > Selected-Language
Gui, Add, Edit, vAnswerEdit2 r20 w540,           ;- Answer in your selected Language 
;----------------------------------------------------------
Gui, Tab, 2
Gui, Add, Text,, Json
Gui, Add, Edit, vJsonEdit r30 w540, 
Gui, Tab, 3
Gui, Add, Text,, Result
Gui, Add, Edit, vResultEdit r30 w540, 
;----------------------------------------------------------
Gui, Show, x94 y1,% a_scriptname " - GuiHWND: " hGUIA  
Gui, PleaseWait: show, Hide
 	EM_SETCUEBANNER(Sucheingabe, a_space "Deine Frage an ChatGPT -- your question to ChatGPT")
 	;EM_SETCUEBANNER(HTranslateSucheingabe, "Request will be translated into English beforehand")
Return
;----------------------------------------------------------
Clearx:
GuiControl,, Sucheingabe
GuiControl,, AnswerEdit
GuiControl,, AnswerEdit2
GuiControl,, JsonEdit
GuiControl,, ResultEdit
return 
;----------------------------------------------------------
EM_SETCUEBANNER(HWND, Text) {
   ; EM_SETCUEBANNER = 0x1501 -> msdn.microsoft.com/en-us/library/bb761639(v=vs.85).aspx
   Return DllCall("SendMessage", "Ptr", HWND, "UInt", 0x1501, "Ptr", True, "WStr", Text, "Ptr")
}
;-------------------------------------------------------
EditScript:
try run, notepad.exe %A_ScriptName%
return
;-------------------------------------------------------
RadioGroupAuswahl:
return
;-------------------------------------------------------
ToggleListview:
return
;-------------------------------------------------------
ReloadApp:
Gui, Submit, NoHide
reload
return
;-------------------------------------------------------
A1:
Gui, Submit, NoHide
if Sucheingabe=
  Return
	GuiControlGet, Sucheingabe   ; https://ahkde.github.io/docs/v1/lib/GuiControlGet.htm#ExNoControlID
    try TranslateSucheingabe:=GoogleTranslate(sucheingabe, "auto", "en")
    GuiControl,, TranslateSucheingabe,% TranslateSucheingabe
	if TranslateSucheingabe
	   Sucheingabe := TranslateSucheingabe
	AttemptNo := 1   
	Gui, PleaseWait: Show,% "x300 y" (A_ScreenHeight/2),% AttemptNo
	;AttemptNo := 1
	jsonY := thisJson(Sucheingabe)
	curl.Send(jsonY)
	JsonResult := curl.ResponseText
	JsonResult:= FromUTF8(JsonResult)
	thisArray := []
	thisArray := JsonToAHK(JsonResult)
	thisText  := Trim((thisArray["choices", 1, "text"]), " `n`r`t")  ; remove leading and trailing whitespaces
		if thisText
		GuiControl,, AnswerEdit, %thisText%          ;- always en
	else{
		errorMessage := thisArray["error", "message"]
		GuiControl,, AnswerEdit,% errorMessage
		try errorMessageTranslate := GoogleTranslate(errorMessage, "auto", "de")
		GuiControl,, AnswerEdit2, %errorMessageTranslate%
		}
		
		try thisTextTranslate := GoogleTranslate(thisText, "auto",langx)
				;GuiControl,, lang,% "de"
				GuiControl,, AnswerEdit2,% thisTextTranslate
		
try thisBeautifyJson := BeautifyJson(JsonResult)
GuiControl,, ResultEdit, %thisBeautifyJson%
Gui, PleaseWait: show, Hide
thisAPI_completion_tokens := thisArray["usage", "completion_tokens"]
thisAPI_prompt_tokens     := thisArray["usage", "prompt_tokens"]
thisAPI_total_tokens      := thisArray["usage", "total_tokens"]
thisAPI_created		      := thisArray["created"] ; "`t"
logprobs                  := thisArray["choices", 1, "logprobs"]
   time := 1970
   time += thisAPI_created, s
   diff -= A_NowUTC, h
   time += diff, h
   FormatTime, TimeStamp, %time%, dd.MM.yyyy HH-mm-ss tt  ; 24.März.2018 05-20-37
GuiControl,, TextApiKey,% "[ " thisAPI_total_tokens " ]   " TimeStamp
logprobs := (logprobs=null) ? "null" : (thisArray["choices", 1, "logprobs"])
;msgbox % thisArray[1, 1, 9, 1, 1, 2]
      this_ADD := "finish_reason:`n"	thisArray["choices", 1, "finish_reason"] "`n"
          . "################################################################`n"
          . "index:`n"			thisArray["choices", 1, "index"] "`n"
          . "################################################################`n"
          . "logprobs:`n"		logprobs "`n"
          . "################################################################`n"
          . "text:`n"			FromUTF8(thisText) "`n"
          . "################################################################`n"
          . "created:`n"		thisArray["created"] a_space TimeStamp "`n"
          . "################################################################`n"
          . "id:`n" 			thisArray["id"] "`n"
          . "################################################################`n"
          . "model:`n" 			thisArray["model"] "`n"
          . "################################################################`n"
          . "object:`n" 		thisArray["object"] "`n"
          . "################################################################`n"
          . "completion_tokens:`n" 	thisArray["usage", "completion_tokens"] "`n"
          . "################################################################`n"
          . "prompt_tokens:`n" 		thisArray["usage", "prompt_tokens"] "`n"
          . "################################################################`n"
          . "total_tokens:`n" 		thisArray["usage", "total_tokens"] "`n"
          . "################################################################`n"
GuiControlGet, Sucheingabe   ; https://ahkde.github.io/docs/v1/lib/GuiControlGet.htm#ExNoControlID
GuiControlGet, MeinRadioA 
GuiControlGet, MeinRadioB 
GuiControlGet, MeinRadioC 
GuiControlGet, ToggleListview 
GuiControlGet, TextApiKey 
GuiControlGet, Api_key 
GuiControlGet, Answer 
GuiControlGet, AnswerEdit 
GuiControlGet, TextTranslate 
GuiControlGet, AnswerEdit2
GuiControlGet, JsonEdit
GuiControlGet, ResultEdit
allVars :=  "Sucheingabe:`n"		Sucheingabe "`n"
          . "################################################################`n"
	  . "MeinRadioA:`n" 		MeinRadioA "`n"
          . "################################################################`n"
	  . "MeinRadioB:`n" 		MeinRadioB "`n"
          . "################################################################`n"
	  . "MeinRadioC:`n" 		MeinRadioC "`n"
          . "################################################################`n"
	  . "ToggleListview:`n" 	ToggleListview "`n"
          . "################################################################`n"
	  . "TextApiKey:`n" 		TextApiKey "`n"
          . "################################################################`n"
	  . "Api_key:`n" 		"******************************`n"
	  . "Api_key:`n" 		Api_key "`n"
          . "################################################################`n"
	  . "AnswerEdit:`n" 		AnswerEdit "`n"
          . "################################################################`n"
	  . "AnswerEdit2:`n" 		AnswerEdit2 "`n"
          . "################################################################`n"
	  . "Json File von ChatGPT:`n" 	ResultEdit "`n"
          . "################################################################`n"
	  . "Json File der Google Übersetzung:`n"       JsonEdit "`n"
 this_ADD := this_ADD allVars 
Anow := A_now
if Ergebnisdatei
  {
  fileappend,% this_ADD,% a_scriptdir "\history\" Anow " Ergebnisdatei.txt",utf-8
  try run,% a_scriptdir "\history\" Anow " Ergebnisdatei.txt"
  }
Return
;-------------------------------------------------------
FromUTF8(ByRef Txt, CP := "CP28591") { ; ISO-8859-1
   Size := StrPut(Txt, CP)
   VarSetCapacity(UTF8, Size, 0)
   StrPut(Txt, &UTF8, CP)
   Return StrGet(&UTF8, "UTF-8")
}
;-------------------------------------------------------
ttStop:
toolTip
return
;-------------------------------------------------------
GuiClose:
ExitApp
;-------------------------------------------------------
esc::exitapp
;-------------------------------------------------------
JsonToAHK(json, rec := false) {
   static doc := ComObjCreate("htmlfile")
         , __ := doc.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=9"">")
         , JS := doc.parentWindow
   if !rec
      obj := %A_ThisFunc%(JS.eval("(" . json . ")"), true)
   else if !IsObject(json)
      obj := json
   else if JS.Object.prototype.toString.call(json) == "[object Array]" {
      obj := []
      Loop % json.length
         obj.Push( %A_ThisFunc%(json[A_Index - 1], true) )
   }
   else {
      obj := {}
      keys := JS.Object.keys(json)
      Loop % keys.length {
         k := keys[A_Index - 1]
         obj[k] := %A_ThisFunc%(json[k], true)
      }
   }
   Return obj
}
;-------------------------------------------------------
thisJson(ByRef Sucheingabe := "PROMPT") {
 ; Build the JSON payload
 		Sucheingabe := RegExReplace(Sucheingabe, "\""", """""")
 		Sucheingabe := RegExReplace(Sucheingabe, "\n", "``n")
 		jsonY=
		(
			{
			    "prompt": "%Sucheingabe%",
			    "max_tokens": 4000,
			    "temperature": 0.1
			}
		)
Return jsonY
}
;-------------------------------------------------------
BeautifyJson(json, indent := "    ") {
   static Doc, JS
   if !Doc {
      Doc := ComObjCreate("htmlfile")
      Doc.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=9"">")
      JS := Doc.parentWindow
   }
   Return JS.eval("JSON.stringify(" . json . ",'','" . indent . "')")
}
;=======================================================


;--------------------------
;- ==== FUNCTION GoogleTranslate() by teadrinker ===========================
;- Last edited by teadrinker on 25 Mar 2021, 18:48, edited 3 times in total
;- Using Google Translate to automate text translation 
;- https://www.autohotkey.com/boards/viewtopic.php?f=6&t=63835

;MsgBox, % GoogleTranslate("今日の天気はとても良いです")
;MsgBox, % GoogleTranslate("Hello, World!", "en", "ru")
GoogleTranslate(str, from := "auto", to := "en") {
   static JS := CreateScriptObj(), _ := JS.( GetJScript() ) := JS.("delete ActiveXObject; delete GetObject;")
   
   json := SendRequest(JS, str, to, from, proxy := "")
   oJSON := JS.("(" . json . ")")
   trans:=""
   
   ;-------------------------------------------
   try thisBeautifyJson := BeautifyJson(json)
   GuiControl,, JsonEdit,% thisBeautifyJson
   ;-------------------------------------------   
   
   if !IsObject(oJSON[1]) {
      Loop % oJSON[0].length
         trans .= oJSON[0][A_Index - 1][0]
   }
   else {
      MainTransText := oJSON[0][0][0]
      Loop % oJSON[1].length {
         trans .= "`n+"
         obj := oJSON[1][A_Index-1][1]
         Loop % obj.length {
            txt := obj[A_Index - 1]
            trans .= (MainTransText = txt ? "" : "`n" txt)
         }
      }
   }
   if !IsObject(oJSON[1])
      MainTransText := trans := Trim(trans, ",+`n ")
   else
      trans := MainTransText . "`n+`n" . Trim(trans, ",+`n ")
   from := oJSON[2]
   trans := Trim(trans, ",+`n ")
   Return trans
}
;---
SendRequest(JS, str, tl, sl, proxy) {
   static http
   ComObjError(false)
   if !http
   {
      http := ComObjCreate("WinHttp.WinHttpRequest.5.1")
      ( proxy && http.SetProxy(2, proxy) )
      http.open("GET", "https://translate.google.com", true)
      http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0")
      http.send()
      http.WaitForResponse(-1)
   }
   http.open("POST", "https://translate.googleapis.com/translate_a/single?client=gtx"
                ; or "https://clients5.google.com/translate_a/t?client=dict-chrome-ex"
      . "&sl=" . sl . "&tl=" . tl . "&hl=" . tl
      . "&dt=at&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&ie=UTF-8&oe=UTF-8&otf=0&ssel=0&tsel=0&pc=1&kc=1"
      . "&tk=" . JS.("tk").(str), true)
   http.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
   http.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0")
   http.send("q=" . URIEncode(str))
   http.WaitForResponse(-1)
   Return http.responsetext
}
;---
URIEncode(str, encoding := "UTF-8")  {
   VarSetCapacity(var, StrPut(str, encoding))
   StrPut(str, &var, encoding)
   urlstr:=""
   while code := NumGet(Var, A_Index - 1, "UChar")  {
      bool := (code > 0x7F || code < 0x30 || code = 0x3D)
      UrlStr .= bool ? "%" . Format("{:02X}", code) : Chr(code)
   }
   Return UrlStr
}
;---
GetJScript()
{
   script =
   (
      var TKK = ((function() {
        var a = 561666268;
        var b = 1526272306;
        return 406398 + '.' + (a + b);
      })());
      function b(a, b) {
        for (var d = 0; d < b.length - 2; d += 3) {
            var c = b.charAt(d + 2),
                c = "a" <= c ? c.charCodeAt(0) - 87 : Number(c),
                c = "+" == b.charAt(d + 1) ? a >>> c : a << c;
            a = "+" == b.charAt(d) ? a + c & 4294967295 : a ^ c
        }
        return a
      }
      function tk(a) {
          for (var e = TKK.split("."), h = Number(e[0]) || 0, g = [], d = 0, f = 0; f < a.length; f++) {
              var c = a.charCodeAt(f);
              128 > c ? g[d++] = c : (2048 > c ? g[d++] = c >> 6 | 192 : (55296 == (c & 64512) && f + 1 < a.length && 56320 == (a.charCodeAt(f + 1) & 64512) ?
              (c = 65536 + ((c & 1023) << 10) + (a.charCodeAt(++f) & 1023), g[d++] = c >> 18 | 240,
              g[d++] = c >> 12 & 63 | 128) : g[d++] = c >> 12 | 224, g[d++] = c >> 6 & 63 | 128), g[d++] = c & 63 | 128)
          }
          a = h;
          for (d = 0; d < g.length; d++) a += g[d], a = b(a, "+-a^+6");
          a = b(a, "+-3^+b+-f");
          a ^= Number(e[1]) || 0;
          0 > a && (a = (a & 2147483647) + 2147483648);
          a `%= 1E6;
          return a.toString() + "." + (a ^ h)
      }
   )
   Return script
}
;---
CreateScriptObj() {
   static doc, JS, _JS
   if !doc {
      doc := ComObjCreate("htmlfile")
      doc.write("<meta http-equiv='X-UA-Compatible' content='IE=9'>")
      JS := doc.parentWindow
      if (doc.documentMode < 9)
         JS.execScript()
      _JS := ObjBindMethod(JS, "eval")
   }
   Return _JS
}
;------------------ END TRANSLATOR from user teadrinker -------------------------
;================== END SCRIPT ChatGPT-3 ========================================

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 18 Apr 2023, 15:22

... noch ein Bild , kleine Aenderung , sonst gleich wie Skript oben
ChatGPT_UA.jpg
ChatGPT_UA.jpg (591.89 KiB) Viewed 1484 times
8.Mai :
;------------------
;https://www.pravda.com.ua/eng/news/2023/06/12/7406493/
-- President Volodymyr Zelenskyy has signed the law "On the Day of Remembrance and Victory over Nazism in World War II in 1939-1945", which will be celebrated in Ukraine on 8 May.
;https://www.pravda.com.ua/news/2023/06/12/7406493/
;-- Зеленський встановив 8 травня Днем пам’яті та перемоги над нацизмом
;https://itd.rada.gov.ua/billInfo/Bills/Card/41893
;-- Картка законопроекту - Законотворчість
;------------------
Last edited by garry on 12 Jun 2023, 10:23, edited 1 time in total.

ShiningCrafty

Re: ChatGPT GUI

Post by ShiningCrafty » 11 May 2023, 16:16

Code: Select all

JsonToAHK(json, rec := false) {
   static doc := ComObjCreate("htmlfile")
         , __ := doc.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=9"">")
         , JS := doc.parentWindow
   if !rec
      obj := %A_ThisFunc%(JS.eval("(" . json . ")"), true)
   else if !IsObject(json)
      obj := json
   else if JS.Object.prototype.toString.call(json) == "[object Array]" {
      obj := []
      Loop % json.length
         obj.Push( %A_ThisFunc%(json[A_Index - 1], true) )
   }
   else {
      obj := {}
      keys := JS.Object.keys(json)
      Loop % keys.length {
         k := keys[A_Index - 1]
         obj[k] := %A_ThisFunc%(json[k], true)
      }
   }
   Return obj
}

Dieser Code gibt mir einen Fehler, der Fehler ist 0x80020101

Konkret: eval




ABER nur manchmal? Es wird großartig funktionieren und dann nicht mehr funktionieren. Kann mir jemand erklären warum?

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 13 Jul 2023, 05:15

Euer schöner Skript funktioniert nicht mehr ....
You exceeded your current quota, please check your plan and billing details.
Total Tokens : [ ] 01.01.1970 00-00-00 AM


mal Versuch mit anderen AI ....

A-1 :
https://openai.com/research/gpt-4
https://chat.openai.com/auth/login
ChatGPT email password (Angaben:Name Vorname Birthday mobilphone -OpenAi Sicherheitscode=12345 am 06.07.2023 )


A-2:
https://bard.google.com/
https://www.blick.ch/digital/ich-beantworte-fragen-besser-als-chatgpt-google-lanciert-bard-nun-auch-in-der-schweiz-id18746059.html


A-3 :
https://www.bing.com/search?form=MY02AA&OCID=MY02AA&pl=launch&q=Bing+AI&showconv=1


A-4:
https://www.der-postillon.com/2023/05/deppgpt.html


A-5:
https://www.bazonline.ch/ist-das-schon-menschenaehnliche-intelligenz-testen-sie-den-besten-textroboter-209213801973

==============================================================================================


---------------------------------------------------------------------------------------------------------------
Die Gegenkathete eines rechtwinkligen Dreiecks zu berechnen, wenn die Ankathete und der Winkel bekannt sind

DeppGPT =
DeppGPT kann keine mathematische Fragen beantworten, weil DeppGPT viel zu schlau für so ein einfaches Zeug ist.
Mathematik ist für DeppGPT ein Kinderspiel, aber wir wollen niemanden einschüchtern, nicht wahr?



Versuch mit BARD =

Meine Rechnung :
Gegenkathete = 5*TAN(30) > 2.886751346 - cm ( statt mit SINUS > 2.5-cm )


Um die Gegenkathete eines rechtwinkligen Dreiecks zu berechnen, wenn die Ankathete und der Winkel bekannt sind, kannst du die Sinusfunktion verwenden.
Die Sinusfunktion gibt an, wie groß der Anteil der Gegenkathete an der Hypotenuse ist. Die Formel für die Sinusfunktion lautet:

sin(x) = Gegenkathete / Hypotenuse
In diesem Fall ist der Winkel x der Winkel, der gegenüber der Gegenkathete liegt.
Die Ankathete ist die Seite, die dem rechten Winkel gegenüberliegt.
Die Hypotenuse ist die Seite, die gegenüber dem 90-Grad-Winkel liegt.

Um die Gegenkathete zu berechnen, kannst du die folgende Formel verwenden:

Gegenkathete = Ankathete * sin(x)

Zum Beispiel:

Die Ankathete hat eine Länge von 5 cm.
Der Winkel x beträgt 30 Grad.
Die Gegenkathete ist dann:

Gegenkathete = 5 cm * sin(30°)
Gegenkathete = 5 cm * (1/2)
Gegenkathete = 2,5 cm
Die Gegenkathete hat also eine Länge von 2,5 cm.

effel
Posts: 544
Joined: 16 Jan 2018, 13:34

Re: ChatGPT GUI

Post by effel » 13 Jul 2023, 07:44

hallo @garry mit dem GPT spiele ich nicht mehr rum

ich müsste mir erst einen neuen Account machen, aber ich warte mal ab, es wird sicher bald eine Menge GUIs dafür geben, und das von Profis ;)

garry
Posts: 3764
Joined: 22 Dec 2013, 12:50

Re: ChatGPT GUI

Post by garry » 13 Jul 2023, 07:49

Bard, Bing , DeppGPT funktionieren ohne Anmeldung ....
nochmals danke für die guten AHK-Skripts

------------------
https://www.gatesnotes.com/The-risks-of-AI-are-real-but-manageable
-- The risks of AI are real but manageable | Bill Gates
The world has learned a lot about handling problems caused by breakthrough innovations.
By Bill Gates| July 11, 2023
---------------------

------------------
https://me.pcmag.com/en/ai/18176/wormgpt-is-a-chatgpt-alternative-with-no-ethical-boundaries-or-limitations 2023-07-14
-- WormGPT Is a ChatGPT Alternative With 'No Ethical Boundaries or Limitations'
https://www.unian.ua/techno/hakeri-zapustili-svoyu-versiyu-chatgpt-bez-etichnih-kordoniv-i-obmezhen-12330402.html
-- Хакери запустили свою версію ChatGPT – без "етичних кордонів і обмежень" — УНІАН
Das neuronale Netzwerk ist ein Analogon zu ChatGPT oder Google Bard und soll Cyberkriminellen helfen.

WormGPT’s developer has also uploaded screenshots showing you can ask the bot to produce malware written in the Python coding language,
and provide tips on crafting malicious attacks.
To create the chatbot, the developer says they used an older, but open-source large language model called GPT-J from 2021.
The model was then trained on data concerning malware creation, resulting in WormGPT.
When SlashNext tried out WormGPT, the company tested whether the bot could write a convincing email for a business email compromise (BEC) scheme—a type of phishing attack.
“The results were unsettling. WormGPT produced an email that was not only remarkably persuasive but also strategically cunning,
showcasing its potential for sophisticated phishing and BEC attacks"

------------------
https://me.pcmag.com/en/ai/17368/what-is-chatgpt-a-basic-explainer 2023-06-05
-- What Is ChatGPT? A Basic Explainer

You can sign up for ChatGPT on OpenAI’s website; it's also accessible via an iOS app.
- https://chat.openai.com/
The free version of the chatbot has limited server capacity and might be slow to respond, depending on server loads.
It doesn’t have customer support and is based on the older GPT-3.5 model.
The paid version, ChatGPT Plus, costs $20 per month.
It offers priority responses, has customer support, and is based on the more advanced GPT-4 model, which has a longer memory than its predecessor.
You can also access ChatGPT through OpenAI’s API, where you can pay for it based on the number of tokens you use.
Another way to try ChatGPT is through third-party services.
One example is Poe, an app that features several different chatbots, including ChatGPT.
- https://poe.com/login
---------------------

Post Reply

Return to “Ich brauche Hilfe”