Add free all conversations usage example - #808
Conversation
❌ Deploy Preview for splashkit failed.
|
AAMIRAU
left a comment
There was a problem hiding this comment.
Reviewed the changes. The free_all_conversations example is clear and consistent across the supported language versions. It demonstrates the cleanup function well and looks good to me.
ralphweng2023
left a comment
There was a problem hiding this comment.
The free_all_conversations example demonstrates the function well in Python and C++, but the C# files call APIs that do not exist as named in api.json.
api.json shows free_all_conversations as GenerativeAi.FreeAll() in C#, not SplashKit.FreeAllConversations, so the top-level call at line 15 will not compile. The OOP file uses new Conversation() at lines 3, 4, and 5, but the documented factory is SplashKit.CreateConversation().
Please update top-level.cs to use GenerativeAi.FreeAll() and oop.cs to use SplashKit.CreateConversation(). Once that's updated I'll be happy to take another look.
fixed all , please check |
ekam313
left a comment
There was a problem hiding this comment.
Peer Review
I've reviewed the free_all_conversations usage example and tested the implementations. The example clearly demonstrates creating multiple conversation objects and releasing them together using free_all_conversations.
Checks
- All required files are present.
- Example Title (.txt)
- C++ code
- C# code (top-level statements)
- C# code (Object-Oriented Programming)
- Python code
- Code correctly uses SplashKit functions.
- Code clearly demonstrates the
free_all_conversationsfunction. - All versions maintain the same overall structure and behaviour.
Code Tests done
- C++ code ran correctly.
- C# top-level code ran correctly.
- C# OOP code ran correctly.
- Python code ran correctly.
Website Tests done
- npm run build
- npm run preview
The example works as expected and is ready to proceed to the next review stage.
ralphweng2023
left a comment
There was a problem hiding this comment.
Both changes from the previous review are in: fa0740f carries GenerativeAi.FreeAll() and 632c863 replaces the constructor with SplashKit.CreateConversation().
Separate from that, and something I should have caught the first time round: oop.cs has no namespace or class wrapper. Lines 3 to 17 sit at file scope, so it is the same top-level statement file as top-level.cs with SplashKit. prefixes added, and 113 of the 114 merged oop examples wrap Program in a namespace. Please add namespace FreeAllConversationsExample with a public class Program and a Main() around that body. Happy to take another look once that is in.
| @@ -0,0 +1,17 @@ | |||
| using SplashKitSDK; | |||
|
|
|||
| Conversation studyConversation = SplashKit.CreateConversation(); | |||
There was a problem hiding this comment.
These statements sit at file scope, which makes this a top-level file rather than an OOP one. Wrap lines 3 to 17 in namespace FreeAllConversationsExample with a public class Program and a Main().
Description
This pull request adds a new SplashKit usage example for the
free_all_conversationsfunction in the Generative AI category.The example demonstrates how multiple AI conversation objects can be created and released together using a single cleanup call. Three conversations are created to represent study, travel, and coding assistants. The program then calls
free_all_conversations()to release all loaded conversation resources.Equivalent implementations are included for C++, C# top-level, C# object-oriented, and Python. A title file and terminal output screenshot are also included.
No additional dependencies are required beyond the existing SplashKit SDK.
Type of change
How Has This Been Tested?
The C++ example was compiled and executed successfully using the SplashKit Manager toolchain in a MinGW64 terminal.
Commands used:
The program successfully:
free_all_conversations()The Python example was also executed successfully using:
Test environment:
Testing Checklist
Checklist
If involving code
Folders and Files Added/Modified
public/usage-examples/generative_ai/free_all_conversations-1-example.cpppublic/usage-examples/generative_ai/free_all_conversations-1-example-top-level.cspublic/usage-examples/generative_ai/free_all_conversations-1-example-oop.cspublic/usage-examples/generative_ai/free_all_conversations-1-example.pypublic/usage-examples/generative_ai/free_all_conversations-1-example.txtpublic/usage-examples/generative_ai/free_all_conversations-1-example.pngAdditional Notes
The
free_all_conversationsfunction performs resource cleanup and does not directly produce graphical output. The included PNG therefore shows the terminal output confirming that multiple conversations were created and then released successfully.The conversation objects are not accessed again after
free_all_conversations()is called.