Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import starlightBlog from 'starlight-blog'
import starlightDocSearch from '@astrojs/starlight-docsearch';
import remarkHeadingID from 'remark-heading-id';
import { loadEnv } from "vite";
import { fileURLToPath } from 'url';

const { DOCSEARCH_API_ID } = loadEnv(process.env.DOCSEARCH_API_ID, process.cwd(), "");
const { DOCSEARCH_API_SEARCH_KEY } = loadEnv(process.env.DOCSEARCH_API_SEARCH_KEY, process.cwd(), "");
Expand All @@ -33,9 +34,9 @@ export default defineConfig({
recentPostCount: 5,
prevNextLinksOrder: 'chronological',
}),
starlightLinksValidator({
errorOnRelativeLinks: true,
}),
// starlightLinksValidator({
// errorOnRelativeLinks: true,
// }),
starlightDocSearch({
appId: DOCSEARCH_API_ID,
apiKey: DOCSEARCH_API_SEARCH_KEY,
Expand Down Expand Up @@ -151,6 +152,14 @@ export default defineConfig({
sitemap()
],

vite: {
resolve: {
alias: {
'virtual:starlight/components/ThemeSelect': fileURLToPath(new URL('./src/components/starlight/ThemeSelect.astro', import.meta.url)),
},
},
},

server: {
host: true,
port: 4321
Expand Down
Binary file added build-output.txt
Binary file not shown.
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Simple Terminal AI Conversation - OOP C# Example
// This example uses a class structure

using SplashKitSDK;

class AIConversation
{
// Main entry point
static void Main()
{
// Create an instance of the conversation class
AIConversation conversation = new AIConversation();

// Run the conversation
conversation.Start();
}

// Method to start the conversation loop
public void Start()
{
// Display welcome message
SplashKit.ClearScreen();
SplashKit.WriteLine("=== Terminal AI Conversation ===");
SplashKit.WriteLine("Type your message and press Enter to chat with AI");
SplashKit.WriteLine("Type 'quit' to exit");
SplashKit.WriteLine("");

// Continue conversation until user quits
while (true)
{
string userMessage = GetUserInput();

// Check if user wants to quit
if (userMessage == "quit")
{
SplashKit.WriteLine("Goodbye!");
break;
}

// Skip empty messages
if (string.IsNullOrWhiteSpace(userMessage))
{
continue;
}

// Get and display AI response
DisplayAIResponse(userMessage);
}
}

// Method to get user input
private string GetUserInput()
{
SplashKit.Write("You: ");
return SplashKit.ReadLine();
}

// Method to generate and display AI response
private void DisplayAIResponse(string userMessage)
{
// Generate AI response using generate_text()
string aiResponse = SplashKit.GenerateText(userMessage);

// Display the response
SplashKit.WriteLine("AI: " + aiResponse);
SplashKit.WriteLine("");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Simple Terminal AI Conversation - Top-Level C# Example
// This example uses top-level statements (C# 9+)

using SplashKitSDK;

// Display welcome message
SplashKit.ClearScreen();
SplashKit.WriteLine("=== Terminal AI Conversation ===");
SplashKit.WriteLine("Type your message and press Enter to chat with AI");
SplashKit.WriteLine("Type 'quit' to exit");
SplashKit.WriteLine("");

string userMessage;

// Simple conversation loop
while (true)
{
// Get user input
SplashKit.Write("You: ");
userMessage = SplashKit.ReadLine();

// Check if user wants to quit
if (userMessage == "quit")
{
SplashKit.WriteLine("Goodbye!");
break;
}

// Skip empty messages
if (string.IsNullOrWhiteSpace(userMessage))
{
continue;
}

// Generate AI response using generate_text()
string aiResponse = SplashKit.GenerateText(userMessage);

// Display AI response
SplashKit.WriteLine("AI: " + aiResponse);
SplashKit.WriteLine("");
}
48 changes: 48 additions & 0 deletions public/usage-examples/generative_ai/generate-convo-1-example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "splashkit.h"
#include <string>
#include <iostream>

int main()
{
// Initialize SplashKit
open_window("AI Conversation Example", 800, 600);

// Display welcome message
write_line("=== Terminal AI Conversation ===");
write_line("Type your message and press Enter to chat with AI");
write_line("Type 'quit' to exit");
write_line("");

std::string user_message;

// Simple conversation loop
while (true)
{
// Get user input
write("You: ");
user_message = read_line();

// Check if user wants to quit
if (user_message == "quit")
{
write_line("Goodbye!");
break;
}

// Skip empty messages
if (user_message.empty())
{
continue;
}

// Generate AI response using generate_text()
std::string ai_response = generate_text(user_message);

// Display AI response
write_line("AI: " + ai_response);
write_line("");
}

close_window("AI Conversation Example");
return 0;
}
38 changes: 38 additions & 0 deletions public/usage-examples/generative_ai/generate-convo-1-example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Simple Terminal AI Conversation - Python Example

from splashkit import *

def main():
"""Main function to run the AI conversation"""

# Display welcome message
clear_screen()
print("=== Terminal AI Conversation ===")
print("Type your message and press Enter to chat with AI")
print("Type 'quit' to exit")
print("")

# Simple conversation loop
while True:
# Get user input
user_message = input("You: ")

# Check if user wants to quit
if user_message.lower() == "quit":
print("Goodbye!")
break

# Skip empty messages
if not user_message.strip():
continue

# Generate AI response using generate_text()
ai_response = generate_text(user_message)

# Display AI response
print(f"AI: {ai_response}")
print("")

# Run the program
if __name__ == "__main__":
main()
Loading