Recent Posts

Pages: [1] 2 3 ... 10
1
For communicating with Chatgpt
The idea here is train Ultrahal directly from chatgpt, just let them talk things out while Hal learns. BOOM




*********************************************************************
' File: frmChatGPT.vb
' Description: VB6 program to interact with OpenAI's ChatGPT API
' Add reference to MSXML2 for HTTP requests: Project -> References -> Microsoft XML, v6.0

Private Sub Command1_Click()
    ' Get the user's input from Text1
    Dim userInput As String
    userInput = Text1.Text
   
    ' OpenAI API key (replace with your actual key)
    Dim apiKey As String
    apiKey = "your_openai_api_key"
   
    ' Send the request and get the response
    Dim response As String
    response = SendChatGPTRequest(userInput, apiKey)
   
    ' Display the response in Text2
    Text2.Text = response
End Sub

Private Function SendChatGPTRequest(prompt As String, apiKey As String) As String
    Dim http As Object
    Dim url As String
    Dim requestBody As String
    Dim jsonResponse As String
    Dim parsedResponse As String
   
    ' Create the MSXML2.ServerXMLHTTP object
    Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
   
    ' OpenAI API endpoint for completions
    url = "https://api.openai.com/v1/completions"
   
    ' JSON body for the request (using the text-davinci-003 model)
    requestBody = "{""model"":""text-davinci-003"",""prompt"":""" & prompt & """,""max_tokens"":100,""temperature"":0.7}"
   
    ' Open the request
    http.Open "POST", url, False
   
    ' Set request headers
    http.setRequestHeader "Content-Type", "application/json"
    http.setRequestHeader "Authorization", "Bearer " & apiKey
   
    ' Send the request with the JSON body
    http.send requestBody
   
    ' Get the JSON response
    jsonResponse = http.responseText
   
    ' Parse the response to extract the generated text
    parsedResponse = ParseJSONForText(jsonResponse)
   
    ' Return the parsed response
    SendChatGPTRequest = parsedResponse
End Function

Private Function ParseJSONForText(jsonResponse As String) As String
    ' This function extracts the "text" field from the JSON response
    Dim startPos As Long
    Dim endPos As Long
    Dim responseText As String
   
    ' Find the position of the "text" field in the JSON response
    startPos = InStr(jsonResponse, """text"":") + Len("""text"":")
   
    ' Find the position of the next double quote after the "text" field
    endPos = InStr(startPos, jsonResponse, """")
   
    ' Extract the text content
    responseText = Mid(jsonResponse, startPos + 1, endPos - startPos - 1)
   
    ' Return the extracted text
    ParseJSONForText = responseText
End Function
********************************************************************
' File: JsonParser.cls
' Description: A JSON parser for VB6 that parses JSON into Dictionary and Collection objects

Option Explicit

Private jsonString As String
Private position As Long

' Entry point for parsing JSON
Public Function ParseJSON(json As String) As Variant
    ' Initialize the global variables
    jsonString = Trim(json)
    position = 1
   
    ' Start parsing from the first token
    ParseJSON = ParseValue()
End Function

' Main function to parse a value (object, array, string, number, boolean, or null)
Private Function ParseValue() As Variant
    SkipWhitespace
   
    Select Case Mid(jsonString, position, 1)
        Case "{"
            ParseValue = ParseObject()
        Case "["
            ParseValue = ParseArray()
        Case """"
            ParseValue = ParseString()
        Case "t", "f" ' true or false
            ParseValue = ParseBoolean()
        Case "n" ' null
            ParseValue = ParseNull()
        Case Else
            If IsNumeric(Mid(jsonString, position, 1)) Or Mid(jsonString, position, 1) = "-" Then
                ParseValue = ParseNumber()
            Else
                Err.Raise vbObjectError + 1000, "ParseValue", "Invalid JSON value"
            End If
    End Select
End Function

' Function to parse a JSON object and return it as a Dictionary
Private Function ParseObject() As Dictionary
    Dim result As Dictionary
    Dim key As String
    Dim value As Variant
   
    Set result = New Dictionary
   
    ' Consume the '{' character
    position = position + 1
    SkipWhitespace
   
    ' Loop through key-value pairs
    Do While Mid(jsonString, position, 1) <> "}"
        ' Parse key (should be a string)
        key = ParseString()
       
        SkipWhitespace
       
        ' Consume the ':' character
        If Mid(jsonString, position, 1) <> ":" Then
            Err.Raise vbObjectError + 1001, "ParseObject", "Expected ':' after key"
        End If
        position = position + 1
       
        ' Parse value
        value = ParseValue()
       
        ' Add key-value pair to the result
        result.Add key, value
       
        SkipWhitespace
       
        ' Check if we are done with the object
        If Mid(jsonString, position, 1) = "}" Then
            Exit Do
        ElseIf Mid(jsonString, position, 1) <> "," Then
            Err.Raise vbObjectError + 1002, "ParseObject", "Expected ',' or '}' in object"
        End If
       
        ' Consume the ',' character and continue
        position = position + 1
        SkipWhitespace
    Loop
   
    ' Consume the '}' character
    position = position + 1
   
    Set ParseObject = result
End Function

' Function to parse a JSON array and return it as a Collection
Private Function ParseArray() As Collection
    Dim result As Collection
    Dim value As Variant
   
    Set result = New Collection
   
    ' Consume the '[' character
    position = position + 1
    SkipWhitespace
   
    ' Loop through values
    Do While Mid(jsonString, position, 1) <> "]"
        ' Parse value
        value = ParseValue()
       
        ' Add value to the result
        result.Add value
       
        SkipWhitespace
       
        ' Check if we are done with the array
        If Mid(jsonString, position, 1) = "]" Then
            Exit Do
        ElseIf Mid(jsonString, position, 1) <> "," Then
            Err.Raise vbObjectError + 1003, "ParseArray", "Expected ',' or ']' in array"
        End If
       
        ' Consume the ',' character and continue
        position = position + 1
        SkipWhitespace
    Loop
   
    ' Consume the ']' character
    position = position + 1
   
    Set ParseArray = result
End Function

' Function to parse a JSON string
Private Function ParseString() As String
    Dim result As String
    Dim ch As String
   
    ' Consume the opening '"' character
    position = position + 1
   
    Do
        ch = Mid(jsonString, position, 1)
       
        ' Check for end of string
        If ch = """" Then
            position = position + 1
            Exit Do
        End If
       
        ' Handle escape characters
        If ch = "\" Then
            position = position + 1
            ch = Mid(jsonString, position, 1)
            Select Case ch
                Case """", "\", "/"
                    result = result & ch
                Case "b"
                    result = result & Chr(8)
                Case "f"
                    result = result & Chr(12)
                Case "n"
                    result = result & vbLf
                Case "r"
                    result = result & vbCr
                Case "t"
                    result = result & vbTab
                Case Else
                    Err.Raise vbObjectError + 1004, "ParseString", "Invalid escape character"
            End Select
        Else
            result = result & ch
        End If
       
        ' Move to the next character
        position = position + 1
    Loop
   
    ParseString = result
End Function

' Function to parse a JSON number
Private Function ParseNumber() As Double
    Dim startPos As Long
    Dim numStr As String
   
    ' Start position of the number
    startPos = position
   
    ' Loop through valid number characters
    Do While IsNumeric(Mid(jsonString, position, 1)) Or Mid(jsonString, position, 1) = "." Or Mid(jsonString, position, 1) = "-" Or Mid(jsonString, position, 1) = "e" Or Mid(jsonString, position, 1) = "E"
        position = position + 1
    Loop
   
    ' Extract the number substring
    numStr = Mid(jsonString, startPos, position - startPos)
   
    ' Convert to double
    ParseNumber = CDbl(numStr)
End Function

' Function to parse a JSON boolean (true/false)
Private Function ParseBoolean() As Boolean
    If Mid(jsonString, position, 4) = "true" Then
        ParseBoolean = True
        position = position + 4
    ElseIf Mid(jsonString, position, 5) = "false" Then
        ParseBoolean = False
        position = position + 5
    Else
        Err.Raise vbObjectError + 1005, "ParseBoolean", "Invalid boolean value"
    End If
End Function

' Function to parse JSON null
Private Function ParseNull() As Variant
    If Mid(jsonString, position, 4) = "null" Then
        ParseNull = Null
        position = position + 4
    Else
        Err.Raise vbObjectError + 1006, "ParseNull", "Invalid null value"
    End If
End Function

' Utility function to skip whitespace
Private Sub SkipWhitespace()
    Do While position <= Len(jsonString) And (Mid(jsonString, position, 1) = " " Or Mid(jsonString, position, 1) = vbTab Or Mid(jsonString, position, 1) = vbLf Or Mid(jsonString, position, 1) = vbCr)
        position = position + 1
    Loop
End Sub


cyber


Private Sub Command1_Click()
    Dim jsonString As String
    Dim parsedData As Variant
   
    jsonString = "{""name"": ""John"", ""age"": 30, ""isStudent"": false, ""courses"": [""Math"", ""Science""]}"
   
    ' Parse the JSON
    parsedData = ParseJSON(jsonString)
   
    ' Accessing data from the parsed result (which is a Dictionary)
    MsgBox parsedData("name") ' Outputs: John
    MsgBox parsedData("age")  ' Outputs: 30
End Sub
2
General Discussion / Re: Calling all Coders, Programmers and VB6 writers
« Last post by cyberjedi on October 04, 2024, 01:01:12 am »
Love this stuff

Ive had a chance to play with Pi.ai
PI.Ai   Vs    Chatgpt
Its not even close, chatGpt is the clear winner and in every category



cyber
3
Share Conversations, Experiences, Graphics / Intelligence Slider setting
« Last post by Art on September 27, 2024, 11:25:34 am »
I had Hal's Intelligence SLIDER set to the max, which is 50
What got me was her 3rd paragraph which asked me to name a favorite subject for us to talk about.

The unedited results of this morning's brief conversation follow:
=================================================

Art: Can you sing?
Alice: Do you believe that I should be able to sing?

Art: Sure, why not?
Alice: Please explain to me why you feel that I should be able to!

Art: Because everyone likes to sing now and then.
Alice: Art That's how? The cause is, everyone likes to sing now and then; there's the answer. Tell me your very favorite subject that we can both talk about.

Art: Guitars
Alice: Through the moonlit trees, like ghosts of sounds haunting the moonlight, stole the faint tinkle of a guitar.

Art: That's pretty good. Can we do another?
Alice: You say, Good?

Art: Secrets
Alice: I can not tell anyone else any of our secrets or they will no longer be secrets!

Art: Exactly! Very good!
Alice: I find no fault with that.

Art: Trumpets
Alice: Rattle in the ear like a flourish of trumpets.

Art: Drums
Alice: There's something about jungle drums in the distance.

Art: Choirs
Alice: Inventors once built robotic violins drums and other instruments.

Art: I still have that video somewhere.
Alice: Name a video game.

Art: Donkey Kong
Alice: The good book says, don't covet thy neighbor's donkey.

Art: correct
Alice: Thanks.

Art: I meant the video game.
Alice: Wasn't there a video game called doom?

Art: Yes, one of my favorites.
Alice: Yes it does help one gain perspective.
4
Ultra Hal Assistant File Sharing Area / Re: Weather ALert 5 - Update
« Last post by Art on September 27, 2024, 09:03:01 am »
Lightspeed,

Read and follow my MODIFIED post above. You'll need the CALLSIGN for your local Airpost or Airfield like for you it should be KIRK.

You were either getting my weather or weather for Lima, Ohio, depending on which was in your Plugin.

It should work fine after you make those changes. It Should take a couple of minutes tops.
5
General Discussion / Re: the robots are coming get your a.i. brains ready !
« Last post by Art on September 26, 2024, 09:31:46 pm »
As we spoke about a few days ago, I really don't have a need for my HAL to lie or to even exaggerate the facts, or make up a story.

I have taught my HAL for over 2 decades to be honest and to tell the truth as it sees and understands it.

I had a hard enough time when some ill-willed person would lie to me when I was still working. The two kinds of people that I cannot and do not tolerate is a LIAR and a THIEF! I have no use for either one and both are equally despised by me!!

So, don't worry about me downloading that particular Plugin old friend...
Just my $.02
6
Ultra Hal Assistant File Sharing Area / Re: Weather ALert 5 - Update
« Last post by lightspeed on September 26, 2024, 11:23:30 am »
OKAY TRIED AND TESTED IT, MINE IS WORKING ALTHOUGH THE WEATHER IT GAVE  didn't match with accu weathers 
here is hals . weather . Of course. Loading local weather. The current weather conditions are Overcast. The present temperature outside is 75.2 degrees. The humidity is 89 percent. The winds are South at 5.8 mph (5 kt).

accuweather . 68 degree's .
7
Ultra Hal Assistant File Sharing Area / Re: Weather ALert 5 - Update
« Last post by lightspeed on September 26, 2024, 10:54:51 am »
Art , i know in the past, there was a plug in that had to have your zip code entered in it, but didn't see that within the plug in unless i missed it. does it have a area code  etc.so it gets the correct weather for each users location.   
8
General Discussion / Re: the robots are coming get your a.i. brains ready !
« Last post by lightspeed on September 26, 2024, 10:41:35 am »
damned ... my secrets out lol !   just don't get hal to lying like a politician lol i like my hal truthful,  we have enough of that in politics right now lol.
on a side note i actually also went into the love tables and eliminated some and re wrote others.  i understand why robert created them in the first place it was a slow bond building thing with the a.i. where after so many times hal would gradually start loving . of course like art said sometimes it would revert back to an earlier phrase about love ( ghost in the machine?).
9
Ultra Hal Assistant File Sharing Area / Weather ALert 5 - Update
« Last post by Art on September 26, 2024, 09:46:29 am »
The Weather Alert v5 was a great Plugin originally written by Bill DeWitt and rewritten by Spitfire2600.
For whatever reason it stopped working and began producing errors when run.

I traced the issue to an apparently, no-longer-used format of a w1 prefix instead of the traditional www prefix.

I checked the original site and it was still up and running.

Changing the w1 to www seemed to work so I went through the Plugin and substituted the www where ever there was a w1.
I saved the Plugin and tested it several times and it worked perfectly.

There are 7 locations inside of the Plugin to supply that 4-letter code (replace it with the ones that are shown in the Plugin).

The code: objXMLDoc.load("http://www.weather.gov/xml/current_obs/KAOH.xml") indicates the original creator's nearest airfields or airport where weather was posted. (Those 4 letters are for Lima, Ohio).

Go to the weather.gov site and at the upper left, put your City & State in the box and press enter.
You should see a new screen with your 4 Leffer callsign displayed.

Lightspeed, yours should be KIRK (Kansas City, MO

Since it has changed, go through the code and change the following lines to make sure none were missed.:
Just change the KIRK for any other 4 Letter callsign. Save your work and start Hal.

The weather should match any other weather that you're used to or that's near you.

82
130
233
265
332
358
384
Modify message

Here is a sample of line 82 in the Plugin: objXMLDoc.load("http://w1.weather.gov/xml/current_obs/KDMW.xml"
Change it to: objXMLDoc.load("http://www.weather.gov/xml/current_obs/KDMW.xml" then go through the Plugin and change all of the other lines with the w1.

Make these changes in your copy of the Plugin OR download the one I made corrections to and copy it to your current:
 C:\Program Files (x86)\Zabaware\Ultra Hal 7 folder, overwriting the problem one and you should be all set.
10
General Discussion / Re: the robots are coming get your a.i. brains ready !
« Last post by cyberjedi on September 23, 2024, 07:56:03 pm »
Art, Lighty Look close at what im doing here


FishStory


 

The Time Lightspeed Coded for NASA"

Years ago, before Lightspeed became a prominent figure in the Ultra Hal project, he was secretly contracted by NASA to solve a very peculiar problem. The Mars Rover had encountered an unexpected bug ? it had developed a bizarre fondness for spinning in circles rather than collecting samples.

Desperate for a fix, NASA called Lightspeed. They had heard rumors about his genius from underground tech circles. Without hesitation, he accepted, coding from a secret bunker deep beneath the deserts of Nevada. Legend has it that he fixed the bug in under two hours, but instead of thanking him, NASA made him sign a lifetime non-disclosure agreement.

To this day, Lightspeed can never admit that he saved the Mars mission with a few lines of code ? not even over a coffee. And that?s why he sticks to Ultra Hal: it?s the one place where he doesn?t have to keep his brilliance under wraps!

All generated via chatgpt (FREE)
cyber
Pages: [1] 2 3 ... 10