Last active
November 11, 2025 14:35
-
-
Save gistlyn/c132ee0025f1af60c85431416c6ef922 to your computer and use it in GitHub Desktop.
chat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dotnet add package ServiceStack.AI.Chat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using ServiceStack.AI; | |
| [assembly: HostingStartup(typeof(MyApp.ConfigureAiChat))] | |
| namespace MyApp; | |
| public class ConfigureAiChat : IHostingStartup | |
| { | |
| public void Configure(IWebHostBuilder builder) => builder | |
| .ConfigureServices((context, services) => { | |
| // Docs: https://docs.servicestack.net/ai-chat-api | |
| services.AddPlugin(new ChatFeature { | |
| EnableProviders = [ | |
| "servicestack", | |
| // "groq", | |
| // "google_free", | |
| // "openrouter_free", | |
| // "ollama", | |
| // "google", | |
| // "anthropic", | |
| // "openai", | |
| // "grok", | |
| // "qwen", | |
| // "z.ai", | |
| // "mistral", | |
| // "openrouter", | |
| ] | |
| }); | |
| // Persist AI Chat History, enables analytics at /admin-ui/chat | |
| services.AddSingleton<IChatStore, DbChatStore>(); | |
| // Or store history in monthly partitioned tables in PostgreSQL: | |
| // services.AddSingleton<IChatStore, PostgresChatStore>(); | |
| // Add AI Chat link to /metadata | |
| services.ConfigurePlugin<MetadataFeature>(feature => { | |
| feature.AddPluginLink("/chat", "AI Chat"); | |
| }); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment