A simple WinForms app that uses OpenAI web API (text and image generation) to provide a fun interactive experience. This is just a learning experience for using generative AI, so there is no deep game play here. My learning goals:
- Image generation - text to image used to generate the initial character images, in-painting (OpenAI calls it image edit) are used to dynamically update the character portrait.
- Text generation - use of system messages to set up role playing. Maintain the memory for the character to continue the conversation.
- Prompt engineering - use prompt engineering to ask LLM to expose character emotional state, so I could extract that to update character portrait.
You need to modify WinFormsAiChat/Form1.cs to enter OpenAI API key for the app to run correctly.
The app supports using local Open API compatible servers. Modify TextUseLocal
and ImageUseLocal
constants in WinFormsAiChat/Form1.cs to have the code running against a local web server.
I hardcoded the host name to use with my LocalGenAI framework, but it should work with other OpenAI compatible servers with minor modification.
- There are two different characters to choose from
- You are given a goal to accomplish on the UI. Try to probe the character for their hidden back stories, motivation and restrictions on helping you with your goal.
- For added fun, AI's emotion state is shown in the status bar and their portraigt would be updated to reflect that during the chat.
- I have not finish the part to recognize the goal has been accomplished, so it's honor system for now ;-)
![image](https://private-user-images.githubusercontent.com/14063642/279474495-5dbe7420-bb37-4354-a708-1078c4f9e0af.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxODc4NTIsIm5iZiI6MTcyMDE4NzU1MiwicGF0aCI6Ii8xNDA2MzY0Mi8yNzk0NzQ0OTUtNWRiZTc0MjAtYmIzNy00MzU0LWE3MDgtMTA3OGM0ZjllMGFmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA1VDEzNTIzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQzM2Q0ZTJmOTUxM2JhNTk5YWMxMzM3MWZkNTZiMWQyZDE0NWU4ZDBkODUwMGJjOWQzYWQ1YjI1N2JhZTI2MGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.SvQAR4TYiBmVE9tEqRlk_Pc2hEn_h6nSQ9YfGe_IqpA)