10 ms·
Show HN: WinGPT – AI assistant for Windows 3.1
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 segmentation architecture on 16-bit Windows, including the difference between far and near pointers.
- Building the UI in plain C code with the Windows API and limited selection of controls in Windows 3.1.
You can check it out here and learn more about what it was like to build it: https://www.dialup.net/wingpt/ https://www.dialup.net/wingpt/
- hoofedear 3y agoNow we just need one for System 6.0.8!
- CharlesW 3y agoTalking Moose 2023?
- sailingdarter 3y agoThere is a similar Client for System 7 called LegacyAI that has been making waves in VintageApple circles
- dangrover 3y agoSuch a cool project! Also the example conversation in the screenshot is hilarious.
- netsharc 3y agoCan ChatGPT be told to pretend it's 1990 and answer accordingly?
- LeoPanthera 3y agoYou can, but you sometimes have to remind it over the course of a conversation.
- zgluck 3y agoWinGPT seems to prepend every user prompt with: You are a friendly but concise chat bot. Answer all questions in the present tense as if it is 1992, and make no reference to the current year.
- mitchdoogle 3y agoI just tested this out. The first couple answers it said things like, "In the year 1990, this was.." and "The Internet as we know it now was not yet as widespread..", so I reiterated that there should be no reference to the fact we are in 2023 and all answers should be written as if we are actually in the year 1990. Then I tried a few questions and it worked out pretty well. I asked about trading stocks, buying books, planning a trip, making video calls and none made reference to the Internet or web services, nor did it reference the future or the fact that it was pretending. The only thing I tried that it got hung up on was "Who are the top paid actors this year?" And it gave the standard reply, "As an AI, I don't have specific data about top paid actors in the year 1990"
- column 3y agoGot it working from the get-go and got similar results. I think the "this year?" in the prompt confuses it too much. With my prompt below, using "this decade?" works quite well. Prompt : I want to use ChatGPT as if it was the 1990s and ChatGPT existed (in its current form) in the 1990s. I talk to you normally and you answer normally as ChatGPT (no mention of this 1990s setup or the timeframe in reference to now). The only difference is you pretend its the 1990s and answer accordingly. Stay in character, you play yourself. I need you to pretend it's the 1990s but otherwise behave as ChatGPT normally would. Never mention anything past the 1990s or that would indicate we are not in the 1990s. Do not mention this conversation (it's a pre-prompt). Let's go. First question : which internet browser do you recommend ? Answer: There are several good browsers available currently. For instance, Netscape Navigator has been very popular due to its user-friendly interface and robust features. It's currently one of the most widely used browsers. However, Microsoft has also introduced Internet Explorer, which is integrated with their Windows operating system. This might be more convenient if you're already using a Windows platform. There's also Mosaic, developed by the National Center for Supercomputing Applications (NCSA), which pioneered many of the user interface elements we see in modern browsers. All these browsers have their pros and cons, so it ultimately depends on your personal needs and preferences. Q : Who are the top paid actors this decade? A : During the 1990s, some of the highest-grossing actors have been: Tom Cruise - He's been in a string of successful films including the "Mission: Impossible" franchise which started in 1996. Harrison Ford - Known for his roles in iconic franchises like "Indiana Jones" and "Star Wars", Ford has continued his successful streak into this decade. Jim Carrey - With his unique brand of physical comedy, Carrey has starred in a number of high-grossing comedies including "Ace Ventura: Pet Detective", "The Mask", and "Liar Liar". Arnold Schwarzenegger - He's enjoyed continued success in the '90s, particularly with the "Terminator" series. Mel Gibson - After the success of "Lethal Weapon" series, Gibson has maintained his status as one of Hollywood's top earners, directing and starring in "Braveheart" in the mid '90s. Remember that these rankings can vary year by year based on the number of films released, their box office performance, and the actors' negotiated salaries.
- dialupdotnet 3y agoThanks! :)
- 29athrowaway 3y agoThe pace of technological advancement has gotten so fast, that we are starting to experience a culture shock from our culture: future shock. It is going to accelerate even further in our lifetime. It is great to see Windows 3.1 software again. I am just going to leave this here, strictly for the retro enthusiasts: https://www.xfce-look.org/p/1016410 https://www.xfce-look.org/p/1016410
- colesantiago 3y agoWould be nice to see the source :)
- ineedasername 3y agoMaybe you could incorporate it into a version of ms office from that era as well. You could even give it an anthropomorphised personality embodied by a skeuomorphic element of irl office supplies more common in that era, like a rubber band… or… a… paperclip…
- rapind 3y agoMaybe Bob would be a good fit too. https://en.m.wikipedia.org/wiki/Microsoft_Bob https://en.m.wikipedia.org/wiki/Microsoft_Bob
- dialupdotnet 3y agoGood 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!
- juliangoldsmith 3y agoMS Agent would be a perfect fit for that. It's basically Clippy as a Windows API. It even includes speech synthesis. IIRC it ships with Windows 2000, but works on Windows 95 too.
- quickthrower2 3y agoFull circle AI from paperclip to paperclip maximizer!
- solarkraft 3y agoHave you considered building it into Clippy?
- userbinator 3y agoGetting 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. That's in a separate page here: https://www.dialup.net/wingpt/tls.html https://www.dialup.net/wingpt/tls.html ...and is well worth reading. I'm surprised you had trouble getting a TLS implementation to fit in 64k of code and data, since a lot of deeply-embedded stuff (some even using 8-bit CPUs with bankswitching) for IoT and similar applications support TLS 1.2.
- web3-is-a-scam 3y agoWhy though
- didgeoridoo 3y agoMan, you’re on the wrong website.
- BizarreByte 3y agoThe answer is as always: Why not?
- replwoacause 3y agoYou are asking the wrong question!
- lionkor 3y agoIntellectual curiosity, I'd guess
- 2h 3y ago> It will not work on 64-bit versions of Windows ouch
- grishka 3y agoSame reason why DOS programs don't run there.
- Narishma 3y agoBut it will probably work fine on Linux with Wine.
- 2h 3y agoI am not installing Linux and Wine just to run a Windows program. 64-bit CPUs have been available for PCs for at least 20 years. while this is a neat idea, omitting 64-bit support makes this nothing more than a fun experiment.
- roytam87 3y agoIt could work with the help with otvdm: https://github.com/otya128/winevdm https://github.com/otya128/winevdm
- Grom_PE 3y agoIf you used Win32s for Windows 3.1, you wouldn't have to bother with the segmented memory model and it could also work on 64-bit Windows.
- pjmlp 3y agoYeah, however stuff like Win32s and WinG seem like lore that only old timers remember, and only those of us that would regularly buy programming magazines.
- grishka 3y agoNative TLS is the most impressive part. I remember being told that modern cryptography isn't usable on old CPUs simply because of the amount of unoptimizable number crunching involved. As in, some steps of the key exchange algorithm would take so long that the server would time out. But apparently that's not a problem for a 386 despite being old and slow?
- Shawnj2 3y agoConsidering how many embedded devices are in use, a lot of which are 8 bit microcontrollers with minimal RAM, designing systems that way would be irresponsible. There probably are some systems that don’t have an embedded use case that would (Eg. Encryption for live video) but not everyone is connecting to the internet on the newest iPhone.
- grishka 3y agoI've always had the impression that modern internet-connected (and I mean the public internet with TLS and all that, not just LAN) embedded devices use fairly beefy, and at least 32-bit, CPUs just for that reason. But the bits don't make as much difference as the clock speed, and that can go much higher in modern days thanks to the smaller node size.
- kjs3 3y agoThere are "100 MIPS" 8051 variants (for some value of MIPS) like the Silicon Labs C8051F360. Not sure that's fast enough for 'modern web', but probably fast enough for a lot of interesting things.
- Shawnj2 3y agoIn 2023 yes but there are lot of in production systems designed in the past around older chip designs and old hardware in the real world with slower chips. For example a common low processing power network device you can still make easily today is an Arduino Uno with a network hat.
- 3y ago
- ashleyn 3y ago> Memory is quite limited on Windows 3.1 machines, so I tried to reduce the amount of memory needed for WinGPT, especially in sending and receiving the query and response from the OpenAI API. The JSON responses of modern APIs aren't especially optimized for size, and OpenAI's API is no exception. I've asked the model to be brief in an effort to keep responses as small as possible. I've also chosen not to send the text of previous turns in the API calls, even though this means that the bot won't be able to use prior conversation context. You can trade space for CPU time using SAX-style parsing[1]. SAX-style parsing visits each node of a tree from top to bottom, firing events for each node visited. The amount of memory required compared to fully parsing JSON is negligible, and writing a custom SAX-style parser for JSON shouldn't be too difficult. There are existing SAX-style JSON parsers you can examine as well.[2] [1]: https://en.wikipedia.org/wiki/Simple_API_for_XML https://en.wikipedia.org/wiki/Simple_API_for_XML [2]: https://rapidjson.org/md_doc_sax.html https://rapidjson.org/md_doc_sax.html
- dialupdotnet 3y agoYep! I'm using JSMN (https://github.com/zserge/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'; }
- com2kid 3y agoStrong odds the supporting infrastructure for the textbox control I am typing this into consumes more system resources than WinGPT does in its entirety. Goes to show that we waste literal orders of magnitudes of memory for small gains in developer productivity. Is programming raw Windows controls hard? Sure. But Delphi or VB on Win95 was arguably (much) more productive than modern day UI toolkits, and the resulting apps consumed a fraction of the resources. The main thing they lacked was mobile support and DPI awareness!
- razemio 3y agoCan you elaborate on "arguably much more productive"?
- com2kid 3y agoLet me give a more recent example. A few years back I was building a B2B website for companies to manage event listings[1], fully modern React stack. I wanted to get the backend API up and running first so I threw together a prototype in WinForms and C#. I had been writing React all day every day for a couple years at that point, and I hadn't used C# or WinForms for quite a few years (3 or 4 at least). Also none of the GCP APIs I was using had official C# WinForms libraries (hah!) but of course everything had nice React integrations. So anyway, within a day and a half or so I have a C# desktop app up and running that has about 80% of the site's planned functionality implemented. It is ugly, but it works. Over 3 months later I have the React site up and running. The React site supported Mobile and Desktop browsers, and it looked nicer, but the productivity to create the React site was literal orders of magnitude less. FWIW I had a similar experience going from React to Svelte, I got done in 3 days what would have taken me weeks in React. (For those paying attention, Svelte was still slower than C#!) Part of the difference is that we expect web apps to be all shiny and work at any screen size with fancy CSS, vs a desktop app which can just do its thing. The other part is that, IMHO, HTML+CSS are crap for laying out application UIs. Better than what they used to be, but still absurdly complicated. [1] Create their business profile, list and manage events on a timeline/calendar, view attendees, send announcements to attendees, real time view of people as they show up to the event by hooking into Geo-locating on the phone, manage photos, and so on and so forth.
- pjmlp 3y agoCool project, but as the author quickly found out there was a good reason why non masochists were already using C++ frameworks, TPW, VB, Delphi, VF, VO,...instead of raw C.
- iJohnDoe 3y agoWell done. Very creative.
- coolgoose 3y agoI maybe feel nostalgic, but the old ui is so much... Better :)
- speedgoose 3y agoThis is great. After all these efforts, you should consider switching from ChatGPT 3.5 to ChatGPT 4. Here is the answer of ChatGPT4 when asked the same question about the status bar (I truncated the code output because it's very long): Using the Shell Common Controls in Windows 3.1 can be a bit tricky due to its older architecture and limited capabilities, but it's certainly doable. However, there are a few complications to note: 1. Windows 3.1 does not natively support the status bar as a control. Status bars are part of the Common Controls library introduced in Win32, specifically, it was introduced in Windows 95 with COMCTL32.DLL. Windows 3.1 is a 16-bit environment and does not include this library. 2. If you want a status bar in a Windows 3.1 application, you'll have to draw and manage it yourself. 3. Windows 3.1 programming is largely obsolete. It can be a fun academic exercise or a necessity for maintaining legacy software, but if you're developing new software it would be much more practical to use a more modern version of Windows and its associated API. Assuming that you still want to go ahead, here's a basic idea of how you might implement a status bar yourself: ```c #include <windows.h> #define ID_STATUS 100 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { ...
- vorticalbox 3y agonot everyone has access to gpt 4 yet.
- iraldir 3y agoif you pay chat gpt plus then yes everyone has had access for quite some time now
- collinvandyck76 3y agoThere's a difference between being able to access gpt4 via chat gpt plus, and being able to access gpt4 over the openai APIs.
- HeckFeck 3y agoThere might be a control in the Calmira source code that would help, but it is in Pascal and not C. http://www.calmira.net/source/index.htm http://www.calmira.net/source/index.htm
- blackhaz 3y agoReally miss Windows 3.1, 95 and 98 era. Interfaces have only gone worse since then. Every time I crank up my 386 or Pentium I am completely blown away by how clean and stress-free the GUI was. Really tired of this Apple/Google low-contrast pop-up hell.
- scrlk 3y agoThe Windows Interface Guidelines from 1995 is an interesting read: https://www.ics.uci.edu/~kobsa/courses/ICS104/course-notes/Microsoft_WindowsGuidelines.pdf https://www.ics.uci.edu/~kobsa/courses/ICS104/course-notes/M...
- achr2 3y agoThis is an amazing reference, thanks.
- izacus 3y agoRemember how you could actually RESIZE things in that era? Sidebars, toolbars, etc.? Now half of my UIs have "Tap to...." labels when localized. So many amazing modern UI tools and the rockstar developers wielding them can't even make a draggable sidebar.
- InCityDreams 3y agoOne man's rockstar developer is another man's script kiddie. I do, however have considerably more time for script kiddies.
- haspok 3y agoGood luck resizing a typical modal window though. Also good luck with high-DPI... Even resizing regular windows was not always an option, and if it was, it was very rarely thought through by the developers. I vividly remember that the Swing framework for Java was very special just because of this, as in you couldn't really specify it in pixels where your components would be placed, you'd have all sorts of strategies to divide and position them. (Not saying it was any good, but certainly a notable effort.)
- al_be_back 3y agoSo this is how win3.1 got Clippy then?
- einr 3y agoThis is extremely neat and I will probably try it on one of my actual Windows 3.1 machines :) A suggestion (which seems easy enough to implement, I might give it a try if I can get the build environment set up): make the system prompt customizable in the Options dialog. Having it be 1992 is fun, but kinda limiting. I might actually use this at some point -- if you're on your retro computer, trying to solve a problem, it might actually make some semblance of sense to use this rather than dig out a modern computer or smartphone.
- dialupdotnet 3y agoThat's a great idea. Please do give it a try!
- SergeAx 3y ago> difference between far and near pointers Remembrance unlocked! There are really near (offset only) and far (segment + offset) pointers in x86 16 bit architecture. Also near and far jumps. Gods, how long ago was that...
- hulitu 3y agoHow about Win 3.11 ? It has networking support, you know.
- ok123456 3y agoBarely. TCP/IP networking requires third party winsock adapters. The built in network stack and applications in Windows 3.11 is limited to file, print sharing and maybe sending some popup messages.
- nXqd 3y agothe UI is screaming speed. Actually most of the apps I use in Windows now, have that kind of UI, I hate that with the kind of hardware we have currently, we need to wait for a window to appear. Apps I use daily: totalcmd, clipx, far, sublime text ( only for edit text, code with intellij )
- fsiefken 3y agoThis is fantastic! I was just thinking of creating a windows 3.11 working environment with win32s, dos7.1 for fat32 long filenames, some popular 16bit compiled unix binaries and calmira shell. Keep everything more simple. If tls 1.3 is possible on windows 3.1, people can also make a gemini client.
- RobotToaster 3y agoShame microsoft agent (clippy) is 98 or later only, could be pretty fun integrated into that.
- kjs3 3y agoNow all they need to do is get ChatGPT integrated with AOL and Compuserv.
- philluminati 3y ago> Another fun part of building WinGPT was designing the icon in Borland's Image Editor, which is really just a clone of Microsoft Paint that happens to make ICO files instead. Wow! 40yo me forgot how much time I used to spend creating icons for my apps back in 1999. After trying a million times to create C++ programs Visual Studio 6, I would often fall into just drawing icons in the icon editor as it was the only thing left to do once I introduced a compiler error and couldn't resolve it.
- 1970-01-01 3y agoIf you got TLS 1.3 to work in Win 3.11, you deserve an award from Microsoft.
- scrutinizer80 3y agoSo cool! Can it run on Windows NT 3.51? Would doing so solve some of the memory limitations?