News for hackers. Stuff that matters.

dialupdotnet

Re:Show HN: WinGPT, AI Assistant for Windows 3.1 on Monday June 26, 2023 @11:41AM (#36481221)
That's a great idea. Please do give it a try!
Re:Show HN: WinGPT, AI Assistant for Windows 3.1 on Monday June 26, 2023 @01:10AM (#36475952)
Yep! I'm using JSMN (https://github.com/zserge/jsmn), which is a streaming parser that visits each token sequentially, so there's only one copy of each JSON response in memory. I also avoid allocating new intermediate memory whenever possible; for example, to unescape backslashes in the JSON strings, I use a destructive loop that moves the non-backslash characters forward in memory, and truncates the string by moving the null terminator earlier in the string. Not something I'd imagine doing in most environments today, but as you said, it saves a bit of space at the expense of CPU time :)

  void DestructivelyUnescapeStr(LPSTR lpInput) {
    int offset = 0;
    int i = 0;
    while (lpInput[i] != '\0') {
      if (lpInput[i] == '\\') {
        offset++;
      } else {
        lpInput[i - offset] = lpInput[i];
      }
      i++;
    }
    lpInput[i - offset] = '\0';
  }
Re:Show HN: WinGPT, AI Assistant for Windows 3.1 on Sunday June 25, 2023 @11:00PM (#36475246)
Good idea :) Clippy is Office 97 and later though, so I'll need to make a version that fits in with the Windows 95/98 (or even Windows Me) look!
Re:Show HN: WinGPT, AI Assistant for Windows 3.1 on Sunday June 25, 2023 @10:43PM (#36475132)
Thanks! :)
Re:Show HN: WinGPT, AI Assistant for Windows 3.1 on Sunday June 25, 2023 @10:40PM (#36475103)
Yep, I've hardcoded a "system" message that tells ChatGPT to answer in the present tense as if it's 1992, and to make no reference to the current year. It does still slip up and mention the year as mitchdoogle experienced, but it's pretty good most of the time - even with complex questions like asking how many countries there are in NATO.

Show HN: WinGPT, AI Assistant for Windows 3.1

https://www.dialup.net/wingpt/

Hey HN, I didn't want my Gateway 4DX2-66 from 1993 to be left out of the AI revolution, so I built an AI Assistant for Windows 3.1, based on the OpenAI API.The most interesting parts of building this were:- Getting TLS 1.2 and 1.3 working on Windows 3.1 so that WinGPT could directly connect to OpenAI's server without relying on a modern machine for TLS termination.- Learning about the memory...

( Read More... | 90 comments | 2 points | on HN )