From b7f69ed8db64204dc7039cffc2db5d81cd5c105e Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Wed, 3 Sep 2025 09:34:04 +0200 Subject: [PATCH] Refactored data classes into dedicated files --- .../Provider/Perplexity/Choice.cs | 8 +++++++ .../Provider/Perplexity/Delta.cs | 7 ++++++ .../Provider/Perplexity/ResponseStreamLine.cs | 22 +------------------ .../Provider/Perplexity/SearchResult.cs | 8 +++++++ 4 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 app/MindWork AI Studio/Provider/Perplexity/Choice.cs create mode 100644 app/MindWork AI Studio/Provider/Perplexity/Delta.cs create mode 100644 app/MindWork AI Studio/Provider/Perplexity/SearchResult.cs diff --git a/app/MindWork AI Studio/Provider/Perplexity/Choice.cs b/app/MindWork AI Studio/Provider/Perplexity/Choice.cs new file mode 100644 index 00000000..2da6bd99 --- /dev/null +++ b/app/MindWork AI Studio/Provider/Perplexity/Choice.cs @@ -0,0 +1,8 @@ +namespace AIStudio.Provider.Perplexity; + +/// +/// Data model for a choice made by the AI. +/// +/// The index of the choice. +/// The delta text of the choice. +public readonly record struct Choice(int Index, Delta Delta); \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/Perplexity/Delta.cs b/app/MindWork AI Studio/Provider/Perplexity/Delta.cs new file mode 100644 index 00000000..a4f1da61 --- /dev/null +++ b/app/MindWork AI Studio/Provider/Perplexity/Delta.cs @@ -0,0 +1,7 @@ +namespace AIStudio.Provider.Perplexity; + +/// +/// The delta text of a choice. +/// +/// The content of the delta text. +public readonly record struct Delta(string Content); \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/Perplexity/ResponseStreamLine.cs b/app/MindWork AI Studio/Provider/Perplexity/ResponseStreamLine.cs index e8956a06..5ef74083 100644 --- a/app/MindWork AI Studio/Provider/Perplexity/ResponseStreamLine.cs +++ b/app/MindWork AI Studio/Provider/Perplexity/ResponseStreamLine.cs @@ -22,24 +22,4 @@ public readonly record struct ResponseStreamLine(string Id, string Object, uint /// public IList GetSources() => this.SearchResults.Cast().ToList(); -} - -/// -/// Data model for a choice made by the AI. -/// -/// The index of the choice. -/// The delta text of the choice. -public readonly record struct Choice(int Index, Delta Delta); - -/// -/// The delta text of a choice. -/// -/// The content of the delta text. -public readonly record struct Delta(string Content); - -/// -/// Data model for a search result. -/// -/// The title of the search result. -/// The URL of the search result. -public sealed record SearchResult(string Title, string URL) : Source(Title, URL); +} \ No newline at end of file diff --git a/app/MindWork AI Studio/Provider/Perplexity/SearchResult.cs b/app/MindWork AI Studio/Provider/Perplexity/SearchResult.cs new file mode 100644 index 00000000..cfd870c1 --- /dev/null +++ b/app/MindWork AI Studio/Provider/Perplexity/SearchResult.cs @@ -0,0 +1,8 @@ +namespace AIStudio.Provider.Perplexity; + +/// +/// Data model for a search result. +/// +/// The title of the search result. +/// The URL of the search result. +public sealed record SearchResult(string Title, string URL) : Source(Title, URL); \ No newline at end of file