Skip to content

Add free all conversations usage example - #808

Open
jasveena15 wants to merge 3 commits into
thoth-tech:mainfrom
jasveena15:doc/usage-example-free-all-conversations
Open

Add free all conversations usage example#808
jasveena15 wants to merge 3 commits into
thoth-tech:mainfrom
jasveena15:doc/usage-example-free-all-conversations

Conversation

@jasveena15

Copy link
Copy Markdown

Description

This pull request adds a new SplashKit usage example for the free_all_conversations function 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

  • Documentation (update or new)

How Has This Been Tested?

The C++ example was compiled and executed successfully using the SplashKit Manager toolchain in a MinGW64 terminal.

Commands used:

cd "/c/Users/kaurj/OneDrive/Documents/team project A/splashkit.io-starlight/public/usage-examples/generative_ai"
skm clang++ free_all_conversations-1-example.cpp -o free_all_conversations
./free_all_conversations

The program successfully:

  • Created three conversation objects
  • Called free_all_conversations()
  • Displayed confirmation that all conversation resources were released
  • Completed without compilation warnings

The Python example was also executed successfully using:

python free_all_conversations-1-example.py

Test environment:

  • Windows
  • MinGW64
  • SplashKit Manager toolchain

Testing Checklist

  • Tested in latest Chrome
  • Tested in latest Firefox
  • npm run build
  • npm run preview

Checklist

If involving code

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Folders and Files Added/Modified

  • Added:
    • public/usage-examples/generative_ai/free_all_conversations-1-example.cpp
    • public/usage-examples/generative_ai/free_all_conversations-1-example-top-level.cs
    • public/usage-examples/generative_ai/free_all_conversations-1-example-oop.cs
    • public/usage-examples/generative_ai/free_all_conversations-1-example.py
    • public/usage-examples/generative_ai/free_all_conversations-1-example.txt
    • public/usage-examples/generative_ai/free_all_conversations-1-example.png

Additional Notes

The free_all_conversations function 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.

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 632c863
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a804cea5582e30008e325a7

@AAMIRAU AAMIRAU left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ralphweng2023 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread public/usage-examples/generative_ai/free_all_conversations-1-example-top-level.cs Outdated
Comment thread public/usage-examples/generative_ai/free_all_conversations-1-example-oop.cs Outdated
Comment thread public/usage-examples/generative_ai/free_all_conversations-1-example-oop.cs Outdated
Comment thread public/usage-examples/generative_ai/free_all_conversations-1-example-oop.cs Outdated
@jasveena15

Copy link
Copy Markdown
Author

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 ekam313 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_conversations function.
  • 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 ralphweng2023 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants