mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-20 14:58:00 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37bd42e41f | ||
|
|
38103121c9 | ||
|
|
9587a07556 | ||
|
|
c3bbcacaed | ||
|
|
f00722e0a6 | ||
|
|
ce243913ed | ||
|
|
fc37882773 | ||
|
|
864bda1213 | ||
|
|
73b2f1fa6a | ||
|
|
d966929dca | ||
|
|
6a37ce6d25 | ||
|
|
70e64f2d14 | ||
|
|
38ec098430 | ||
|
|
4e167d58ea | ||
|
|
f61fe87181 | ||
|
|
2a01d3bb6e | ||
|
|
adf61a1384 | ||
|
|
f1c2a65450 | ||
|
|
e03289b680 | ||
|
|
99dc2606aa | ||
|
|
e931e28ab1 | ||
|
|
5d17dcc29b | ||
|
|
c1826426d9 | ||
|
|
be11efed67 | ||
|
|
7d10bb00f7 | ||
|
|
9ca2860079 | ||
|
|
28b470f40b | ||
|
|
6b61f34fff | ||
|
|
4197d5a0ee | ||
|
|
22aacff717 | ||
|
|
b75d90b13f | ||
|
|
fe2baa8c00 | ||
|
|
7d22b77d47 | ||
|
|
96c1c0653d | ||
|
|
035412f7ff | ||
|
|
6116c03f7c | ||
|
|
9c52812c09 | ||
|
|
be27fd84b8 | ||
|
|
61ffddf1ec | ||
|
|
6d1ecb7678 | ||
|
|
68f5bb1512 | ||
|
|
aaedf667fe | ||
|
|
7df0b3e6e0 | ||
|
|
1b8ed286e7 | ||
|
|
87bb04e3c0 | ||
|
|
181ba07d2d | ||
|
|
3587f547b5 | ||
|
|
cf17c643a0 | ||
|
|
7843426057 | ||
|
|
4db31fd9cf | ||
|
|
18b2e22725 | ||
|
|
b6169e5bfb | ||
|
|
4aeb51c9f1 | ||
|
|
7c4ddf1164 | ||
|
|
793a9cae0a | ||
|
|
368fc9ce39 | ||
|
|
2ef563e9ab | ||
|
|
32e1ab977d | ||
|
|
7a498d524e | ||
|
|
ce915292dc | ||
|
|
6979a73e5c | ||
|
|
fcf511cea8 | ||
|
|
e8cfce05fe | ||
|
|
b88b78a08e | ||
|
|
9a1b7853aa | ||
|
|
69610ea908 | ||
|
|
437da0fd9b | ||
|
|
5b685193ef | ||
|
|
1d31fd9a22 | ||
|
|
e3c272b0c4 | ||
|
|
1e19c05c57 |
No files matched your search
@@ -362,7 +362,10 @@ jobs:
|
|||||||
|
|
||||||
$PDFIUM_URL = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F$($env:PDFIUM_VERSION)/pdfium-$PDFIUM_FILE"
|
$PDFIUM_URL = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F$($env:PDFIUM_VERSION)/pdfium-$PDFIUM_FILE"
|
||||||
Write-Host "Download $PDFIUM_URL ..."
|
Write-Host "Download $PDFIUM_URL ..."
|
||||||
$TMP = New-TemporaryFile | Split-Path
|
|
||||||
|
# Create a unique temporary directory (not just a file)
|
||||||
|
$TMP = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName())
|
||||||
|
New-Item -ItemType Directory -Path $TMP -Force | Out-Null
|
||||||
$ARCHIVE = Join-Path $TMP "pdfium.tgz"
|
$ARCHIVE = Join-Path $TMP "pdfium.tgz"
|
||||||
|
|
||||||
Invoke-WebRequest -Uri $PDFIUM_URL -OutFile $ARCHIVE
|
Invoke-WebRequest -Uri $PDFIUM_URL -OutFile $ARCHIVE
|
||||||
@@ -380,8 +383,15 @@ jobs:
|
|||||||
Copy-Item -Path $SRC -Destination $DEST -Force
|
Copy-Item -Path $SRC -Destination $DEST -Force
|
||||||
|
|
||||||
Write-Host "Cleaning up ..."
|
Write-Host "Cleaning up ..."
|
||||||
Remove-Item $ARCHIVE -Force
|
Remove-Item $ARCHIVE -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item $TMP -Recurse -Force
|
|
||||||
|
# Try to remove the temporary directory, but ignore errors if files are still in use
|
||||||
|
try {
|
||||||
|
Remove-Item $TMP -Recurse -Force -ErrorAction Stop
|
||||||
|
Write-Host "Successfully cleaned up temporary directory: $TMP"
|
||||||
|
} catch {
|
||||||
|
Write-Warning "Could not fully clean up temporary directory: $TMP. This is usually harmless as Windows will clean it up later. Error: $($_.Exception.Message)"
|
||||||
|
}
|
||||||
|
|
||||||
- name: Build .NET project
|
- name: Build .NET project
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -156,3 +156,6 @@ orleans.codegen.cs
|
|||||||
**/.idea/**/uiDesigner.xml
|
**/.idea/**/uiDesigner.xml
|
||||||
**/.idea/**/dbnavigator.xml
|
**/.idea/**/dbnavigator.xml
|
||||||
**/.vs
|
**/.vs
|
||||||
|
|
||||||
|
# Ignore AI plugin config files:
|
||||||
|
/app/.idea/.idea.MindWork AI Studio/.idea/AugmentWebviewStateStore.xml
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Project Guidelines
|
||||||
|
|
||||||
|
## Repository Structure
|
||||||
|
- The repository and the app consist of a Rust project in the `runtime` folder and a .NET solution in the `app` folder.
|
||||||
|
- The .NET solution then contains 4 .NET projects:
|
||||||
|
- `Build Script` is not required for running the app; instead, it contains the build script for creating new releases, for example.
|
||||||
|
- `MindWork AI Studio` contains the actual app code.
|
||||||
|
- `SharedTools` contains types that are needed in the build script and in the app, for example.
|
||||||
|
- `SourceCodeRules` is a Roslyn analyzer project. It contains analyzers and code fixes that we use to enforce code style rules within the team.
|
||||||
|
|
||||||
|
## Changelogs
|
||||||
|
- There is a changelog in Markdown format for each version.
|
||||||
|
- All changelogs are located in the folder `app/MindWork AI Studio/wwwroot/changelog`.
|
||||||
|
- These changelogs are intended for end users, not for developers.
|
||||||
|
- Therefore, we don't mention all changes in the changelog: changes that end users wouldn't understand remain unmentioned. For complex refactorings, for example, we mention a generic point that the code quality has been improved to enhance future maintenance.
|
||||||
|
- The changelog is always written in US English.
|
||||||
|
- The changelog doesn't mention bug fixes if the bug was never shipped and users don't know about it.
|
||||||
@@ -1,52 +1,88 @@
|
|||||||
# MindWork AI Studio
|
# MindWork AI Studio
|
||||||
|
<img src="app/MindWork%20AI%20Studio/wwwroot/svg/banner.svg" alt="MindWork AI Studio Banner"/>
|
||||||
|
|
||||||
Are you new here? [Read here](#what-is-ai-studio) what AI Studio is.
|
Are you new here? [Read here](#what-is-ai-studio) what AI Studio is.
|
||||||
|
|
||||||
## News
|
## News
|
||||||
Things we are currently working on:
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h3 style="display:inline-block">
|
||||||
|
Things we are currently working on
|
||||||
|
</h3>
|
||||||
|
</summary>
|
||||||
|
|
||||||
- Since November 2024: Work on RAG (integration of your data and files) has begun. We will support the integration of local and external data sources. We need to implement the following runtime (Rust) and app (.NET) steps:
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h4 style="display:inline-block">
|
||||||
|
RAG (Retrieval-Augmented Generation)
|
||||||
|
</h4>
|
||||||
|
</summary>
|
||||||
|
|
||||||
- [x] ~~Runtime: Restructuring the code into meaningful modules (PR [#192](https://github.com/MindWorkAI/AI-Studio/pull/192))~~
|
Since November 2024: Work on RAG (integration of your data and files) has begun. We will support the integration of local and external data sources. We need to implement the following runtime (Rust) and app (.NET) steps:
|
||||||
- [x] ~~Define the [External Retrieval Interface (ERI)](https://github.com/MindWorkAI/ERI) as a contract for integrating arbitrary external data (PR [#1](https://github.com/MindWorkAI/ERI/pull/1))~~
|
|
||||||
- [x] ~~App: Metadata for providers (which provider offers embeddings?) (PR [#205](https://github.com/MindWorkAI/AI-Studio/pull/205))~~
|
|
||||||
- [x] ~~App: Add an option to show preview features (PR [#222](https://github.com/MindWorkAI/AI-Studio/pull/222))~~
|
|
||||||
- [x] ~~App: Configure embedding providers (PR [#224](https://github.com/MindWorkAI/AI-Studio/pull/224))~~
|
|
||||||
- [x] ~~App: Implement an [ERI](https://github.com/MindWorkAI/ERI) server coding assistant (PR [#231](https://github.com/MindWorkAI/AI-Studio/pull/231))~~
|
|
||||||
- [x] ~~App: Management of data sources (local & external data via [ERI](https://github.com/MindWorkAI/ERI)) (PR [#259](https://github.com/MindWorkAI/AI-Studio/pull/259), [#273](https://github.com/MindWorkAI/AI-Studio/pull/273))~~
|
|
||||||
- [x] ~~Runtime: Extract data from txt / md / pdf / docx / xlsx files (PR [#374](https://github.com/MindWorkAI/AI-Studio/pull/374))~~
|
|
||||||
- [ ] (*Optional*) Runtime: Implement internal embedding provider through [fastembed-rs](https://github.com/Anush008/fastembed-rs)
|
|
||||||
- [ ] App: Implement dialog for checking & handling [pandoc](https://pandoc.org/) installation ([PR #393](https://github.com/MindWorkAI/AI-Studio/pull/393))
|
|
||||||
- [ ] App: Implement external embedding providers
|
|
||||||
- [ ] App: Implement the process to vectorize one local file using embeddings
|
|
||||||
- [ ] Runtime: Integration of the vector database [LanceDB](https://github.com/lancedb/lancedb)
|
|
||||||
- [ ] App: Implement the continuous process of vectorizing data
|
|
||||||
- [x] ~~App: Define a common retrieval context interface for the integration of RAG processes in chats (PR [#281](https://github.com/MindWorkAI/AI-Studio/pull/281), [#284](https://github.com/MindWorkAI/AI-Studio/pull/284), [#286](https://github.com/MindWorkAI/AI-Studio/pull/286), [#287](https://github.com/MindWorkAI/AI-Studio/pull/287))~~
|
|
||||||
- [x] ~~App: Define a common augmentation interface for the integration of RAG processes in chats (PR [#288](https://github.com/MindWorkAI/AI-Studio/pull/288), [#289](https://github.com/MindWorkAI/AI-Studio/pull/289))~~
|
|
||||||
- [x] ~~App: Integrate data sources in chats (PR [#282](https://github.com/MindWorkAI/AI-Studio/pull/282))~~
|
|
||||||
|
|
||||||
|
- [x] ~~Runtime: Restructuring the code into meaningful modules (PR [#192](https://github.com/MindWorkAI/AI-Studio/pull/192))~~
|
||||||
|
- [x] ~~Define the [External Retrieval Interface (ERI)](https://github.com/MindWorkAI/ERI) as a contract for integrating arbitrary external data (PR [#1](https://github.com/MindWorkAI/ERI/pull/1))~~
|
||||||
|
- [x] ~~App: Metadata for providers (which provider offers embeddings?) (PR [#205](https://github.com/MindWorkAI/AI-Studio/pull/205))~~
|
||||||
|
- [x] ~~App: Add an option to show preview features (PR [#222](https://github.com/MindWorkAI/AI-Studio/pull/222))~~
|
||||||
|
- [x] ~~App: Configure embedding providers (PR [#224](https://github.com/MindWorkAI/AI-Studio/pull/224))~~
|
||||||
|
- [x] ~~App: Implement an [ERI](https://github.com/MindWorkAI/ERI) server coding assistant (PR [#231](https://github.com/MindWorkAI/AI-Studio/pull/231))~~
|
||||||
|
- [x] ~~App: Management of data sources (local & external data via [ERI](https://github.com/MindWorkAI/ERI)) (PR [#259](https://github.com/MindWorkAI/AI-Studio/pull/259), [#273](https://github.com/MindWorkAI/AI-Studio/pull/273))~~
|
||||||
|
- [x] ~~Runtime: Extract data from txt / md / pdf / docx / xlsx files (PR [#374](https://github.com/MindWorkAI/AI-Studio/pull/374))~~
|
||||||
|
- [ ] (*Optional*) Runtime: Implement internal embedding provider through [fastembed-rs](https://github.com/Anush008/fastembed-rs)
|
||||||
|
- [x] ~~App: Implement dialog for checking & handling [pandoc](https://pandoc.org/) installation ([PR #393](https://github.com/MindWorkAI/AI-Studio/pull/393), [PR #487](https://github.com/MindWorkAI/AI-Studio/pull/487))~~
|
||||||
|
- [ ] App: Implement external embedding providers
|
||||||
|
- [ ] App: Implement the process to vectorize one local file using embeddings
|
||||||
|
- [ ] Runtime: Integration of the vector database [LanceDB](https://github.com/lancedb/lancedb)
|
||||||
|
- [ ] App: Implement the continuous process of vectorizing data
|
||||||
|
- [x] ~~App: Define a common retrieval context interface for the integration of RAG processes in chats (PR [#281](https://github.com/MindWorkAI/AI-Studio/pull/281), [#284](https://github.com/MindWorkAI/AI-Studio/pull/284), [#286](https://github.com/MindWorkAI/AI-Studio/pull/286), [#287](https://github.com/MindWorkAI/AI-Studio/pull/287))~~
|
||||||
|
- [x] ~~App: Define a common augmentation interface for the integration of RAG processes in chats (PR [#288](https://github.com/MindWorkAI/AI-Studio/pull/288), [#289](https://github.com/MindWorkAI/AI-Studio/pull/289))~~
|
||||||
|
- [x] ~~App: Integrate data sources in chats (PR [#282](https://github.com/MindWorkAI/AI-Studio/pull/282))~~
|
||||||
|
|
||||||
- Since September 2024: Experiments have been started on how we can work on long texts with AI Studio. Let's say you want to write a fantasy novel or create a complex project proposal and use LLM for support. The initial experiments were promising, but not yet satisfactory. We are testing further approaches until a satisfactory solution is found. The current state of our experiment is available as an experimental preview feature through your app configuration. Related PR: ~~[PR #167](https://github.com/MindWorkAI/AI-Studio/pull/167), [PR #226](https://github.com/MindWorkAI/AI-Studio/pull/226)~~, [PR #376](https://github.com/MindWorkAI/AI-Studio/pull/376).
|
</details>
|
||||||
|
|
||||||
- Since March 2025: We have started developing the plugin system. There will be language plugins to offer AI Studio in other languages, configuration plugins to centrally manage certain providers and rules within an organization, and assistant plugins that allow anyone to develop their own assistants. We are using Lua as the plugin language:
|
<details>
|
||||||
- [x] ~~Plan & implement the base plugin system ([PR #322](https://github.com/MindWorkAI/AI-Studio/pull/322))~~
|
<summary>
|
||||||
- [x] ~~Start the plugin system ([PR #372](https://github.com/MindWorkAI/AI-Studio/pull/372))~~
|
<h4 style="display:inline-block">
|
||||||
- [x] ~~Added hot-reload support for plugins ([PR #377](https://github.com/MindWorkAI/AI-Studio/pull/377), [PR #391](https://github.com/MindWorkAI/AI-Studio/pull/391))~~
|
Writer Mode
|
||||||
- [ ] Add support for other languages (I18N) to AI Studio (~~[PR #381](https://github.com/MindWorkAI/AI-Studio/pull/381), [PR #400](https://github.com/MindWorkAI/AI-Studio/pull/400), [PR #404](https://github.com/MindWorkAI/AI-Studio/pull/404), [PR #429](https://github.com/MindWorkAI/AI-Studio/pull/429), [PR #446](https://github.com/MindWorkAI/AI-Studio/pull/446), [PR #451](https://github.com/MindWorkAI/AI-Studio/pull/451), [PR #455](https://github.com/MindWorkAI/AI-Studio/pull/455), [PR #458](https://github.com/MindWorkAI/AI-Studio/pull/458), [PR #462](https://github.com/MindWorkAI/AI-Studio/pull/462), [PR #469](https://github.com/MindWorkAI/AI-Studio/pull/469))~~
|
</h4>
|
||||||
- [x] ~~Add an I18N assistant to translate all AI Studio texts to a certain language & culture ([PR #422](https://github.com/MindWorkAI/AI-Studio/pull/422))~~
|
</summary>
|
||||||
- [ ] Provide MindWork AI Studio in German (~~[PR #430](https://github.com/MindWorkAI/AI-Studio/pull/430), [PR #446](https://github.com/MindWorkAI/AI-Studio/pull/446), [PR #451](https://github.com/MindWorkAI/AI-Studio/pull/451), [PR #455](https://github.com/MindWorkAI/AI-Studio/pull/455), [PR #458](https://github.com/MindWorkAI/AI-Studio/pull/458), [PR #462](https://github.com/MindWorkAI/AI-Studio/pull/462), [PR #469](https://github.com/MindWorkAI/AI-Studio/pull/469)~~)
|
|
||||||
- [ ] Add configuration plugins, which allow pre-defining some LLM providers in organizations
|
|
||||||
- [ ] Add an app store for plugins, showcasing community-contributed plugins from public GitHub and GitLab repositories. This will enable AI Studio users to discover, install, and update plugins directly within the platform.
|
|
||||||
- [ ] Add assistant plugins
|
|
||||||
|
|
||||||
Other News:
|
Since September 2024: Experiments have been started on how we can work on long texts with AI Studio. Let's say you want to write a fantasy novel or create a complex project proposal and use LLM for support. The initial experiments were promising, but not yet satisfactory. We are testing further approaches until a satisfactory solution is found. The current state of our experiment is available as an experimental preview feature through your app configuration. Related PR: ~~[PR #167](https://github.com/MindWorkAI/AI-Studio/pull/167), [PR #226](https://github.com/MindWorkAI/AI-Studio/pull/226)~~, [PR #376](https://github.com/MindWorkAI/AI-Studio/pull/376).
|
||||||
|
|
||||||
- April 2025: We have two active financial supporters: Peer `peerschuett` and Dominic `donework`. Thank you very much for your support. MindWork AI reinvests these donations by passing them on to our AI Studio dependencies ([see here](https://github.com/orgs/MindWorkAI/sponsoring)). In the event that we receive large donations, we will first sign the app ([#56](https://github.com/MindWorkAI/Planning/issues/56)). In case we receive more donations, we will look for and pay staff to develop features for AI Studio.
|
</details>
|
||||||
|
|
||||||
- April 2025: The [German Aerospace Center (DLR)](https://en.wikipedia.org/wiki/German_Aerospace_Center) ([Website](https://www.dlr.de/en)) will use AI Studio at least within the scope of three projects and will also contribute to its further development. This is great news.
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h4 style="display:inline-block">
|
||||||
|
Plugin System
|
||||||
|
</h4>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
Since March 2025: We have started developing the plugin system. There will be language plugins to offer AI Studio in other languages, configuration plugins to centrally manage certain providers and rules within an organization, and assistant plugins that allow anyone to develop their own assistants. We are using Lua as the plugin language:
|
||||||
|
- [x] ~~Plan & implement the base plugin system ([PR #322](https://github.com/MindWorkAI/AI-Studio/pull/322))~~
|
||||||
|
- [x] ~~Start the plugin system ([PR #372](https://github.com/MindWorkAI/AI-Studio/pull/372))~~
|
||||||
|
- [x] ~~Added hot-reload support for plugins ([PR #377](https://github.com/MindWorkAI/AI-Studio/pull/377), [PR #391](https://github.com/MindWorkAI/AI-Studio/pull/391))~~
|
||||||
|
- [x] ~~Add support for other languages (I18N) to AI Studio ([PR #381](https://github.com/MindWorkAI/AI-Studio/pull/381), [PR #400](https://github.com/MindWorkAI/AI-Studio/pull/400), [PR #404](https://github.com/MindWorkAI/AI-Studio/pull/404), [PR #429](https://github.com/MindWorkAI/AI-Studio/pull/429), [PR #446](https://github.com/MindWorkAI/AI-Studio/pull/446), [PR #451](https://github.com/MindWorkAI/AI-Studio/pull/451), [PR #455](https://github.com/MindWorkAI/AI-Studio/pull/455), [PR #458](https://github.com/MindWorkAI/AI-Studio/pull/458), [PR #462](https://github.com/MindWorkAI/AI-Studio/pull/462), [PR #469](https://github.com/MindWorkAI/AI-Studio/pull/469), [PR #486](https://github.com/MindWorkAI/AI-Studio/pull/486))~~
|
||||||
|
- [x] ~~Add an I18N assistant to translate all AI Studio texts to a certain language & culture ([PR #422](https://github.com/MindWorkAI/AI-Studio/pull/422))~~
|
||||||
|
- [x] ~~Provide MindWork AI Studio in German ([PR #430](https://github.com/MindWorkAI/AI-Studio/pull/430), [PR #446](https://github.com/MindWorkAI/AI-Studio/pull/446), [PR #451](https://github.com/MindWorkAI/AI-Studio/pull/451), [PR #455](https://github.com/MindWorkAI/AI-Studio/pull/455), [PR #458](https://github.com/MindWorkAI/AI-Studio/pull/458), [PR #462](https://github.com/MindWorkAI/AI-Studio/pull/462), [PR #469](https://github.com/MindWorkAI/AI-Studio/pull/469), [PR #486](https://github.com/MindWorkAI/AI-Studio/pull/486))~~
|
||||||
|
- [x] ~~Add configuration plugins, which allow pre-defining some LLM providers in organizations ([PR #491](https://github.com/MindWorkAI/AI-Studio/pull/491), [PR #493](https://github.com/MindWorkAI/AI-Studio/pull/493), [PR #494](https://github.com/MindWorkAI/AI-Studio/pull/494), [PR #497](https://github.com/MindWorkAI/AI-Studio/pull/497))~~
|
||||||
|
- [ ] Add an app store for plugins, showcasing community-contributed plugins from public GitHub and GitLab repositories. This will enable AI Studio users to discover, install, and update plugins directly within the platform.
|
||||||
|
- [ ] Add assistant plugins
|
||||||
|
|
||||||
Features we have recently released:
|
</details>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>
|
||||||
|
<h3 style="display:inline-block">
|
||||||
|
Features we have recently released
|
||||||
|
</h3>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
- v0.9.51: Added support for [Perplexity](https://www.perplexity.ai/); citations added so that LLMs can provide source references (e.g., some OpenAI models, Perplexity); added support for OpenAI's Responses API so that all text LLMs from OpenAI now work in MindWork AI Studio, including Deep Research models; web searches are now possible (some OpenAI models, Perplexity).
|
||||||
|
- v0.9.50: Added support for self-hosted LLMs using [vLLM](https://blog.vllm.ai/2023/06/20/vllm.html).
|
||||||
|
- v0.9.46: Released our plugin system, a German language plugin, early support for enterprise environments, and configuration plugins. Additionally, we added the Pandoc integration for future data processing and file generation.
|
||||||
|
- v0.9.45: Added chat templates to AI Studio, allowing you to create and use a library of system prompts for your chats.
|
||||||
- v0.9.44: Added PDF import to the text summarizer, translation, and legal check assistants, allowing you to import PDF files and use them as input for the assistants.
|
- v0.9.44: Added PDF import to the text summarizer, translation, and legal check assistants, allowing you to import PDF files and use them as input for the assistants.
|
||||||
- v0.9.40: Added support for the `o4` models from OpenAI. Also, we added Alibaba Cloud & Hugging Face as LLM providers.
|
- v0.9.40: Added support for the `o4` models from OpenAI. Also, we added Alibaba Cloud & Hugging Face as LLM providers.
|
||||||
- v0.9.39: Added the plugin system as a preview feature.
|
- v0.9.39: Added the plugin system as a preview feature.
|
||||||
@@ -55,7 +91,8 @@ Features we have recently released:
|
|||||||
- v0.9.26+: Added RAG for external data sources using our [ERI interface](https://mindworkai.org/#eri---external-retrieval-interface) as a preview feature.
|
- v0.9.26+: Added RAG for external data sources using our [ERI interface](https://mindworkai.org/#eri---external-retrieval-interface) as a preview feature.
|
||||||
- v0.9.25: Added [xAI](https://x.ai/) as a new provider. xAI provides their Grok models for generating content.
|
- v0.9.25: Added [xAI](https://x.ai/) as a new provider. xAI provides their Grok models for generating content.
|
||||||
- v0.9.23: Added support for OpenAI `o` models (`o1`, `o1-mini`, `o3`, etc.); added also an [ERI](https://github.com/MindWorkAI/ERI) server coding assistant as a preview feature behind the RAG feature flag. Your own ERI server can be used to gain access to, e.g., your enterprise data from within AI Studio.
|
- v0.9.23: Added support for OpenAI `o` models (`o1`, `o1-mini`, `o3`, etc.); added also an [ERI](https://github.com/MindWorkAI/ERI) server coding assistant as a preview feature behind the RAG feature flag. Your own ERI server can be used to gain access to, e.g., your enterprise data from within AI Studio.
|
||||||
- v0.9.22: Added options for preview features; added embedding provider configuration for RAG (preview) and writer mode (experimental preview).
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## What is AI Studio?
|
## What is AI Studio?
|
||||||
|
|
||||||
@@ -69,7 +106,8 @@ MindWork AI Studio is a free desktop app for macOS, Windows, and Linux. It provi
|
|||||||
**Key advantages:**
|
**Key advantages:**
|
||||||
- **Free of charge**: The app is free to use, both for personal and commercial purposes.
|
- **Free of charge**: The app is free to use, both for personal and commercial purposes.
|
||||||
- **Independence**: You are not tied to any single provider. Instead, you can choose the providers that best suit your needs. Right now, we support:
|
- **Independence**: You are not tied to any single provider. Instead, you can choose the providers that best suit your needs. Right now, we support:
|
||||||
- [OpenAI](https://openai.com/) (GPT4o, GPT4.1, o1, o3, o4, etc.)
|
- [OpenAI](https://openai.com/) (GPT5, GPT4.1, o1, o3, o4, etc.)
|
||||||
|
- [Perplexity](https://www.perplexity.ai/)
|
||||||
- [Mistral](https://mistral.ai/)
|
- [Mistral](https://mistral.ai/)
|
||||||
- [Anthropic](https://www.anthropic.com/) (Claude)
|
- [Anthropic](https://www.anthropic.com/) (Claude)
|
||||||
- [Google Gemini](https://gemini.google.com)
|
- [Google Gemini](https://gemini.google.com)
|
||||||
@@ -77,7 +115,7 @@ MindWork AI Studio is a free desktop app for macOS, Windows, and Linux. It provi
|
|||||||
- [DeepSeek](https://www.deepseek.com/en)
|
- [DeepSeek](https://www.deepseek.com/en)
|
||||||
- [Alibaba Cloud](https://www.alibabacloud.com) (Qwen)
|
- [Alibaba Cloud](https://www.alibabacloud.com) (Qwen)
|
||||||
- [Hugging Face](https://huggingface.co/) using their [inference providers](https://huggingface.co/docs/inference-providers/index) such as Cerebras, Nebius, Sambanova, Novita, Hyperbolic, Together AI, Fireworks, Hugging Face
|
- [Hugging Face](https://huggingface.co/) using their [inference providers](https://huggingface.co/docs/inference-providers/index) such as Cerebras, Nebius, Sambanova, Novita, Hyperbolic, Together AI, Fireworks, Hugging Face
|
||||||
- Self-hosted models using [llama.cpp](https://github.com/ggerganov/llama.cpp), [ollama](https://github.com/ollama/ollama), [LM Studio](https://lmstudio.ai/)
|
- Self-hosted models using [llama.cpp](https://github.com/ggerganov/llama.cpp), [ollama](https://github.com/ollama/ollama), [LM Studio](https://lmstudio.ai/), and [vLLM](https://github.com/vllm-project/vllm)
|
||||||
- [Groq](https://groq.com/)
|
- [Groq](https://groq.com/)
|
||||||
- [Fireworks](https://fireworks.ai/)
|
- [Fireworks](https://fireworks.ai/)
|
||||||
- For scientists and employees of research institutions, we also support [Helmholtz](https://helmholtz.cloud/services/?serviceID=d7d5c597-a2f6-4bd1-b71e-4d6499d98570) and [GWDG](https://gwdg.de/services/application-services/ai-services/) AI services. These are available through federated logins like eduGAIN to all 18 Helmholtz Centers, the Max Planck Society, most German, and many international universities.
|
- For scientists and employees of research institutions, we also support [Helmholtz](https://helmholtz.cloud/services/?serviceID=d7d5c597-a2f6-4bd1-b71e-4d6499d98570) and [GWDG](https://gwdg.de/services/application-services/ai-services/) AI services. These are available through federated logins like eduGAIN to all 18 Helmholtz Centers, the Max Planck Society, most German, and many international universities.
|
||||||
@@ -90,7 +128,13 @@ MindWork AI Studio is a free desktop app for macOS, Windows, and Linux. It provi
|
|||||||
|
|
||||||
## **Ready to get started 🤩?** [Download the appropriate setup for your operating system here](documentation/Setup.md).
|
## **Ready to get started 🤩?** [Download the appropriate setup for your operating system here](documentation/Setup.md).
|
||||||
|
|
||||||
## Support the Project
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h2 style="display:inline-block">
|
||||||
|
Support the Project
|
||||||
|
</h2>
|
||||||
|
</summary>
|
||||||
|
|
||||||
Thank you for using MindWork AI Studio and considering supporting its development 😀. Your support helps keep the project alive and ensures continuous improvements and new features.
|
Thank you for using MindWork AI Studio and considering supporting its development 😀. Your support helps keep the project alive and ensures continuous improvements and new features.
|
||||||
|
|
||||||
We offer various ways you can support the project:
|
We offer various ways you can support the project:
|
||||||
@@ -104,7 +148,15 @@ For companies, sponsoring MindWork AI Studio is not only a way to support innova
|
|||||||
To view all available tiers, please visit our [GitHub Sponsors page](https://github.com/sponsors/MindWorkAI).
|
To view all available tiers, please visit our [GitHub Sponsors page](https://github.com/sponsors/MindWorkAI).
|
||||||
Your support, whether big or small, keeps the wheels turning and is deeply appreciated ❤️.
|
Your support, whether big or small, keeps the wheels turning and is deeply appreciated ❤️.
|
||||||
|
|
||||||
## Planned Features
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h2 style="display:inline-block">
|
||||||
|
Planned Features
|
||||||
|
</h2>
|
||||||
|
</summary>
|
||||||
|
|
||||||
Here's an exciting look at some of the features we're planning to add to AI Studio in future releases:
|
Here's an exciting look at some of the features we're planning to add to AI Studio in future releases:
|
||||||
- **Integrating your data**: You'll be able to integrate your data into AI Studio, like your PDF or Office files, or your Markdown notes.
|
- **Integrating your data**: You'll be able to integrate your data into AI Studio, like your PDF or Office files, or your Markdown notes.
|
||||||
- **Integration of enterprise data:** It will soon be possible to integrate data from the corporate network using a specified interface ([External Retrieval Interface](https://github.com/MindWorkAI/ERI), ERI for short). This will likely require development work by the organization in question.
|
- **Integration of enterprise data:** It will soon be possible to integrate data from the corporate network using a specified interface ([External Retrieval Interface](https://github.com/MindWorkAI/ERI), ERI for short). This will likely require development work by the organization in question.
|
||||||
@@ -118,14 +170,45 @@ Here's an exciting look at some of the features we're planning to add to AI Stud
|
|||||||
|
|
||||||
Stay tuned for more updates and enhancements to make MindWork AI Studio even more powerful and versatile 🤩.
|
Stay tuned for more updates and enhancements to make MindWork AI Studio even more powerful and versatile 🤩.
|
||||||
|
|
||||||
## Building
|
If you're interested in learning more about future plans, check out our [roadmap](https://github.com/orgs/MindWorkAI/projects/2/views/3) and our [planning issues](https://github.com/MindWorkAI/Planning/issues).
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h2 style="display:inline-block">
|
||||||
|
Building
|
||||||
|
</h2>
|
||||||
|
</summary>
|
||||||
|
|
||||||
You want to know how to build MindWork AI Studio from source? [Check out the instructions here](documentation/Build.md).
|
You want to know how to build MindWork AI Studio from source? [Check out the instructions here](documentation/Build.md).
|
||||||
|
|
||||||
## License
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h2 style="display:inline-block">
|
||||||
|
Enterprise IT
|
||||||
|
</h2>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
Do you want to manage AI Studio centrally from your IT department? Yes, that’s possible. [Here’s how it works.](documentation/Enterprise%20IT.md)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h2 style="display:inline-block">
|
||||||
|
License
|
||||||
|
</h2>
|
||||||
|
</summary>
|
||||||
|
|
||||||
MindWork AI Studio is licensed under the `FSL-1.1-MIT` license (functional source license). Here’s a simple rundown of what that means for you:
|
MindWork AI Studio is licensed under the `FSL-1.1-MIT` license (functional source license). Here’s a simple rundown of what that means for you:
|
||||||
- **Permitted Use**: Feel free to use, copy, modify, and share the software for your own projects, educational purposes, research, or even in professional services. The key is to use it in a way that doesn't compete with our offerings.
|
- **Permitted Use**: Feel free to use, copy, modify, and share the software for your own projects, educational purposes, research, or even in professional services. The key is to use it in a way that doesn't compete with our offerings.
|
||||||
- **Competing Use**: Our only request is that you don't create commercial products or services that replace or compete with MindWork AI Studio or any of our other offerings.
|
- **Competing Use**: Our only request is that you don't create commercial products or services that replace or compete with MindWork AI Studio or any of our other offerings.
|
||||||
- **No Warranties**: The software is provided "as is", without any promises from us about it working perfectly for your needs. While we strive to make it great, we can't guarantee it will be free of bugs or issues.
|
- **No Warranties**: The software is provided "as is", without any promises from us about it working perfectly for your needs. While we strive to make it great, we can't guarantee it will be free of bugs or issues.
|
||||||
- **Future License**: Good news! The license for each release of MindWork AI Studio will automatically convert to an MIT license two years from its release date. This makes it even easier for you to use the software in the future.
|
- **Future License**: Good news! The license for each release of MindWork AI Studio will automatically convert to an MIT license two years from its release date. This makes it even easier for you to use the software in the future.
|
||||||
|
|
||||||
For more details, refer to the [LICENSE](LICENSE.md) file. This license structure ensures you have plenty of freedom to use and enjoy the software while protecting our work.
|
For more details, refer to the [LICENSE](LICENSE.md) file. This license structure ensures you have plenty of freedom to use and enjoy the software while protecting our work.
|
||||||
|
|
||||||
|
</details>
|
||||||
@@ -48,7 +48,7 @@ public static class Pdfium
|
|||||||
//
|
//
|
||||||
Console.Write(" deploying ...");
|
Console.Write(" deploying ...");
|
||||||
var library = GetLibraryPath(rid);
|
var library = GetLibraryPath(rid);
|
||||||
if (string.IsNullOrEmpty(library.Path))
|
if (string.IsNullOrWhiteSpace(library.Path))
|
||||||
{
|
{
|
||||||
Console.WriteLine($" failed to find the library path for {rid.ToUserFriendlyName()}");
|
Console.WriteLine($" failed to find the library path for {rid.ToUserFriendlyName()}");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
var rid = Environment.GetCurrentRid();
|
var rid = Environment.GetCurrentRid();
|
||||||
var cwd = Environment.GetAIStudioDirectory();
|
var cwd = Environment.GetAIStudioDirectory();
|
||||||
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", "wwwroot", "_content");
|
var contentPath = Path.Join(cwd, "bin", "release", Environment.DOTNET_VERSION, rid.AsMicrosoftRid(), "publish", "wwwroot", "_content");
|
||||||
|
|
||||||
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
var isMudBlazorDirectoryPresent = Directory.Exists(Path.Join(contentPath, "MudBlazor"));
|
||||||
if (!isMudBlazorDirectoryPresent)
|
if (!isMudBlazorDirectoryPresent)
|
||||||
{
|
{
|
||||||
@@ -28,14 +29,21 @@ public sealed class UpdateWebAssetsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(Path.Join(cwd, "wwwroot", "system"));
|
var destinationPath = Path.Join(cwd, "wwwroot", "system");
|
||||||
|
if(Directory.Exists(destinationPath))
|
||||||
|
Directory.Delete(destinationPath, true);
|
||||||
|
|
||||||
|
Directory.CreateDirectory(destinationPath);
|
||||||
|
|
||||||
var sourcePaths = Directory.EnumerateFiles(contentPath, "*", SearchOption.AllDirectories);
|
var sourcePaths = Directory.EnumerateFiles(contentPath, "*", SearchOption.AllDirectories);
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
foreach(var sourcePath in sourcePaths)
|
foreach(var sourcePath in sourcePaths)
|
||||||
{
|
{
|
||||||
counter++;
|
counter++;
|
||||||
var relativePath = Path.GetRelativePath(cwd, sourcePath);
|
var relativePath = sourcePath
|
||||||
var targetPath = Path.Join(cwd, "wwwroot", relativePath);
|
.Replace(contentPath, "")
|
||||||
|
.TrimStart(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||||
|
var targetPath = Path.Join(cwd, "wwwroot", "system", relativePath);
|
||||||
var targetDirectory = Path.GetDirectoryName(targetPath);
|
var targetDirectory = Path.GetDirectoryName(targetPath);
|
||||||
if (targetDirectory != null)
|
if (targetDirectory != null)
|
||||||
Directory.CreateDirectory(targetDirectory);
|
Directory.CreateDirectory(targetDirectory);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FNV/@EntryIndexedValue">FNV</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FNV/@EntryIndexedValue">FNV</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GWDG/@EntryIndexedValue">GWDG</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GWDG/@EntryIndexedValue">GWDG</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HF/@EntryIndexedValue">HF</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HF/@EntryIndexedValue">HF</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IERI/@EntryIndexedValue">IERI</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LLM/@EntryIndexedValue">LLM</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LLM/@EntryIndexedValue">LLM</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LM/@EntryIndexedValue">LM</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LM/@EntryIndexedValue">LM</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSG/@EntryIndexedValue">MSG</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSG/@EntryIndexedValue">MSG</s:String>
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=groq/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=groq/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=gwdg/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=gwdg/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=huggingface/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=huggingface/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=ieri/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mwais/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=mwais/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ollama/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=ollama/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=tauri_0027s/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=tauri_0027s/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
@@ -54,7 +54,7 @@ public abstract class AgentBase(ILogger<AgentBase> logger, SettingsManager setti
|
|||||||
|
|
||||||
#region Implementation of IAgent
|
#region Implementation of IAgent
|
||||||
|
|
||||||
public abstract AIStudio.Settings.Provider? ProviderSettings { get; set; }
|
public abstract AIStudio.Settings.Provider ProviderSettings { get; set; }
|
||||||
|
|
||||||
public abstract Task<ChatThread> ProcessContext(ChatThread chatThread, IDictionary<string, string> additionalData);
|
public abstract Task<ChatThread> ProcessContext(ChatThread chatThread, IDictionary<string, string> additionalData);
|
||||||
|
|
||||||
@@ -73,7 +73,6 @@ public abstract class AgentBase(ILogger<AgentBase> logger, SettingsManager setti
|
|||||||
WorkspaceId = Guid.Empty,
|
WorkspaceId = Guid.Empty,
|
||||||
ChatId = Guid.NewGuid(),
|
ChatId = Guid.NewGuid(),
|
||||||
Name = string.Empty,
|
Name = string.Empty,
|
||||||
Seed = this.RNG.Next(),
|
|
||||||
SystemPrompt = systemPrompt,
|
SystemPrompt = systemPrompt,
|
||||||
Blocks = [],
|
Blocks = [],
|
||||||
};
|
};
|
||||||
@@ -103,10 +102,9 @@ public abstract class AgentBase(ILogger<AgentBase> logger, SettingsManager setti
|
|||||||
|
|
||||||
protected async Task AddAIResponseAsync(ChatThread thread, IContent lastUserPrompt, DateTimeOffset time)
|
protected async Task AddAIResponseAsync(ChatThread thread, IContent lastUserPrompt, DateTimeOffset time)
|
||||||
{
|
{
|
||||||
if(this.ProviderSettings is null)
|
if(this.ProviderSettings == Settings.Provider.NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var providerSettings = this.ProviderSettings.Value;
|
|
||||||
var aiText = new ContentText
|
var aiText = new ContentText
|
||||||
{
|
{
|
||||||
// We have to wait for the remote
|
// We have to wait for the remote
|
||||||
@@ -127,6 +125,6 @@ public abstract class AgentBase(ILogger<AgentBase> logger, SettingsManager setti
|
|||||||
// Use the selected provider to get the AI response.
|
// Use the selected provider to get the AI response.
|
||||||
// By awaiting this line, we wait for the entire
|
// By awaiting this line, we wait for the entire
|
||||||
// content to be streamed.
|
// content to be streamed.
|
||||||
await aiText.CreateFromProviderAsync(providerSettings.CreateProvider(this.Logger), providerSettings.Model, lastUserPrompt, thread);
|
await aiText.CreateFromProviderAsync(this.ProviderSettings.CreateProvider(), this.ProviderSettings.Model, lastUserPrompt, thread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ public sealed class AgentDataSourceSelection (ILogger<AgentDataSourceSelection>
|
|||||||
""";
|
""";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override Settings.Provider? ProviderSettings { get; set; }
|
public override Settings.Provider ProviderSettings { get; set; } = Settings.Provider.NONE;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The data source selection agent does not work with context. Use
|
/// The data source selection agent does not work with context. Use
|
||||||
@@ -131,7 +131,7 @@ public sealed class AgentDataSourceSelection (ILogger<AgentDataSourceSelection>
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public async Task<List<SelectedDataSource>> PerformSelectionAsync(IProvider provider, IContent lastPrompt, ChatThread chatThread, AllowedSelectedDataSources dataSources, CancellationToken token = default)
|
public async Task<List<SelectedDataSource>> PerformSelectionAsync(IProvider provider, IContent lastUserPrompt, ChatThread chatThread, AllowedSelectedDataSources dataSources, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
logger.LogInformation("The AI should select the appropriate data sources.");
|
logger.LogInformation("The AI should select the appropriate data sources.");
|
||||||
|
|
||||||
@@ -141,6 +141,11 @@ public sealed class AgentDataSourceSelection (ILogger<AgentDataSourceSelection>
|
|||||||
|
|
||||||
// We start with the provider currently selected by the user:
|
// We start with the provider currently selected by the user:
|
||||||
var agentProvider = this.SettingsManager.GetPreselectedProvider(Tools.Components.AGENT_DATA_SOURCE_SELECTION, provider.Id, true);
|
var agentProvider = this.SettingsManager.GetPreselectedProvider(Tools.Components.AGENT_DATA_SOURCE_SELECTION, provider.Id, true);
|
||||||
|
if (agentProvider == Settings.Provider.NONE)
|
||||||
|
{
|
||||||
|
logger.LogWarning("No provider is selected for the agent. The agent cannot select data sources.");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
// Assign the provider settings to the agent:
|
// Assign the provider settings to the agent:
|
||||||
logger.LogInformation($"The agent for the data source selection uses the provider '{agentProvider.InstanceName}' ({agentProvider.UsedLLMProvider.ToName()}, confidence={agentProvider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level.GetName()}).");
|
logger.LogInformation($"The agent for the data source selection uses the provider '{agentProvider.InstanceName}' ({agentProvider.UsedLLMProvider.ToName()}, confidence={agentProvider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level.GetName()}).");
|
||||||
@@ -149,7 +154,7 @@ public sealed class AgentDataSourceSelection (ILogger<AgentDataSourceSelection>
|
|||||||
//
|
//
|
||||||
// 2. Prepare the current system and user prompts as input for the agent:
|
// 2. Prepare the current system and user prompts as input for the agent:
|
||||||
//
|
//
|
||||||
var lastPromptContent = lastPrompt switch
|
var lastPromptContent = lastUserPrompt switch
|
||||||
{
|
{
|
||||||
ContentText text => text.Text,
|
ContentText text => text.Text,
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public sealed class AgentRetrievalContextValidation (ILogger<AgentRetrievalConte
|
|||||||
""";
|
""";
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override Settings.Provider? ProviderSettings { get; set; }
|
public override Settings.Provider ProviderSettings { get; set; } = Settings.Provider.NONE;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The retrieval context validation agent does not work with context. Use
|
/// The retrieval context validation agent does not work with context. Use
|
||||||
@@ -133,6 +133,11 @@ public sealed class AgentRetrievalContextValidation (ILogger<AgentRetrievalConte
|
|||||||
{
|
{
|
||||||
// We start with the provider currently selected by the user:
|
// We start with the provider currently selected by the user:
|
||||||
var agentProvider = this.SettingsManager.GetPreselectedProvider(Tools.Components.AGENT_RETRIEVAL_CONTEXT_VALIDATION, provider.Id, true);
|
var agentProvider = this.SettingsManager.GetPreselectedProvider(Tools.Components.AGENT_RETRIEVAL_CONTEXT_VALIDATION, provider.Id, true);
|
||||||
|
if (agentProvider == Settings.Provider.NONE)
|
||||||
|
{
|
||||||
|
logger.LogWarning("No provider is selected for the agent.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Assign the provider settings to the agent:
|
// Assign the provider settings to the agent:
|
||||||
logger.LogInformation($"The agent for the retrieval context validation uses the provider '{agentProvider.InstanceName}' ({agentProvider.UsedLLMProvider.ToName()}, confidence={agentProvider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level.GetName()}).");
|
logger.LogInformation($"The agent for the retrieval context validation uses the provider '{agentProvider.InstanceName}' ({agentProvider.UsedLLMProvider.ToName()}, confidence={agentProvider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level.GetName()}).");
|
||||||
@@ -142,12 +147,12 @@ public sealed class AgentRetrievalContextValidation (ILogger<AgentRetrievalConte
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Validate all retrieval contexts against the last user and the system prompt.
|
/// Validate all retrieval contexts against the last user and the system prompt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="lastPrompt">The last user prompt.</param>
|
/// <param name="lastUserPrompt">The last user prompt.</param>
|
||||||
/// <param name="chatThread">The chat thread.</param>
|
/// <param name="chatThread">The chat thread.</param>
|
||||||
/// <param name="retrievalContexts">All retrieval contexts to validate.</param>
|
/// <param name="retrievalContexts">All retrieval contexts to validate.</param>
|
||||||
/// <param name="token">The cancellation token.</param>
|
/// <param name="token">The cancellation token.</param>
|
||||||
/// <returns>The validation results.</returns>
|
/// <returns>The validation results.</returns>
|
||||||
public async Task<IReadOnlyList<RetrievalContextValidationResult>> ValidateRetrievalContextsAsync(IContent lastPrompt, ChatThread chatThread, IReadOnlyList<IRetrievalContext> retrievalContexts, CancellationToken token = default)
|
public async Task<IReadOnlyList<RetrievalContextValidationResult>> ValidateRetrievalContextsAsync(IContent lastUserPrompt, ChatThread chatThread, IReadOnlyList<IRetrievalContext> retrievalContexts, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
// Check if the retrieval context validation is enabled:
|
// Check if the retrieval context validation is enabled:
|
||||||
if (!this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)
|
if (!this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)
|
||||||
@@ -173,7 +178,7 @@ public sealed class AgentRetrievalContextValidation (ILogger<AgentRetrievalConte
|
|||||||
await semaphore.WaitAsync(token);
|
await semaphore.WaitAsync(token);
|
||||||
|
|
||||||
// Start the next validation task:
|
// Start the next validation task:
|
||||||
validationTasks.Add(this.ValidateRetrievalContextAsync(lastPrompt, chatThread, retrievalContext, token, semaphore));
|
validationTasks.Add(this.ValidateRetrievalContextAsync(lastUserPrompt, chatThread, retrievalContext, token, semaphore));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for all validation tasks to complete:
|
// Wait for all validation tasks to complete:
|
||||||
@@ -188,13 +193,13 @@ public sealed class AgentRetrievalContextValidation (ILogger<AgentRetrievalConte
|
|||||||
/// can call this method in parallel for each retrieval context. You might use
|
/// can call this method in parallel for each retrieval context. You might use
|
||||||
/// the ValidateRetrievalContextsAsync method to validate all retrieval contexts.
|
/// the ValidateRetrievalContextsAsync method to validate all retrieval contexts.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="lastPrompt">The last user prompt.</param>
|
/// <param name="lastUserPrompt">The last user prompt.</param>
|
||||||
/// <param name="chatThread">The chat thread.</param>
|
/// <param name="chatThread">The chat thread.</param>
|
||||||
/// <param name="retrievalContext">The retrieval context to validate.</param>
|
/// <param name="retrievalContext">The retrieval context to validate.</param>
|
||||||
/// <param name="token">The cancellation token.</param>
|
/// <param name="token">The cancellation token.</param>
|
||||||
/// <param name="semaphore">The optional semaphore to limit the number of parallel validations.</param>
|
/// <param name="semaphore">The optional semaphore to limit the number of parallel validations.</param>
|
||||||
/// <returns>The validation result.</returns>
|
/// <returns>The validation result.</returns>
|
||||||
public async Task<RetrievalContextValidationResult> ValidateRetrievalContextAsync(IContent lastPrompt, ChatThread chatThread, IRetrievalContext retrievalContext, CancellationToken token = default, SemaphoreSlim? semaphore = null)
|
public async Task<RetrievalContextValidationResult> ValidateRetrievalContextAsync(IContent lastUserPrompt, ChatThread chatThread, IRetrievalContext retrievalContext, CancellationToken token = default, SemaphoreSlim? semaphore = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -209,7 +214,7 @@ public sealed class AgentRetrievalContextValidation (ILogger<AgentRetrievalConte
|
|||||||
//
|
//
|
||||||
// 1. Prepare the current system and user prompts as input for the agent:
|
// 1. Prepare the current system and user prompts as input for the agent:
|
||||||
//
|
//
|
||||||
var lastPromptContent = lastPrompt switch
|
var lastPromptContent = lastUserPrompt switch
|
||||||
{
|
{
|
||||||
ContentText text => text.Text,
|
ContentText text => text.Text,
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public sealed class AgentTextContentCleaner(ILogger<AgentBase> logger, SettingsM
|
|||||||
|
|
||||||
#region Overrides of AgentBase
|
#region Overrides of AgentBase
|
||||||
|
|
||||||
public override AIStudio.Settings.Provider? ProviderSettings { get; set; }
|
public override AIStudio.Settings.Provider ProviderSettings { get; set; } = AIStudio.Settings.Provider.NONE;
|
||||||
|
|
||||||
protected override Type Type => Type.SYSTEM;
|
protected override Type Type => Type.SYSTEM;
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public interface IAgent
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The provider to use for this agent.
|
/// The provider to use for this agent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AIStudio.Settings.Provider? ProviderSettings { get; set; }
|
public Settings.Provider ProviderSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Processes a chat thread (i.e., context) and returns the updated thread.
|
/// Processes a chat thread (i.e., context) and returns the updated thread.
|
||||||
|
|||||||
@@ -2,22 +2,24 @@ namespace AIStudio.Assistants.Agenda;
|
|||||||
|
|
||||||
public static class NumberParticipantsExtensions
|
public static class NumberParticipantsExtensions
|
||||||
{
|
{
|
||||||
|
private static string TB(string fallbackEN) => Tools.PluginSystem.I18N.I.T(fallbackEN, typeof(NumberParticipantsExtensions).Namespace, nameof(NumberParticipantsExtensions));
|
||||||
|
|
||||||
public static string Name(this NumberParticipants numberParticipants) => numberParticipants switch
|
public static string Name(this NumberParticipants numberParticipants) => numberParticipants switch
|
||||||
{
|
{
|
||||||
NumberParticipants.NOT_SPECIFIED => "Please select how many participants are expected",
|
NumberParticipants.NOT_SPECIFIED => TB("Please select how many participants are expected"),
|
||||||
|
|
||||||
NumberParticipants.PEER_TO_PEER => "2 (peer to peer)",
|
NumberParticipants.PEER_TO_PEER => TB("2 (peer to peer)"),
|
||||||
|
|
||||||
NumberParticipants.SMALL_GROUP => "3 - 5 (small group)",
|
NumberParticipants.SMALL_GROUP => TB("3 - 5 (small group)"),
|
||||||
NumberParticipants.LARGE_GROUP => "6 - 12 (large group)",
|
NumberParticipants.LARGE_GROUP => TB("6 - 12 (large group)"),
|
||||||
NumberParticipants.MULTIPLE_SMALL_GROUPS => "13 - 20 (multiple small groups)",
|
NumberParticipants.MULTIPLE_SMALL_GROUPS => TB("13 - 20 (multiple small groups)"),
|
||||||
NumberParticipants.MULTIPLE_LARGE_GROUPS => "21 - 30 (multiple large groups)",
|
NumberParticipants.MULTIPLE_LARGE_GROUPS => TB("21 - 30 (multiple large groups)"),
|
||||||
|
|
||||||
NumberParticipants.SYMPOSIUM => "31 - 100 (symposium)",
|
NumberParticipants.SYMPOSIUM => TB("31 - 100 (symposium)"),
|
||||||
NumberParticipants.CONFERENCE => "101 - 200 (conference)",
|
NumberParticipants.CONFERENCE => TB("101 - 200 (conference)"),
|
||||||
NumberParticipants.CONGRESS => "201 - 1,000 (congress)",
|
NumberParticipants.CONGRESS => TB("201 - 1,000 (congress)"),
|
||||||
|
|
||||||
NumberParticipants.LARGE_EVENT => "1,000+ (large event)",
|
NumberParticipants.LARGE_EVENT => TB("1,000+ (large event)"),
|
||||||
|
|
||||||
_ => "Unknown"
|
_ => "Unknown"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center" Class="mb-2 mr-3" StretchItems="StretchItems.Start">
|
<MudStack Row="true" AlignItems="AlignItems.Center" Class="mb-2 mr-3" StretchItems="StretchItems.Start">
|
||||||
<MudText Typo="Typo.h3">
|
<MudText Typo="Typo.h3">
|
||||||
@(this.Title)
|
@this.Title
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" OnClick="() => this.OpenSettingsDialog()"/>
|
<MudIconButton Variant="Variant.Text" Icon="@Icons.Material.Filled.Settings" OnClick="@(async () => await this.OpenSettingsDialog())"/>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<InnerScrolling>
|
<InnerScrolling>
|
||||||
@@ -26,13 +26,13 @@
|
|||||||
</CascadingValue>
|
</CascadingValue>
|
||||||
|
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center" StretchItems="StretchItems.Start" Class="mb-3">
|
<MudStack Row="true" AlignItems="AlignItems.Center" StretchItems="StretchItems.Start" Class="mb-3">
|
||||||
<MudButton Disabled="@this.SubmitDisabled" Variant="Variant.Filled" OnClick="async () => await this.Start()" Style="@this.SubmitButtonStyle">
|
<MudButton Disabled="@this.SubmitDisabled" Variant="Variant.Filled" OnClick="@(async () => await this.Start())" Style="@this.SubmitButtonStyle">
|
||||||
@this.SubmitText
|
@this.SubmitText
|
||||||
</MudButton>
|
</MudButton>
|
||||||
@if (this.isProcessing && this.cancellationTokenSource is not null)
|
@if (this.isProcessing && this.cancellationTokenSource is not null)
|
||||||
{
|
{
|
||||||
<MudTooltip Text="@TB("Stop generation")">
|
<MudTooltip Text="@TB("Stop generation")">
|
||||||
<MudIconButton Variant="Variant.Filled" Icon="@Icons.Material.Filled.Stop" Color="Color.Error" OnClick="() => this.CancelStreaming()"/>
|
<MudIconButton Variant="Variant.Filled" Icon="@Icons.Material.Filled.Stop" Color="Color.Error" OnClick="@(async () => await this.CancelStreaming())"/>
|
||||||
</MudTooltip>
|
</MudTooltip>
|
||||||
}
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</ChildContent>
|
</ChildContent>
|
||||||
<FooterContent>
|
<FooterContent>
|
||||||
<MudStack Row="@true" Wrap="Wrap.Wrap" Class="ma-1">
|
<MudStack Row="@true" Wrap="Wrap.Wrap" AlignItems="AlignItems.Center" StretchItems="StretchItems.None" Class="ma-1">
|
||||||
|
|
||||||
@if (!this.FooterButtons.Any(x => x.Type is ButtonTypes.SEND_TO))
|
@if (!this.FooterButtons.Any(x => x.Type is ButtonTypes.SEND_TO))
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<MudMenu AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomLeft" StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@TB("Send to ...")" Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
|
<MudMenu AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomLeft" StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@TB("Send to ...")" Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
|
||||||
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
|
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
|
||||||
{
|
{
|
||||||
<MudMenuItem OnClick="() => this.SendToAssistant(assistant, new())">
|
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, new()))">
|
||||||
@assistant.Name()
|
@assistant.Name()
|
||||||
</MudMenuItem>
|
</MudMenuItem>
|
||||||
}
|
}
|
||||||
@@ -94,14 +94,14 @@
|
|||||||
{
|
{
|
||||||
case ButtonData buttonData when !string.IsNullOrWhiteSpace(buttonData.Tooltip):
|
case ButtonData buttonData when !string.IsNullOrWhiteSpace(buttonData.Tooltip):
|
||||||
<MudTooltip Text="@buttonData.Tooltip">
|
<MudTooltip Text="@buttonData.Tooltip">
|
||||||
<MudButton Variant="Variant.Filled" Color="@buttonData.Color" Disabled="@buttonData.DisabledAction()" StartIcon="@GetButtonIcon(buttonData.Icon)" OnClick="async () => await buttonData.AsyncAction()">
|
<MudButton Variant="Variant.Filled" Color="@buttonData.Color" Disabled="@buttonData.DisabledAction()" StartIcon="@GetButtonIcon(buttonData.Icon)" OnClick="@(async () => await buttonData.AsyncAction())">
|
||||||
@buttonData.Text
|
@buttonData.Text
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudTooltip>
|
</MudTooltip>
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonData buttonData:
|
case ButtonData buttonData:
|
||||||
<MudButton Variant="Variant.Filled" Color="@buttonData.Color" Disabled="@buttonData.DisabledAction()" StartIcon="@GetButtonIcon(buttonData.Icon)" OnClick="async () => await buttonData.AsyncAction()">
|
<MudButton Variant="Variant.Filled" Color="@buttonData.Color" Disabled="@buttonData.DisabledAction()" StartIcon="@GetButtonIcon(buttonData.Icon)" OnClick="@(async () => await buttonData.AsyncAction())">
|
||||||
@buttonData.Text
|
@buttonData.Text
|
||||||
</MudButton>
|
</MudButton>
|
||||||
break;
|
break;
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
<MudMenu AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomLeft" StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@TB("Send to ...")" Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
|
<MudMenu AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomLeft" StartIcon="@Icons.Material.Filled.Apps" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" Label="@TB("Send to ...")" Variant="Variant.Filled" Style="@this.GetSendToColor()" Class="rounded">
|
||||||
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
|
@foreach (var assistant in Enum.GetValues<Components>().Where(n => n.AllowSendTo()).OrderBy(n => n.Name().Length))
|
||||||
{
|
{
|
||||||
<MudMenuItem OnClick="() => this.SendToAssistant(assistant, sendToButton)">
|
<MudMenuItem OnClick="@(async () => await this.SendToAssistant(assistant, sendToButton))">
|
||||||
@assistant.Name()
|
@assistant.Name()
|
||||||
</MudMenuItem>
|
</MudMenuItem>
|
||||||
}
|
}
|
||||||
@@ -121,14 +121,14 @@
|
|||||||
|
|
||||||
@if (this.ShowCopyResult)
|
@if (this.ShowCopyResult)
|
||||||
{
|
{
|
||||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.ContentCopy" OnClick="() => this.CopyToClipboard()">
|
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.ContentCopy" OnClick="@(async () => await this.CopyToClipboard())">
|
||||||
@TB("Copy result")
|
@TB("Copy result")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (this.ShowReset)
|
@if (this.ShowReset)
|
||||||
{
|
{
|
||||||
<MudButton Variant="Variant.Filled" Style="@this.GetResetColor()" StartIcon="@Icons.Material.Filled.Refresh" OnClick="() => this.InnerResetForm()">
|
<MudButton Variant="Variant.Filled" Style="@this.GetResetColor()" StartIcon="@Icons.Material.Filled.Refresh" OnClick="@(async () => await this.InnerResetForm())">
|
||||||
@TB("Reset")
|
@TB("Reset")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
protected IJSRuntime JsRuntime { get; init; } = null!;
|
protected IJSRuntime JsRuntime { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
protected ThreadSafeRandom RNG { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
protected ISnackbar Snackbar { get; init; } = null!;
|
protected ISnackbar Snackbar { get; init; } = null!;
|
||||||
@@ -85,7 +82,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
|
|
||||||
protected virtual IReadOnlyList<IButtonData> FooterButtons => [];
|
protected virtual IReadOnlyList<IButtonData> FooterButtons => [];
|
||||||
|
|
||||||
protected AIStudio.Settings.Provider providerSettings;
|
protected AIStudio.Settings.Provider providerSettings = Settings.Provider.NONE;
|
||||||
protected MudForm? form;
|
protected MudForm? form;
|
||||||
protected bool inputIsValid;
|
protected bool inputIsValid;
|
||||||
protected Profile currentProfile = Profile.NO_PROFILE;
|
protected Profile currentProfile = Profile.NO_PROFILE;
|
||||||
@@ -199,7 +196,6 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
WorkspaceId = Guid.Empty,
|
WorkspaceId = Guid.Empty,
|
||||||
ChatId = Guid.NewGuid(),
|
ChatId = Guid.NewGuid(),
|
||||||
Name = string.Format(this.TB("Assistant - {0}"), this.Title),
|
Name = string.Format(this.TB("Assistant - {0}"), this.Title),
|
||||||
Seed = this.RNG.Next(),
|
|
||||||
Blocks = [],
|
Blocks = [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -215,7 +211,6 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
WorkspaceId = workspaceId,
|
WorkspaceId = workspaceId,
|
||||||
ChatId = chatId,
|
ChatId = chatId,
|
||||||
Name = name,
|
Name = name,
|
||||||
Seed = this.RNG.Next(),
|
|
||||||
Blocks = [],
|
Blocks = [],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -275,7 +270,7 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
// Use the selected provider to get the AI response.
|
// Use the selected provider to get the AI response.
|
||||||
// By awaiting this line, we wait for the entire
|
// By awaiting this line, we wait for the entire
|
||||||
// content to be streamed.
|
// content to be streamed.
|
||||||
this.chatThread = await aiText.CreateFromProviderAsync(this.providerSettings.CreateProvider(this.Logger), this.providerSettings.Model, this.lastUserPrompt, this.chatThread, this.cancellationTokenSource!.Token);
|
this.chatThread = await aiText.CreateFromProviderAsync(this.providerSettings.CreateProvider(), this.providerSettings.Model, this.lastUserPrompt, this.chatThread, this.cancellationTokenSource!.Token);
|
||||||
|
|
||||||
this.isProcessing = false;
|
this.isProcessing = false;
|
||||||
this.StateHasChanged();
|
this.StateHasChanged();
|
||||||
@@ -352,13 +347,15 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
private async Task InnerResetForm()
|
private async Task InnerResetForm()
|
||||||
{
|
{
|
||||||
this.resultingContentBlock = null;
|
this.resultingContentBlock = null;
|
||||||
this.providerSettings = default;
|
this.providerSettings = Settings.Provider.NONE;
|
||||||
|
|
||||||
await this.JsRuntime.ClearDiv(RESULT_DIV_ID);
|
await this.JsRuntime.ClearDiv(RESULT_DIV_ID);
|
||||||
await this.JsRuntime.ClearDiv(AFTER_RESULT_DIV_ID);
|
await this.JsRuntime.ClearDiv(AFTER_RESULT_DIV_ID);
|
||||||
|
|
||||||
this.ResetForm();
|
this.ResetForm();
|
||||||
this.providerSettings = this.SettingsManager.GetPreselectedProvider(this.Component);
|
this.providerSettings = this.SettingsManager.GetPreselectedProvider(this.Component);
|
||||||
|
this.currentProfile = this.SettingsManager.GetPreselectedProfile(this.Component);
|
||||||
|
this.currentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(this.Component);
|
||||||
|
|
||||||
this.inputIsValid = false;
|
this.inputIsValid = false;
|
||||||
this.inputIssues = [];
|
this.inputIssues = [];
|
||||||
@@ -384,7 +381,17 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
|
|
||||||
protected override void DisposeResources()
|
protected override void DisposeResources()
|
||||||
{
|
{
|
||||||
this.formChangeTimer.Dispose();
|
try
|
||||||
|
{
|
||||||
|
this.formChangeTimer.Stop();
|
||||||
|
this.formChangeTimer.Dispose();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
base.DisposeResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -6,22 +6,22 @@
|
|||||||
{
|
{
|
||||||
var codingContext = this.codingContexts[contextIndex];
|
var codingContext = this.codingContexts[contextIndex];
|
||||||
var index = contextIndex;
|
var index = contextIndex;
|
||||||
<ExpansionPanel HeaderText="@codingContext.Id" HeaderIcon="@Icons.Material.Filled.Code" ShowEndButton="@true" EndButtonColor="Color.Error" EndButtonIcon="@Icons.Material.Filled.Delete" EndButtonTooltip="Delete context" EndButtonClickAsync="@(() => this.DeleteContext(index))">
|
<ExpansionPanel HeaderText="@codingContext.Id" HeaderIcon="@Icons.Material.Filled.Code" ShowEndButton="@true" EndButtonColor="Color.Error" EndButtonIcon="@Icons.Material.Filled.Delete" EndButtonTooltip="@T("Delete context")" EndButtonClickAsync="@(() => this.DeleteContext(index))">
|
||||||
<CodingContextItem @bind-CodingContext="@codingContext"/>
|
<CodingContextItem @bind-CodingContext="@codingContext"/>
|
||||||
</ExpansionPanel>
|
</ExpansionPanel>
|
||||||
}
|
}
|
||||||
</MudExpansionPanels>
|
</MudExpansionPanels>
|
||||||
<MudButton Variant="Variant.Filled" OnClick="() => this.AddCodingContext()" Class="mb-3">
|
<MudButton Variant="Variant.Filled" OnClick="() => this.AddCodingContext()" Class="mb-3">
|
||||||
Add context
|
@T("Add context")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
|
||||||
<MudStack Row="@false" Class="mb-3">
|
<MudStack Row="@false" Class="mb-3">
|
||||||
<MudTextSwitch Label="Do you want to provide compiler messages?" @bind-Value="@this.provideCompilerMessages" LabelOn="Yes, provide compiler messages" LabelOff="No, there are no compiler messages" />
|
<MudTextSwitch Label="@T("Do you want to provide compiler messages?")" @bind-Value="@this.provideCompilerMessages" LabelOn="@T("Yes, provide compiler messages")" LabelOff="@T("No, there are no compiler messages")" />
|
||||||
@if (this.provideCompilerMessages)
|
@if (this.provideCompilerMessages)
|
||||||
{
|
{
|
||||||
<MudTextField T="string" @bind-Text="@this.compilerMessages" Validation="@this.ValidatingCompilerMessages" AdornmentIcon="@Icons.Material.Filled.Error" Adornment="Adornment.Start" Label="Compiler messages" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" @bind-Text="@this.compilerMessages" Validation="@this.ValidatingCompilerMessages" AdornmentIcon="@Icons.Material.Filled.Error" Adornment="Adornment.Start" Label="@T("Compiler messages")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
}
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<MudTextField T="string" @bind-Text="@this.questions" Validation="@this.ValidateQuestions" AdornmentIcon="@Icons.Material.Filled.QuestionMark" Adornment="Adornment.Start" Label="Your question(s)" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" @bind-Text="@this.questions" Validation="@this.ValidateQuestions" AdornmentIcon="@Icons.Material.Filled.QuestionMark" Adornment="Adornment.Start" Label="@T("Your question(s)")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||||
@@ -8,14 +8,9 @@ public partial class AssistantCoding : AssistantBaseCore<SettingsDialogCoding>
|
|||||||
{
|
{
|
||||||
public override Tools.Components Component => Tools.Components.CODING_ASSISTANT;
|
public override Tools.Components Component => Tools.Components.CODING_ASSISTANT;
|
||||||
|
|
||||||
protected override string Title => "Coding Assistant";
|
protected override string Title => T("Coding Assistant");
|
||||||
|
|
||||||
protected override string Description =>
|
protected override string Description => T("This coding assistant supports you in writing code. Provide some coding context by copying and pasting your code into the input fields. You might assign an ID to your code snippet to easily reference it later. When you have compiler messages, you can paste them into the input fields to get help with debugging as well.");
|
||||||
"""
|
|
||||||
This coding assistant supports you in writing code. Provide some coding context by copying and pasting
|
|
||||||
your code into the input fields. You might assign an ID to your code snippet to easily reference it later.
|
|
||||||
When you have compiler messages, you can paste them into the input fields to get help with debugging as well.
|
|
||||||
""";
|
|
||||||
|
|
||||||
protected override string SystemPrompt =>
|
protected override string SystemPrompt =>
|
||||||
"""
|
"""
|
||||||
@@ -30,7 +25,7 @@ public partial class AssistantCoding : AssistantBaseCore<SettingsDialogCoding>
|
|||||||
|
|
||||||
protected override IReadOnlyList<IButtonData> FooterButtons => [];
|
protected override IReadOnlyList<IButtonData> FooterButtons => [];
|
||||||
|
|
||||||
protected override string SubmitText => "Get Support";
|
protected override string SubmitText => T("Get Support");
|
||||||
|
|
||||||
protected override Func<Task> SubmitAction => this.GetSupport;
|
protected override Func<Task> SubmitAction => this.GetSupport;
|
||||||
|
|
||||||
@@ -80,7 +75,7 @@ public partial class AssistantCoding : AssistantBaseCore<SettingsDialogCoding>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(checkCompilerMessages))
|
if(string.IsNullOrWhiteSpace(checkCompilerMessages))
|
||||||
return "Please provide the compiler messages.";
|
return T("Please provide the compiler messages.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -88,7 +83,7 @@ public partial class AssistantCoding : AssistantBaseCore<SettingsDialogCoding>
|
|||||||
private string? ValidateQuestions(string checkQuestions)
|
private string? ValidateQuestions(string checkQuestions)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(checkQuestions))
|
if(string.IsNullOrWhiteSpace(checkQuestions))
|
||||||
return "Please provide your questions.";
|
return T("Please provide your questions.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -97,7 +92,7 @@ public partial class AssistantCoding : AssistantBaseCore<SettingsDialogCoding>
|
|||||||
{
|
{
|
||||||
this.codingContexts.Add(new()
|
this.codingContexts.Add(new()
|
||||||
{
|
{
|
||||||
Id = $"Context {this.codingContexts.Count + 1}",
|
Id = string.Format(T("Context {0}"), this.codingContexts.Count + 1),
|
||||||
Language = this.SettingsManager.ConfigurationData.Coding.PreselectOptions ? this.SettingsManager.ConfigurationData.Coding.PreselectedProgrammingLanguage : default,
|
Language = this.SettingsManager.ConfigurationData.Coding.PreselectOptions ? this.SettingsManager.ConfigurationData.Coding.PreselectedProgrammingLanguage : default,
|
||||||
OtherLanguage = this.SettingsManager.ConfigurationData.Coding.PreselectOptions ? this.SettingsManager.ConfigurationData.Coding.PreselectedOtherProgrammingLanguage : string.Empty,
|
OtherLanguage = this.SettingsManager.ConfigurationData.Coding.PreselectOptions ? this.SettingsManager.ConfigurationData.Coding.PreselectedOtherProgrammingLanguage : string.Empty,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
<MudTextField T="string" @bind-Text="@this.CodingContext.Id" AdornmentIcon="@Icons.Material.Filled.Numbers" Adornment="Adornment.Start" Label="(Optional) Identifier" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
@inherits MSGComponentBase
|
||||||
|
|
||||||
|
<MudTextField T="string" @bind-Text="@this.CodingContext.Id" AdornmentIcon="@Icons.Material.Filled.Numbers" Adornment="Adornment.Start" Label="@T("(Optional) Identifier")" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||||
<MudStack Row="@true" Class="mb-3">
|
<MudStack Row="@true" Class="mb-3">
|
||||||
<MudSelect T="CommonCodingLanguages" @bind-Value="@this.CodingContext.Language" AdornmentIcon="@Icons.Material.Filled.Code" Adornment="Adornment.Start" Label="Language" Variant="Variant.Outlined" Margin="Margin.Dense">
|
<MudSelect T="CommonCodingLanguages" @bind-Value="@this.CodingContext.Language" AdornmentIcon="@Icons.Material.Filled.Code" Adornment="Adornment.Start" Label="@T("Language")" Variant="Variant.Outlined" Margin="Margin.Dense">
|
||||||
@foreach (var language in Enum.GetValues<CommonCodingLanguages>())
|
@foreach (var language in Enum.GetValues<CommonCodingLanguages>())
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@language">@language.Name()</MudSelectItem>
|
<MudSelectItem Value="@language">
|
||||||
|
@language.Name()
|
||||||
|
</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
@if (this.CodingContext.Language is CommonCodingLanguages.OTHER)
|
@if (this.CodingContext.Language is CommonCodingLanguages.OTHER)
|
||||||
{
|
{
|
||||||
<MudTextField T="string" @bind-Text="@this.CodingContext.OtherLanguage" Validation="@this.ValidatingOtherLanguage" Label="Other language" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" @bind-Text="@this.CodingContext.OtherLanguage" Validation="@this.ValidatingOtherLanguage" Label="@T("Other language")" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
}
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
<MudTextField T="string" @bind-Text="@this.CodingContext.Code" Validation="@this.ValidatingCode" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="Your code" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" />
|
<MudTextField T="string" @bind-Text="@this.CodingContext.Code" Validation="@this.ValidatingCode" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your code")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" />
|
||||||
@@ -1,19 +1,16 @@
|
|||||||
using AIStudio.Settings;
|
using AIStudio.Components;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
namespace AIStudio.Assistants.Coding;
|
namespace AIStudio.Assistants.Coding;
|
||||||
|
|
||||||
public partial class CodingContextItem : ComponentBase
|
public partial class CodingContextItem : MSGComponentBase
|
||||||
{
|
{
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public CodingContext CodingContext { get; set; } = new();
|
public CodingContext CodingContext { get; set; } = new();
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<CodingContext> CodingContextChanged { get; set; }
|
public EventCallback<CodingContext> CodingContextChanged { get; set; }
|
||||||
|
|
||||||
[Inject]
|
|
||||||
protected SettingsManager SettingsManager { get; set; } = null!;
|
|
||||||
|
|
||||||
private static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();
|
private static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();
|
||||||
|
|
||||||
@@ -32,7 +29,7 @@ public partial class CodingContextItem : ComponentBase
|
|||||||
private string? ValidatingCode(string code)
|
private string? ValidatingCode(string code)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(code))
|
if(string.IsNullOrWhiteSpace(code))
|
||||||
return $"{this.CodingContext.Id}: Please provide your input.";
|
return string.Format(T("{0}: Please provide your input."), this.CodingContext.Id);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -43,7 +40,7 @@ public partial class CodingContextItem : ComponentBase
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(language))
|
if(string.IsNullOrWhiteSpace(language))
|
||||||
return "Please specify the language.";
|
return T("Please specify the language.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
public static class CommonCodingLanguageExtensions
|
public static class CommonCodingLanguageExtensions
|
||||||
{
|
{
|
||||||
|
private static string TB(string fallbackEN) => Tools.PluginSystem.I18N.I.T(fallbackEN, typeof(CommonCodingLanguageExtensions).Namespace, nameof(CommonCodingLanguageExtensions));
|
||||||
|
|
||||||
public static string Name(this CommonCodingLanguages language) => language switch
|
public static string Name(this CommonCodingLanguages language) => language switch
|
||||||
{
|
{
|
||||||
CommonCodingLanguages.NONE => "None",
|
CommonCodingLanguages.NONE => TB("None"),
|
||||||
|
|
||||||
CommonCodingLanguages.BASH => "Bash",
|
CommonCodingLanguages.BASH => "Bash",
|
||||||
CommonCodingLanguages.BLAZOR => ".NET Blazor",
|
CommonCodingLanguages.BLAZOR => ".NET Blazor",
|
||||||
@@ -37,7 +39,7 @@ public static class CommonCodingLanguageExtensions
|
|||||||
CommonCodingLanguages.TYPESCRIPT => "TypeScript",
|
CommonCodingLanguages.TYPESCRIPT => "TypeScript",
|
||||||
CommonCodingLanguages.XML => "XML",
|
CommonCodingLanguages.XML => "XML",
|
||||||
|
|
||||||
CommonCodingLanguages.OTHER => "Other",
|
CommonCodingLanguages.OTHER => TB("Other"),
|
||||||
_ => "Unknown"
|
_ => TB("Unknown")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -2,12 +2,14 @@ namespace AIStudio.Assistants.ERI;
|
|||||||
|
|
||||||
public static class AllowedLLMProvidersExtensions
|
public static class AllowedLLMProvidersExtensions
|
||||||
{
|
{
|
||||||
|
private static string TB(string fallbackEN) => Tools.PluginSystem.I18N.I.T(fallbackEN, typeof(AllowedLLMProvidersExtensions).Namespace, nameof(AllowedLLMProvidersExtensions));
|
||||||
|
|
||||||
public static string Description(this AllowedLLMProviders provider) => provider switch
|
public static string Description(this AllowedLLMProviders provider) => provider switch
|
||||||
{
|
{
|
||||||
AllowedLLMProviders.NONE => "Please select what kind of LLM provider are allowed for this data source",
|
AllowedLLMProviders.NONE => TB("Please select what kind of LLM provider are allowed for this data source"),
|
||||||
AllowedLLMProviders.ANY => "Any LLM provider is allowed: users might choose a cloud-based or a self-hosted provider",
|
AllowedLLMProviders.ANY => TB("Any LLM provider is allowed: users might choose a cloud-based or a self-hosted provider"),
|
||||||
AllowedLLMProviders.SELF_HOSTED => "Self-hosted LLM providers are allowed: users cannot choose any cloud-based provider",
|
AllowedLLMProviders.SELF_HOSTED => TB("Self-hosted LLM providers are allowed: users cannot choose any cloud-based provider"),
|
||||||
|
|
||||||
_ => "Unknown option was selected"
|
_ => TB("Unknown option was selected")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -4,36 +4,38 @@
|
|||||||
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogERIServer>
|
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogERIServer>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
You can imagine it like this: Hypothetically, when Wikipedia implemented the ERI, it would vectorize
|
@T("You can imagine it like this: Hypothetically, when Wikipedia implemented the ERI, it would vectorize all pages using an embedding method. All of Wikipedia’s data would remain with Wikipedia, including the vector database (decentralized approach). Then, any AI Studio user could add Wikipedia as a data source to significantly reduce the hallucination of the LLM in knowledge questions.")
|
||||||
all pages using an embedding method. All of Wikipedia’s data would remain with Wikipedia, including the
|
|
||||||
vector database (decentralized approach). Then, any AI Studio user could add Wikipedia as a data source to
|
|
||||||
significantly reduce the hallucination of the LLM in knowledge questions.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
<MudText Typo="Typo.body1">
|
<MudText Typo="Typo.body1">
|
||||||
<b>Related links:</b>
|
<b>
|
||||||
|
@T("Related links:")
|
||||||
|
</b>
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudList T="string" Class="mb-6">
|
<MudList T="string" Class="mb-6">
|
||||||
<MudListItem T="string" Icon="@Icons.Material.Filled.Link" Target="_blank" Href="https://github.com/MindWorkAI/ERI">ERI repository with example implementation in .NET and C#</MudListItem>
|
<MudListItem T="string" Icon="@Icons.Material.Filled.Link" Target="_blank" Href="https://github.com/MindWorkAI/ERI">
|
||||||
<MudListItem T="string" Icon="@Icons.Material.Filled.Link" Target="_blank" Href="https://mindworkai.org/swagger-ui.html">Interactive documentation aka Swagger UI</MudListItem>
|
@T("ERI repository with example implementation in .NET and C#")
|
||||||
|
</MudListItem>
|
||||||
|
<MudListItem T="string" Icon="@Icons.Material.Filled.Link" Target="_blank" Href="https://mindworkai.org/swagger-ui.html">
|
||||||
|
@T("Interactive documentation aka Swagger UI")
|
||||||
|
</MudListItem>
|
||||||
</MudList>
|
</MudList>
|
||||||
|
|
||||||
<PreviewPrototype/>
|
<PreviewPrototype/>
|
||||||
<div class="mb-6"></div>
|
<div class="mb-6"></div>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mb-3">
|
<MudText Typo="Typo.h4" Class="mb-3">
|
||||||
ERI server presets
|
@T("ERI server presets")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
Here you have the option to save different configurations for various ERI servers and switch between them. This is useful if
|
@T("Here you have the option to save different configurations for various ERI servers and switch between them. This is useful if you are responsible for multiple ERI servers.")
|
||||||
you are responsible for multiple ERI servers.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
@if(this.SettingsManager.ConfigurationData.ERI.ERIServers.Count is 0)
|
@if(this.SettingsManager.ConfigurationData.ERI.ERIServers.Count is 0)
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.body1" Class="mb-3">
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
You have not yet added any ERI server presets.
|
@T("You have not yet added any ERI server presets.")
|
||||||
</MudText>
|
</MudText>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -50,112 +52,116 @@ else
|
|||||||
|
|
||||||
<MudStack Row="@true" Class="mt-1">
|
<MudStack Row="@true" Class="mt-1">
|
||||||
<MudButton Disabled="@this.AreServerPresetsBlocked" OnClick="@this.AddERIServer" Variant="Variant.Filled" Color="Color.Primary">
|
<MudButton Disabled="@this.AreServerPresetsBlocked" OnClick="@this.AddERIServer" Variant="Variant.Filled" Color="Color.Primary">
|
||||||
Add ERI server preset
|
@T("Add ERI server preset")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
<MudButton OnClick="@this.RemoveERIServer" Disabled="@(this.AreServerPresetsBlocked || this.IsNoneERIServerSelected)" Variant="Variant.Filled" Color="Color.Error">
|
<MudButton OnClick="@this.RemoveERIServer" Disabled="@(this.AreServerPresetsBlocked || this.IsNoneERIServerSelected)" Variant="Variant.Filled" Color="Color.Error">
|
||||||
Delete this server preset
|
@T("Delete this server preset")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
@if(this.AreServerPresetsBlocked)
|
@if(this.AreServerPresetsBlocked)
|
||||||
{
|
{
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3 mt-3">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3 mt-3">
|
||||||
Hint: to allow this assistant to manage multiple presets, you must enable the preselection of values in the settings.
|
@T("Hint: to allow this assistant to manage multiple presets, you must enable the preselection of values in the settings.")
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
}
|
}
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mb-3 mt-6">
|
<MudText Typo="Typo.h4" Class="mb-3 mt-6">
|
||||||
Auto save
|
@T("Auto save")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
The ERI specification will change over time. You probably want to keep your ERI server up to date. This means you might want to
|
@T("The ERI specification will change over time. You probably want to keep your ERI server up to date. This means you might want to regenerate the code for your ERI server. To avoid having to make all inputs each time, all your inputs and decisions can be automatically saved. Would you like this?")
|
||||||
regenerate the code for your ERI server. To avoid having to make all inputs each time, all your inputs and decisions can be
|
|
||||||
automatically saved. Would you like this?
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
@if(this.AreServerPresetsBlocked)
|
@if(this.AreServerPresetsBlocked)
|
||||||
{
|
{
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
Hint: to allow this assistant to automatically save your changes, you must enable the preselection of values in the settings.
|
@T("Hint: to allow this assistant to automatically save your changes, you must enable the preselection of values in the settings.")
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
}
|
}
|
||||||
|
|
||||||
<MudTextSwitch Label="Should we automatically save any input made?" Disabled="@this.AreServerPresetsBlocked" @bind-Value="@this.autoSave" LabelOn="Yes, please save my inputs" LabelOff="No, I will enter everything again or configure it manually in the settings" />
|
<MudTextSwitch Label="@T("Should we automatically save any input made?")" Disabled="@this.AreServerPresetsBlocked" @bind-Value="@this.autoSave" LabelOn="@T("Yes, please save my inputs")" LabelOff="@T("No, I will enter everything again or configure it manually in the settings")" />
|
||||||
|
|
||||||
<hr style="width: 100%; border-width: 0.25ch;" class="mt-6"/>
|
<hr style="width: 100%; border-width: 0.25ch;" class="mt-6"/>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mt-6 mb-1">
|
<MudText Typo="Typo.h4" Class="mt-6 mb-1">
|
||||||
Common ERI server settings
|
@T("Common ERI server settings")
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudTextField T="string" Disabled="@this.IsNoneERIServerSelected" @bind-Text="@this.serverName" Validation="@this.ValidateServerName" Immediate="@true" Label="ERI server name" HelperText="Please give your ERI server a name that provides information about the data source and/or its intended purpose. The name will be displayed to users in AI Studio." Counter="60" MaxLength="60" Variant="Variant.Outlined" Margin="Margin.Normal" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3" OnKeyUp="() => this.ServerNameWasChanged()"/>
|
<MudTextField T="string" Disabled="@this.IsNoneERIServerSelected" @bind-Text="@this.serverName" Validation="@this.ValidateServerName" Immediate="@true" Label="@T("ERI server name")" HelperText="@T("Please give your ERI server a name that provides information about the data source and/or its intended purpose. The name will be displayed to users in AI Studio.")" Counter="60" MaxLength="60" Variant="Variant.Outlined" Margin="Margin.Normal" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3" OnKeyUp="() => this.ServerNameWasChanged()"/>
|
||||||
<MudTextField T="string" Disabled="@this.IsNoneERIServerSelected" @bind-Text="@this.serverDescription" Validation="@this.ValidateServerDescription" Immediate="@true" Label="ERI server description" HelperText="Please provide a brief description of your ERI server. Describe or explain what your ERI server does and what data it uses for this purpose. This description will be shown to users in AI Studio." Counter="512" MaxLength="512" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
<MudTextField T="string" Disabled="@this.IsNoneERIServerSelected" @bind-Text="@this.serverDescription" Validation="@this.ValidateServerDescription" Immediate="@true" Label="@T("ERI server description")" HelperText="@T("Please provide a brief description of your ERI server. Describe or explain what your ERI server does and what data it uses for this purpose. This description will be shown to users in AI Studio.")" Counter="512" MaxLength="512" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||||
|
|
||||||
<MudStack Row="@true" Class="mb-3">
|
<MudStack Row="@true" Class="mb-3">
|
||||||
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="ProgrammingLanguages" @bind-Value="@this.selectedProgrammingLanguage" AdornmentIcon="@Icons.Material.Filled.Code" Adornment="Adornment.Start" Label="Programming language" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateProgrammingLanguage">
|
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="ProgrammingLanguages" @bind-Value="@this.selectedProgrammingLanguage" AdornmentIcon="@Icons.Material.Filled.Code" Adornment="Adornment.Start" Label="@T("Programming language")" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateProgrammingLanguage">
|
||||||
@foreach (var language in Enum.GetValues<ProgrammingLanguages>())
|
@foreach (var language in Enum.GetValues<ProgrammingLanguages>())
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@language">@language.Name()</MudSelectItem>
|
<MudSelectItem Value="@language">
|
||||||
|
@language.Name()
|
||||||
|
</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
@if (this.selectedProgrammingLanguage is ProgrammingLanguages.OTHER)
|
@if (this.selectedProgrammingLanguage is ProgrammingLanguages.OTHER)
|
||||||
{
|
{
|
||||||
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.otherProgrammingLanguage" Validation="@this.ValidateOtherLanguage" Label="Other language" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.otherProgrammingLanguage" Validation="@this.ValidateOtherLanguage" Label="@T("Other language")" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
}
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<MudStack Row="@true" AlignItems="AlignItems.Center" Class="mb-3">
|
<MudStack Row="@true" AlignItems="AlignItems.Center" Class="mb-3">
|
||||||
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="ERIVersion" @bind-Value="@this.selectedERIVersion" Label="ERI specification version" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateERIVersion">
|
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="ERIVersion" @bind-Value="@this.selectedERIVersion" Label="@T("ERI specification version")" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateERIVersion">
|
||||||
@foreach (var version in Enum.GetValues<ERIVersion>())
|
@foreach (var version in Enum.GetValues<ERIVersion>())
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@version">@version</MudSelectItem>
|
<MudSelectItem Value="@version">
|
||||||
|
@version
|
||||||
|
</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!this.selectedERIVersion.WasSpecificationSelected() || this.IsNoneERIServerSelected)" Href="@this.selectedERIVersion.SpecificationURL()" Target="_blank">
|
<MudButton Variant="Variant.Outlined" Size="Size.Small" Disabled="@(!this.selectedERIVersion.WasSpecificationSelected() || this.IsNoneERIServerSelected)" Href="@this.selectedERIVersion.SpecificationURL()" Target="_blank">
|
||||||
<MudIcon Icon="@Icons.Material.Filled.Link" Class="mr-2"/> Download specification
|
<MudIcon Icon="@Icons.Material.Filled.Link" Class="mr-2"/> @T("Download specification")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mt-9 mb-3">
|
<MudText Typo="Typo.h4" Class="mt-9 mb-3">
|
||||||
Data source settings
|
@T("Data source settings")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudStack Row="@false" Spacing="1" Class="mb-3">
|
<MudStack Row="@false" Spacing="1" Class="mb-3">
|
||||||
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="DataSources" @bind-Value="@this.selectedDataSource" AdornmentIcon="@Icons.Material.Filled.Dataset" Adornment="Adornment.Start" Label="Data source" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateDataSource" SelectedValuesChanged="@this.DataSourceWasChanged">
|
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="DataSources" @bind-Value="@this.selectedDataSource" AdornmentIcon="@Icons.Material.Filled.Dataset" Adornment="Adornment.Start" Label="@T("Data source")" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateDataSource" SelectedValuesChanged="@this.DataSourceWasChanged">
|
||||||
@foreach (var dataSource in Enum.GetValues<DataSources>())
|
@foreach (var dataSource in Enum.GetValues<DataSources>())
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@dataSource">@dataSource.Name()</MudSelectItem>
|
<MudSelectItem Value="@dataSource">
|
||||||
|
@dataSource.Name()
|
||||||
|
</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
@if (this.selectedDataSource is DataSources.CUSTOM)
|
@if (this.selectedDataSource is DataSources.CUSTOM)
|
||||||
{
|
{
|
||||||
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.otherDataSource" Validation="@this.ValidateOtherDataSource" Label="Describe your data source" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.otherDataSource" Validation="@this.ValidateOtherDataSource" Label="@T("Describe your data source")" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
}
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|
||||||
@if(this.selectedDataSource > DataSources.FILE_SYSTEM)
|
@if(this.selectedDataSource > DataSources.FILE_SYSTEM)
|
||||||
{
|
{
|
||||||
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.dataSourceProductName" Label="Data source: product name" Validation="@this.ValidateDataSourceProductName" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.dataSourceProductName" Label="@T("Data source: product name")" Validation="@this.ValidateDataSourceProductName" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (this.NeedHostnamePort())
|
@if (this.NeedHostnamePort())
|
||||||
{
|
{
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<MudStack Row="@true">
|
<MudStack Row="@true">
|
||||||
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.dataSourceHostname" Label="Data source: hostname" Validation="@this.ValidateHostname" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.dataSourceHostname" Label="@T("Data source: hostname")" Validation="@this.ValidateHostname" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
<MudNumericField Disabled="@this.IsNoneERIServerSelected" Label="Data source: port" Immediate="@true" Min="1" Max="65535" Validation="@this.ValidatePort" @bind-Value="@this.dataSourcePort" Variant="Variant.Outlined" Margin="Margin.Dense" OnKeyUp="() => this.DataSourcePortWasTyped()"/>
|
<MudNumericField Disabled="@this.IsNoneERIServerSelected" Label="@T("Data source: port")" Immediate="@true" Min="1" Max="65535" Validation="@this.ValidatePort" @bind-Value="@this.dataSourcePort" Variant="Variant.Outlined" Margin="Margin.Dense" OnKeyUp="() => this.DataSourcePortWasTyped()"/>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
@if (this.dataSourcePort < 1024)
|
@if (this.dataSourcePort < 1024)
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.body2">
|
<MudText Typo="Typo.body2">
|
||||||
<b>Warning:</b> Ports below 1024 are reserved for system services. Your ERI server need to run with elevated permissions (root user).
|
<b>@T("Warning:")</b> @T("Ports below 1024 are reserved for system services. Your ERI server need to run with elevated permissions (root user).")
|
||||||
</MudText>
|
</MudText>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mt-9 mb-3">
|
<MudText Typo="Typo.h4" Class="mt-9 mb-3">
|
||||||
Authentication settings
|
@T("Authentication settings")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudStack Row="@false" Spacing="1" Class="mb-1">
|
<MudStack Row="@false" Spacing="1" Class="mb-1">
|
||||||
@@ -168,12 +174,14 @@ else
|
|||||||
SelectedValues="@this.selectedAuthenticationMethods"
|
SelectedValues="@this.selectedAuthenticationMethods"
|
||||||
Validation="@this.ValidateAuthenticationMethods"
|
Validation="@this.ValidateAuthenticationMethods"
|
||||||
SelectedValuesChanged="@this.AuthenticationMethodWasChanged"
|
SelectedValuesChanged="@this.AuthenticationMethodWasChanged"
|
||||||
Label="Authentication method(s)"
|
Label="@T("Authentication method(s)")"
|
||||||
Variant="Variant.Outlined"
|
Variant="Variant.Outlined"
|
||||||
Margin="Margin.Dense">
|
Margin="Margin.Dense">
|
||||||
@foreach (var authMethod in Enum.GetValues<Auth>())
|
@foreach (var authMethod in Enum.GetValues<Auth>())
|
||||||
{
|
{
|
||||||
<MudSelectItemExtended Value="@authMethod">@authMethod.Name()</MudSelectItemExtended>
|
<MudSelectItemExtended Value="@authMethod">
|
||||||
|
@authMethod.Name()
|
||||||
|
</MudSelectItemExtended>
|
||||||
}
|
}
|
||||||
</MudSelectExtended>
|
</MudSelectExtended>
|
||||||
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.authDescription" Label="@this.AuthDescriptionTitle()" Validation="@this.ValidateAuthDescription" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.authDescription" Label="@this.AuthDescriptionTitle()" Validation="@this.ValidateAuthDescription" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="6" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
@@ -181,40 +189,39 @@ else
|
|||||||
|
|
||||||
@if (this.selectedAuthenticationMethods.Contains(Auth.KERBEROS))
|
@if (this.selectedAuthenticationMethods.Contains(Auth.KERBEROS))
|
||||||
{
|
{
|
||||||
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="OperatingSystem" @bind-Value="@this.selectedOperatingSystem" Label="Operating system on which your ERI will run" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateOperatingSystem" Class="mb-1">
|
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="OperatingSystem" @bind-Value="@this.selectedOperatingSystem" Label="@T("Operating system on which your ERI will run")" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateOperatingSystem" Class="mb-1">
|
||||||
@foreach (var os in Enum.GetValues<OperatingSystem>())
|
@foreach (var os in Enum.GetValues<OperatingSystem>())
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@os">@os.Name()</MudSelectItem>
|
<MudSelectItem Value="@os">
|
||||||
|
@os.Name()
|
||||||
|
</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
}
|
}
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mt-11 mb-3">
|
<MudText Typo="Typo.h4" Class="mt-11 mb-3">
|
||||||
Data protection settings
|
@T("Data protection settings")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="AllowedLLMProviders" @bind-Value="@this.allowedLLMProviders" Label="Allowed LLM providers for this data source" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateAllowedLLMProviders" Class="mb-1">
|
<MudSelect Disabled="@this.IsNoneERIServerSelected" T="AllowedLLMProviders" @bind-Value="@this.allowedLLMProviders" Label="@T("Allowed LLM providers for this data source")" Variant="Variant.Outlined" Margin="Margin.Dense" Validation="@this.ValidateAllowedLLMProviders" Class="mb-1">
|
||||||
@foreach (var option in Enum.GetValues<AllowedLLMProviders>())
|
@foreach (var option in Enum.GetValues<AllowedLLMProviders>())
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@option">@option.Description()</MudSelectItem>
|
<MudSelectItem Value="@option">
|
||||||
|
@option.Description()
|
||||||
|
</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mt-11 mb-3">
|
<MudText Typo="Typo.h4" Class="mt-11 mb-3">
|
||||||
Embedding settings
|
@T("Embedding settings")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
||||||
You will likely use one or more embedding methods to encode the meaning of your data into a typically high-dimensional vector
|
@T("You will likely use one or more embedding methods to encode the meaning of your data into a typically high-dimensional vector space. In this case, you will use a vector database to store and search these vectors (called embeddings). However, you don't have to use embedding methods. When your retrieval method works without any embedding, you can ignore this section. An example: You store files on a file server, and your retrieval method works exclusively with file names in the file system, so you don't need embeddings.")
|
||||||
space. In this case, you will use a vector database to store and search these vectors (called embeddings). However, you don't
|
|
||||||
have to use embedding methods. When your retrieval method works without any embedding, you can ignore this section. An example: You
|
|
||||||
store files on a file server, and your retrieval method works exclusively with file names in the file system, so you don't
|
|
||||||
need embeddings.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||||
You can specify more than one embedding method. This can be useful when you want to use different embeddings for different queries
|
@T("You can specify more than one embedding method. This can be useful when you want to use different embeddings for different queries or data types. For example, one embedding for texts, another for images, and a third for videos, etc.")
|
||||||
or data types. For example, one embedding for texts, another for images, and a third for videos, etc.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
@if (!this.IsNoneERIServerSelected)
|
@if (!this.IsNoneERIServerSelected)
|
||||||
@@ -226,9 +233,9 @@ else
|
|||||||
<col style="width: 34em;"/>
|
<col style="width: 34em;"/>
|
||||||
</ColGroup>
|
</ColGroup>
|
||||||
<HeaderContent>
|
<HeaderContent>
|
||||||
<MudTh>Name</MudTh>
|
<MudTh>@T("Name")</MudTh>
|
||||||
<MudTh>Type</MudTh>
|
<MudTh>@T("Type")</MudTh>
|
||||||
<MudTh>Actions</MudTh>
|
<MudTh>@T("Actions")</MudTh>
|
||||||
</HeaderContent>
|
</HeaderContent>
|
||||||
<RowTemplate>
|
<RowTemplate>
|
||||||
<MudTd>@context.EmbeddingName</MudTd>
|
<MudTd>@context.EmbeddingName</MudTd>
|
||||||
@@ -236,10 +243,10 @@ else
|
|||||||
<MudTd>
|
<MudTd>
|
||||||
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
|
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditEmbedding(context)">
|
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditEmbedding(context)">
|
||||||
Edit
|
@T("Edit")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteEmbedding(context)">
|
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteEmbedding(context)">
|
||||||
Delete
|
@T("Delete")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudTd>
|
</MudTd>
|
||||||
@@ -248,23 +255,22 @@ else
|
|||||||
|
|
||||||
@if (this.embeddings.Count == 0)
|
@if (this.embeddings.Count == 0)
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.h6" Class="mt-3">No embedding methods configured yet.</MudText>
|
<MudText Typo="Typo.h6" Class="mt-3">
|
||||||
|
@T("No embedding methods configured yet.")
|
||||||
|
</MudText>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<MudButton Disabled="@this.IsNoneERIServerSelected" Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddEmbedding">
|
<MudButton Disabled="@this.IsNoneERIServerSelected" Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddEmbedding">
|
||||||
Add Embedding Method
|
@T("Add Embedding Method")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mt-6 mb-1">
|
<MudText Typo="Typo.h4" Class="mt-6 mb-1">
|
||||||
Data retrieval settings
|
@T("Data retrieval settings")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
||||||
For your ERI server, you need to retrieve data that matches a chat or prompt in some way. We call this the retrieval process.
|
@T("For your ERI server, you need to retrieve data that matches a chat or prompt in some way. We call this the retrieval process. You must describe at least one such process. You may offer several retrieval processes from which users can choose. This allows you to test with beta users which process works better. Or you might generally want to give users the choice so they can select the process that best suits their circumstances.")
|
||||||
You must describe at least one such process. You may offer several retrieval processes from which users can choose. This allows
|
|
||||||
you to test with beta users which process works better. Or you might generally want to give users the choice so they can select
|
|
||||||
the process that best suits their circumstances.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
@if (!this.IsNoneERIServerSelected)
|
@if (!this.IsNoneERIServerSelected)
|
||||||
@@ -275,18 +281,18 @@ else
|
|||||||
<col style="width: 34em;"/>
|
<col style="width: 34em;"/>
|
||||||
</ColGroup>
|
</ColGroup>
|
||||||
<HeaderContent>
|
<HeaderContent>
|
||||||
<MudTh>Name</MudTh>
|
<MudTh>@T("Name")</MudTh>
|
||||||
<MudTh>Actions</MudTh>
|
<MudTh>@T("Actions")</MudTh>
|
||||||
</HeaderContent>
|
</HeaderContent>
|
||||||
<RowTemplate>
|
<RowTemplate>
|
||||||
<MudTd>@context.Name</MudTd>
|
<MudTd>@context.Name</MudTd>
|
||||||
<MudTd>
|
<MudTd>
|
||||||
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
|
<MudStack Row="true" Class="mb-2 mt-2" Wrap="Wrap.Wrap">
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditRetrievalProcess(context)">
|
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" OnClick="() => this.EditRetrievalProcess(context)">
|
||||||
Edit
|
@T("Edit")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteRetrievalProcess(context)">
|
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" OnClick="() => this.DeleteRetrievalProcess(context)">
|
||||||
Delete
|
@T("Delete")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudTd>
|
</MudTd>
|
||||||
@@ -295,59 +301,47 @@ else
|
|||||||
|
|
||||||
@if (this.retrievalProcesses.Count == 0)
|
@if (this.retrievalProcesses.Count == 0)
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.h6" Class="mt-3">No retrieval process configured yet.</MudText>
|
<MudText Typo="Typo.h6" Class="mt-3">
|
||||||
|
@T("No retrieval process configured yet.")
|
||||||
|
</MudText>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<MudButton Disabled="@this.IsNoneERIServerSelected" Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddRetrievalProcess">
|
<MudButton Disabled="@this.IsNoneERIServerSelected" Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddRetrievalProcess">
|
||||||
Add Retrieval Process
|
@T("Add Retrieval Process")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-1">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-1">
|
||||||
You can integrate additional libraries. Perhaps you want to evaluate the prompts in advance using a machine learning method or analyze them with a text
|
@T("You can integrate additional libraries. Perhaps you want to evaluate the prompts in advance using a machine learning method or analyze them with a text mining approach? Or maybe you want to preprocess images in the prompts? For such advanced scenarios, you can specify which libraries you want to use here. It's best to describe which library you want to integrate for which purpose. This way, the LLM that writes the ERI server for you can try to use these libraries effectively. This should result in less rework being necessary. If you don't know the necessary libraries, you can instead attempt to describe the intended use. The LLM can then attempt to choose suitable libraries. However, hallucinations can occur, and fictional libraries might be selected.")
|
||||||
mining approach? Or maybe you want to preprocess images in the prompts? For such advanced scenarios, you can specify which libraries you want to use here.
|
|
||||||
It's best to describe which library you want to integrate for which purpose. This way, the LLM that writes the ERI server for you can try to use these
|
|
||||||
libraries effectively. This should result in less rework being necessary. If you don't know the necessary libraries, you can instead attempt to describe
|
|
||||||
the intended use. The LLM can then attempt to choose suitable libraries. However, hallucinations can occur, and fictional libraries might be selected.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.additionalLibraries" Label="(Optional) Additional libraries" HelperText="Do you want to include additional libraries? Then name them and briefly describe what you want to achieve with them." Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="12" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
<MudTextField Disabled="@this.IsNoneERIServerSelected" T="string" @bind-Text="@this.additionalLibraries" Label="@T("(Optional) Additional libraries")" HelperText="@T("Do you want to include additional libraries? Then name them and briefly describe what you want to achieve with them.")" Variant="Variant.Outlined" Margin="Margin.Normal" Lines="3" AutoGrow="@true" MaxLines="12" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mt-9 mb-1">
|
<MudText Typo="Typo.h4" Class="mt-9 mb-1">
|
||||||
Provider selection for generation
|
@T("Provider selection for generation")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
||||||
The task of writing the ERI server for you is very complex. Therefore, a very powerful LLM is needed to successfully accomplish this task.
|
@T("The task of writing the ERI server for you is very complex. Therefore, a very powerful LLM is needed to successfully accomplish this task. Small local models will probably not be sufficient. Instead, try using a large cloud-based or a large self-hosted model.")
|
||||||
Small local models will probably not be sufficient. Instead, try using a large cloud-based or a large self-hosted model.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
||||||
<b>Important:</b> The LLM may need to generate many files. This reaches the request limit of most providers. Typically, only a certain number
|
<b>@T("Important:")</b> @T("The LLM may need to generate many files. This reaches the request limit of most providers. Typically, only a certain number of requests can be made per minute, and only a maximum number of tokens can be generated per minute. AI Studio automatically considers this.") <b>@T("However, generating all the files takes a certain amount of time.")</b> @T("Local or self-hosted models may work without these limitations and can generate responses faster. AI Studio dynamically adapts its behavior and always tries to achieve the fastest possible data processing.")
|
||||||
of requests can be made per minute, and only a maximum number of tokens can be generated per minute. AI Studio automatically considers this.
|
|
||||||
<b>However, generating all the files takes a certain amount of time.</b> Local or self-hosted models may work without these limitations
|
|
||||||
and can generate responses faster. AI Studio dynamically adapts its behavior and always tries to achieve the fastest possible data processing.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||||
|
|
||||||
<MudText Typo="Typo.h4" Class="mt-9 mb-1">
|
<MudText Typo="Typo.h4" Class="mt-9 mb-1">
|
||||||
Write code to file system
|
@T("Write code to file system")
|
||||||
</MudText>
|
</MudText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
||||||
AI Studio can save the generated code to the file system. You can select a base folder for this. AI Studio ensures that no files are created
|
@T("AI Studio can save the generated code to the file system. You can select a base folder for this. AI Studio ensures that no files are created outside of this base folder. Furthermore, we recommend that you create a Git repository in this folder. This way, you can see what changes the AI has made in which files.")
|
||||||
outside of this base folder. Furthermore, we recommend that you create a Git repository in this folder. This way, you can see what changes the
|
|
||||||
AI has made in which files.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-2">
|
||||||
When you rebuild / re-generate the ERI server code, AI Studio proceeds as follows: All files generated last time will be deleted. All
|
@T("When you rebuild / re-generate the ERI server code, AI Studio proceeds as follows: All files generated last time will be deleted. All other files you have created remain. Then, the AI generates the new files.") <b>@T("But beware:")</b> @T("It may happen that the AI generates a file this time that you manually created last time. In this case, your manually created file will then be overwritten. Therefore, you should always create a Git repository and commit or revert all changes before using this assistant. With a diff visualization, you can immediately see where the AI has made changes. It is best to use an IDE suitable for your selected language for this purpose.")
|
||||||
other files you have created remain. Then, the AI generates the new files. <b>But beware:</b> It may happen that the AI generates a
|
|
||||||
file this time that you manually created last time. In this case, your manually created file will then be overwritten. Therefore,
|
|
||||||
you should always create a Git repository and commit or revert all changes before using this assistant. With a diff visualization,
|
|
||||||
you can immediately see where the AI has made changes. It is best to use an IDE suitable for your selected language for this purpose.
|
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
|
|
||||||
<MudTextSwitch Label="Should we write the generated code to the file system?" Disabled="@this.IsNoneERIServerSelected" @bind-Value="@this.writeToFilesystem" LabelOn="Yes, please write or update all generated code to the file system" LabelOff="No, just show me the code" />
|
<MudTextSwitch Label="@T("Should we write the generated code to the file system?")" Disabled="@this.IsNoneERIServerSelected" @bind-Value="@this.writeToFilesystem" LabelOn="@T("Yes, please write or update all generated code to the file system")" LabelOff="@T("No, just show me the code")" />
|
||||||
<SelectDirectory Label="Base directory where to write the code" @bind-Directory="@this.baseDirectory" Disabled="@(this.IsNoneERIServerSelected || !this.writeToFilesystem)" DirectoryDialogTitle="Select the target directory for the ERI server" Validation="@this.ValidateDirectory" />
|
<SelectDirectory Label="@T("Base directory where to write the code")" @bind-Directory="@this.baseDirectory" Disabled="@(this.IsNoneERIServerSelected || !this.writeToFilesystem)" DirectoryDialogTitle="@T("Select the target directory for the ERI server")" Validation="@this.ValidateDirectory" />
|
||||||
@@ -22,16 +22,9 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
|
|
||||||
public override Tools.Components Component => Tools.Components.ERI_ASSISTANT;
|
public override Tools.Components Component => Tools.Components.ERI_ASSISTANT;
|
||||||
|
|
||||||
protected override string Title => "ERI Server";
|
protected override string Title => T("ERI Server");
|
||||||
|
|
||||||
protected override string Description =>
|
protected override string Description => T("The ERI is the External Retrieval Interface for AI Studio and other tools. The ERI acts as a contract between decentralized data sources and, e.g., AI Studio. The ERI is implemented by the data sources, allowing them to be integrated into AI Studio later. This means that the data sources assume the server role and AI Studio (or any other LLM tool) assumes the client role of the API. This approach serves to realize a Retrieval-Augmented Generation (RAG) process with external data.");
|
||||||
"""
|
|
||||||
The ERI is the External Retrieval Interface for AI Studio and other tools. The ERI acts as a contract
|
|
||||||
between decentralized data sources and, e.g., AI Studio. The ERI is implemented by the data sources,
|
|
||||||
allowing them to be integrated into AI Studio later. This means that the data sources assume the server
|
|
||||||
role and AI Studio (or any other LLM tool) assumes the client role of the API. This approach serves to
|
|
||||||
realize a Retrieval-Augmented Generation (RAG) process with external data.
|
|
||||||
""";
|
|
||||||
|
|
||||||
protected override string SystemPrompt
|
protected override string SystemPrompt
|
||||||
{
|
{
|
||||||
@@ -44,7 +37,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
// Introduction
|
// Introduction
|
||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
//
|
//
|
||||||
var programmingLanguage = this.selectedProgrammingLanguage is ProgrammingLanguages.OTHER ? this.otherProgrammingLanguage : this.selectedProgrammingLanguage.Name();
|
var programmingLanguage = this.selectedProgrammingLanguage is ProgrammingLanguages.OTHER ? this.otherProgrammingLanguage : this.selectedProgrammingLanguage.ToPrompt();
|
||||||
sb.Append($"""
|
sb.Append($"""
|
||||||
# Introduction
|
# Introduction
|
||||||
You are an experienced {programmingLanguage} developer. Your task is to implement an API server in
|
You are an experienced {programmingLanguage} developer. Your task is to implement an API server in
|
||||||
@@ -159,7 +152,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
{
|
{
|
||||||
sb.Append($"""
|
sb.Append($"""
|
||||||
|
|
||||||
The server will run on {this.selectedOperatingSystem.Name()} operating systems. Keep
|
The server will run on {this.selectedOperatingSystem.ToPrompt()} operating systems. Keep
|
||||||
this in mind when implementing the SSO with Kerberos.
|
this in mind when implementing the SSO with Kerberos.
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
@@ -304,7 +297,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
|
|
||||||
protected override bool ShowSendTo => false;
|
protected override bool ShowSendTo => false;
|
||||||
|
|
||||||
protected override string SubmitText => "Create the ERI server";
|
protected override string SubmitText => T("Create the ERI server");
|
||||||
|
|
||||||
protected override Func<Task> SubmitAction => this.GenerateServer;
|
protected override Func<Task> SubmitAction => this.GenerateServer;
|
||||||
|
|
||||||
@@ -469,7 +462,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
{
|
{
|
||||||
this.SettingsManager.ConfigurationData.ERI.ERIServers.Add(new ()
|
this.SettingsManager.ConfigurationData.ERI.ERIServers.Add(new ()
|
||||||
{
|
{
|
||||||
ServerName = $"ERI Server {DateTimeOffset.UtcNow}",
|
ServerName = string.Format(T("ERI Server {0}"), DateTimeOffset.UtcNow),
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.SettingsManager.StoreSettings();
|
await this.SettingsManager.StoreSettings();
|
||||||
@@ -480,12 +473,12 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
if(this.selectedERIServer is null)
|
if(this.selectedERIServer is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters
|
var dialogParameters = new DialogParameters<ConfirmDialog>
|
||||||
{
|
{
|
||||||
{ "Message", $"Are you sure you want to delete the ERI server preset '{this.selectedERIServer.ServerName}'?" },
|
{ x => x.Message, string.Format(T("Are you sure you want to delete the ERI server preset '{0}'?"), this.selectedERIServer.ServerName) },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete ERI server preset", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete ERI server preset"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
var dialogResult = await dialogReference.Result;
|
var dialogResult = await dialogReference.Result;
|
||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
return;
|
||||||
@@ -518,13 +511,13 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
private string? ValidateServerName(string name)
|
private string? ValidateServerName(string name)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(name))
|
if(string.IsNullOrWhiteSpace(name))
|
||||||
return "Please provide a name for your ERI server. This name will be used to identify the server in AI Studio.";
|
return T("Please provide a name for your ERI server. This name will be used to identify the server in AI Studio.");
|
||||||
|
|
||||||
if(name.Length is > 60 or < 6)
|
if(name.Length is > 60 or < 6)
|
||||||
return "The name of your ERI server must be between 6 and 60 characters long.";
|
return T("The name of your ERI server must be between 6 and 60 characters long.");
|
||||||
|
|
||||||
if(this.SettingsManager.ConfigurationData.ERI.ERIServers.Where(n => n != this.selectedERIServer).Any(n => n.ServerName == name))
|
if(this.SettingsManager.ConfigurationData.ERI.ERIServers.Where(n => n != this.selectedERIServer).Any(n => n.ServerName == name))
|
||||||
return "An ERI server preset with this name already exists. Please choose a different name.";
|
return T("An ERI server preset with this name already exists. Please choose a different name.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -532,10 +525,10 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
private string? ValidateServerDescription(string description)
|
private string? ValidateServerDescription(string description)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(description))
|
if(string.IsNullOrWhiteSpace(description))
|
||||||
return "Please provide a description for your ERI server. What data will the server retrieve? This description will be used to inform users about the purpose of your ERI server.";
|
return T("Please provide a description for your ERI server. What data will the server retrieve? This description will be used to inform users about the purpose of your ERI server.");
|
||||||
|
|
||||||
if(description.Length is < 32 or > 512)
|
if(description.Length is < 32 or > 512)
|
||||||
return "The description of your ERI server must be between 32 and 512 characters long.";
|
return T("The description of your ERI server must be between 32 and 512 characters long.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -543,7 +536,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
private string? ValidateERIVersion(ERIVersion version)
|
private string? ValidateERIVersion(ERIVersion version)
|
||||||
{
|
{
|
||||||
if (version == ERIVersion.NONE)
|
if (version == ERIVersion.NONE)
|
||||||
return "Please select an ERI specification version for the ERI server.";
|
return T("Please select an ERI specification version for the ERI server.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -554,7 +547,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (language == ProgrammingLanguages.NONE)
|
if (language == ProgrammingLanguages.NONE)
|
||||||
return "Please select a programming language for the ERI server.";
|
return T("Please select a programming language for the ERI server.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -565,7 +558,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(language))
|
if(string.IsNullOrWhiteSpace(language))
|
||||||
return "Please specify the custom programming language for the ERI server.";
|
return T("Please specify the custom programming language for the ERI server.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -576,7 +569,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (dataSource == DataSources.NONE)
|
if (dataSource == DataSources.NONE)
|
||||||
return "Please select a data source for the ERI server.";
|
return T("Please select a data source for the ERI server.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -587,7 +580,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(productName))
|
if(string.IsNullOrWhiteSpace(productName))
|
||||||
return "Please specify the product name of the data source, e.g., 'MongoDB', 'Redis', 'PostgreSQL', 'Neo4j', or 'MinIO', etc.";
|
return T("Please specify the product name of the data source, e.g., 'MongoDB', 'Redis', 'PostgreSQL', 'Neo4j', or 'MinIO', etc.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -598,7 +591,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(dataSource))
|
if(string.IsNullOrWhiteSpace(dataSource))
|
||||||
return "Please describe the data source of your ERI server.";
|
return T("Please describe the data source of your ERI server.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -613,10 +606,10 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(hostname))
|
if(string.IsNullOrWhiteSpace(hostname))
|
||||||
return "Please provide the hostname of the data source. Use 'localhost' if the data source is on the same machine as the ERI server.";
|
return T("Please provide the hostname of the data source. Use 'localhost' if the data source is on the same machine as the ERI server.");
|
||||||
|
|
||||||
if(hostname.Length > 255)
|
if(hostname.Length > 255)
|
||||||
return "The hostname of the data source must not exceed 255 characters.";
|
return T("The hostname of the data source must not exceed 255 characters.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -631,10 +624,10 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(port is null)
|
if(port is null)
|
||||||
return "Please provide the port of the data source.";
|
return T("Please provide the port of the data source.");
|
||||||
|
|
||||||
if(port is < 1 or > 65535)
|
if(port is < 1 or > 65535)
|
||||||
return "The port of the data source must be between 1 and 65535.";
|
return T("The port of the data source must be between 1 and 65535.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -679,7 +672,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
{
|
{
|
||||||
var authenticationMethods = (this.selectedAuthenticationMethods as HashSet<Auth>)!;
|
var authenticationMethods = (this.selectedAuthenticationMethods as HashSet<Auth>)!;
|
||||||
if(authenticationMethods.Count == 0)
|
if(authenticationMethods.Count == 0)
|
||||||
return "Please select at least one authentication method for the ERI server.";
|
return T("Please select at least one authentication method for the ERI server.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -709,7 +702,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(os is OperatingSystem.NONE)
|
if(os is OperatingSystem.NONE)
|
||||||
return "Please select the operating system on which the ERI server will run. This is necessary when using SSO with Kerberos.";
|
return T("Please select the operating system on which the ERI server will run. This is necessary when using SSO with Kerberos.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -717,16 +710,12 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
private string? ValidateAllowedLLMProviders(AllowedLLMProviders provider)
|
private string? ValidateAllowedLLMProviders(AllowedLLMProviders provider)
|
||||||
{
|
{
|
||||||
if(provider == AllowedLLMProviders.NONE)
|
if(provider == AllowedLLMProviders.NONE)
|
||||||
return "Please select which types of LLMs users are allowed to use with the data from this ERI server.";
|
return T("Please select which types of LLMs users are allowed to use with the data from this ERI server.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string AuthDescriptionTitle()
|
private string AuthDescriptionTitle() => this.IsAuthDescriptionOptional() ? T("(Optional) Describe how you planned the authentication process") : T("Describe how you planned the authentication process");
|
||||||
{
|
|
||||||
const string TITLE = "Describe how you planned the authentication process";
|
|
||||||
return this.IsAuthDescriptionOptional() ? $"(Optional) {TITLE}" : TITLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsAuthDescriptionOptional()
|
private bool IsAuthDescriptionOptional()
|
||||||
{
|
{
|
||||||
@@ -746,10 +735,10 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
{
|
{
|
||||||
var authenticationMethods = (this.selectedAuthenticationMethods as HashSet<Auth>)!;
|
var authenticationMethods = (this.selectedAuthenticationMethods as HashSet<Auth>)!;
|
||||||
if(authenticationMethods.Any(n => n == Auth.NONE) && authenticationMethods.Count > 1 && string.IsNullOrWhiteSpace(this.authDescription))
|
if(authenticationMethods.Any(n => n == Auth.NONE) && authenticationMethods.Count > 1 && string.IsNullOrWhiteSpace(this.authDescription))
|
||||||
return "Please describe how the selected authentication methods should be used. Especially, explain for what data the NONE method (public access) is used.";
|
return T("Please describe how the selected authentication methods should be used. Especially, explain for what data the NONE method (public access) is used.");
|
||||||
|
|
||||||
if(authenticationMethods.Count > 1 && string.IsNullOrWhiteSpace(this.authDescription))
|
if(authenticationMethods.Count > 1 && string.IsNullOrWhiteSpace(this.authDescription))
|
||||||
return "Please describe how the selected authentication methods should be used.";
|
return T("Please describe how the selected authentication methods should be used.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -760,7 +749,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(path))
|
if(string.IsNullOrWhiteSpace(path))
|
||||||
return "Please provide a base directory for the ERI server to write files to.";
|
return T("Please provide a base directory for the ERI server to write files to.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -768,12 +757,12 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
private string GetMultiSelectionAuthText(List<Auth> selectedValues)
|
private string GetMultiSelectionAuthText(List<Auth> selectedValues)
|
||||||
{
|
{
|
||||||
if(selectedValues.Count == 0)
|
if(selectedValues.Count == 0)
|
||||||
return "Please select at least one authentication method";
|
return T("Please select at least one authentication method");
|
||||||
|
|
||||||
if(selectedValues.Count == 1)
|
if(selectedValues.Count == 1)
|
||||||
return $"You have selected 1 authentication method";
|
return T("You have selected 1 authentication method");
|
||||||
|
|
||||||
return $"You have selected {selectedValues.Count} authentication methods";
|
return string.Format(T("You have selected {0} authentication methods"), selectedValues.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool NeedHostnamePort()
|
private bool NeedHostnamePort()
|
||||||
@@ -797,7 +786,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
{ x => x.UsedEmbeddingMethodNames, this.embeddings.Select(n => n.EmbeddingName).ToList() },
|
{ x => x.UsedEmbeddingMethodNames, this.embeddings.Select(n => n.EmbeddingName).ToList() },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<EmbeddingMethodDialog>("Add Embedding Method", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<EmbeddingMethodDialog>(T("Add Embedding Method"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
var dialogResult = await dialogReference.Result;
|
var dialogResult = await dialogReference.Result;
|
||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
return;
|
||||||
@@ -821,7 +810,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
{ x => x.IsEditing, true },
|
{ x => x.IsEditing, true },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<EmbeddingMethodDialog>("Edit Embedding Method", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<EmbeddingMethodDialog>(T("Edit Embedding Method"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
var dialogResult = await dialogReference.Result;
|
var dialogResult = await dialogReference.Result;
|
||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
return;
|
||||||
@@ -835,15 +824,15 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
private async Task DeleteEmbedding(EmbeddingInfo embeddingInfo)
|
private async Task DeleteEmbedding(EmbeddingInfo embeddingInfo)
|
||||||
{
|
{
|
||||||
var message = this.retrievalProcesses.Any(n => n.Embeddings?.Contains(embeddingInfo) is true)
|
var message = this.retrievalProcesses.Any(n => n.Embeddings?.Contains(embeddingInfo) is true)
|
||||||
? $"The embedding '{embeddingInfo.EmbeddingName}' is used in one or more retrieval processes. Are you sure you want to delete it?"
|
? string.Format(T("The embedding '{0}' is used in one or more retrieval processes. Are you sure you want to delete it?"), embeddingInfo.EmbeddingName)
|
||||||
: $"Are you sure you want to delete the embedding '{embeddingInfo.EmbeddingName}'?";
|
: string.Format(T("Are you sure you want to delete the embedding '{0}'?"), embeddingInfo.EmbeddingName);
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters
|
var dialogParameters = new DialogParameters<ConfirmDialog>
|
||||||
{
|
{
|
||||||
{ "Message", message },
|
{ x => x.Message, message },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Embedding", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Embedding"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
var dialogResult = await dialogReference.Result;
|
var dialogResult = await dialogReference.Result;
|
||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
return;
|
||||||
@@ -863,7 +852,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
{ x => x.UsedRetrievalProcessNames, this.retrievalProcesses.Select(n => n.Name).ToList() },
|
{ x => x.UsedRetrievalProcessNames, this.retrievalProcesses.Select(n => n.Name).ToList() },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<RetrievalProcessDialog>("Add Retrieval Process", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<RetrievalProcessDialog>(T("Add Retrieval Process"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
var dialogResult = await dialogReference.Result;
|
var dialogResult = await dialogReference.Result;
|
||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
return;
|
||||||
@@ -888,7 +877,7 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
{ x => x.UsedRetrievalProcessNames, this.retrievalProcesses.Where(n => n != retrievalInfo).Select(n => n.Name).ToList() },
|
{ x => x.UsedRetrievalProcessNames, this.retrievalProcesses.Where(n => n != retrievalInfo).Select(n => n.Name).ToList() },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<RetrievalProcessDialog>("Edit Retrieval Process", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<RetrievalProcessDialog>(T("Edit Retrieval Process"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
var dialogResult = await dialogReference.Result;
|
var dialogResult = await dialogReference.Result;
|
||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
return;
|
||||||
@@ -901,12 +890,12 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
|
|
||||||
private async Task DeleteRetrievalProcess(RetrievalInfo retrievalInfo)
|
private async Task DeleteRetrievalProcess(RetrievalInfo retrievalInfo)
|
||||||
{
|
{
|
||||||
var dialogParameters = new DialogParameters
|
var dialogParameters = new DialogParameters<ConfirmDialog>
|
||||||
{
|
{
|
||||||
{ "Message", $"Are you sure you want to delete the retrieval process '{retrievalInfo.Name}'?" },
|
{ x => x.Message, string.Format(T("Are you sure you want to delete the retrieval process '{0}'?"), retrievalInfo.Name) },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Retrieval Process", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>(T("Delete Retrieval Process"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
var dialogResult = await dialogReference.Result;
|
var dialogResult = await dialogReference.Result;
|
||||||
if (dialogResult is null || dialogResult.Canceled)
|
if (dialogResult is null || dialogResult.Canceled)
|
||||||
return;
|
return;
|
||||||
@@ -957,14 +946,14 @@ public partial class AssistantERI : AssistantBaseCore<SettingsDialogERIServer>
|
|||||||
|
|
||||||
if(this.retrievalProcesses.Count == 0)
|
if(this.retrievalProcesses.Count == 0)
|
||||||
{
|
{
|
||||||
this.AddInputIssue("Please describe at least one retrieval process.");
|
this.AddInputIssue(T("Please describe at least one retrieval process."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.eriSpecification = await this.selectedERIVersion.ReadSpecification(this.HttpClient);
|
this.eriSpecification = await this.selectedERIVersion.ReadSpecification(this.HttpClient);
|
||||||
if (string.IsNullOrWhiteSpace(this.eriSpecification))
|
if (string.IsNullOrWhiteSpace(this.eriSpecification))
|
||||||
{
|
{
|
||||||
this.AddInputIssue("The ERI specification could not be loaded. Please try again later.");
|
this.AddInputIssue(T("The ERI specification could not be loaded. Please try again later."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,17 @@ namespace AIStudio.Assistants.ERI;
|
|||||||
|
|
||||||
public static class AuthExtensions
|
public static class AuthExtensions
|
||||||
{
|
{
|
||||||
|
private static string TB(string fallbackEN) => Tools.PluginSystem.I18N.I.T(fallbackEN, typeof(AuthExtensions).Namespace, nameof(AuthExtensions));
|
||||||
|
|
||||||
public static string Name(this Auth auth) => auth switch
|
public static string Name(this Auth auth) => auth switch
|
||||||
{
|
{
|
||||||
Auth.NONE => "No login necessary: useful for public data sources",
|
Auth.NONE => TB("No login necessary: useful for public data sources"),
|
||||||
|
|
||||||
Auth.KERBEROS => "Login by single-sign-on (SSO) using Kerberos: very complex to implement and to operate, useful for many users",
|
Auth.KERBEROS => TB("Login by single-sign-on (SSO) using Kerberos: very complex to implement and to operate, useful for many users"),
|
||||||
Auth.USERNAME_PASSWORD => "Login by username and password: simple to implement and to operate, useful for few users; easy to use for users",
|
Auth.USERNAME_PASSWORD => TB("Login by username and password: simple to implement and to operate, useful for few users; easy to use for users"),
|
||||||
Auth.TOKEN => "Login by token: simple to implement and to operate, useful for few users; unusual for many users",
|
Auth.TOKEN => TB("Login by token: simple to implement and to operate, useful for few users; unusual for many users"),
|
||||||
|
|
||||||
_ => "Unknown login method"
|
_ => TB("Unknown login method")
|
||||||
};
|
};
|
||||||
|
|
||||||
public static string ToPrompt(this Auth auth) => auth switch
|
public static string ToPrompt(this Auth auth) => auth switch
|
||||||
|
|||||||
@@ -2,18 +2,20 @@ namespace AIStudio.Assistants.ERI;
|
|||||||
|
|
||||||
public static class DataSourcesExtensions
|
public static class DataSourcesExtensions
|
||||||
{
|
{
|
||||||
|
private static string TB(string fallbackEN) => Tools.PluginSystem.I18N.I.T(fallbackEN, typeof(DataSourcesExtensions).Namespace, nameof(DataSourcesExtensions));
|
||||||
|
|
||||||
public static string Name(this DataSources dataSource) => dataSource switch
|
public static string Name(this DataSources dataSource) => dataSource switch
|
||||||
{
|
{
|
||||||
DataSources.NONE => "No data source selected",
|
DataSources.NONE => TB("No data source selected"),
|
||||||
DataSources.CUSTOM => "Custom description",
|
DataSources.CUSTOM => TB("Custom description"),
|
||||||
|
|
||||||
DataSources.FILE_SYSTEM => "File system (local or network share)",
|
DataSources.FILE_SYSTEM => TB("File system (local or network share)"),
|
||||||
DataSources.OBJECT_STORAGE => "Object storage, like Amazon S3, MinIO, etc.",
|
DataSources.OBJECT_STORAGE => TB("Object storage, like Amazon S3, MinIO, etc."),
|
||||||
DataSources.KEY_VALUE_STORE => "Key-Value store, like Redis, etc.",
|
DataSources.KEY_VALUE_STORE => TB("Key-Value store, like Redis, etc."),
|
||||||
DataSources.DOCUMENT_STORE => "Document store, like MongoDB, etc.",
|
DataSources.DOCUMENT_STORE => TB("Document store, like MongoDB, etc."),
|
||||||
DataSources.RELATIONAL_DATABASE => "Relational database, like MySQL, PostgreSQL, etc.",
|
DataSources.RELATIONAL_DATABASE => TB("Relational database, like MySQL, PostgreSQL, etc."),
|
||||||
DataSources.GRAPH_DATABASE => "Graph database, like Neo4j, ArangoDB, etc.",
|
DataSources.GRAPH_DATABASE => TB("Graph database, like Neo4j, ArangoDB, etc."),
|
||||||
|
|
||||||
_ => "Unknown data source"
|
_ => TB("Unknown data source")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,19 @@ namespace AIStudio.Assistants.ERI;
|
|||||||
|
|
||||||
public static class OperatingSystemExtensions
|
public static class OperatingSystemExtensions
|
||||||
{
|
{
|
||||||
|
private static string TB(string fallbackEN) => Tools.PluginSystem.I18N.I.T(fallbackEN, typeof(OperatingSystemExtensions).Namespace, nameof(OperatingSystemExtensions));
|
||||||
|
|
||||||
public static string Name(this OperatingSystem os) => os switch
|
public static string Name(this OperatingSystem os) => os switch
|
||||||
|
{
|
||||||
|
OperatingSystem.NONE => TB("No operating system specified"),
|
||||||
|
|
||||||
|
OperatingSystem.WINDOWS => TB("Windows"),
|
||||||
|
OperatingSystem.LINUX => TB("Linux"),
|
||||||
|
|
||||||
|
_ => TB("Unknown operating system")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string ToPrompt(this OperatingSystem os) => os switch
|
||||||
{
|
{
|
||||||
OperatingSystem.NONE => "No operating system specified",
|
OperatingSystem.NONE => "No operating system specified",
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,29 @@ namespace AIStudio.Assistants.ERI;
|
|||||||
|
|
||||||
public static class ProgrammingLanguagesExtensions
|
public static class ProgrammingLanguagesExtensions
|
||||||
{
|
{
|
||||||
|
private static string TB(string fallbackEN) => Tools.PluginSystem.I18N.I.T(fallbackEN, typeof(ProgrammingLanguagesExtensions).Namespace, nameof(ProgrammingLanguagesExtensions));
|
||||||
|
|
||||||
public static string Name(this ProgrammingLanguages language) => language switch
|
public static string Name(this ProgrammingLanguages language) => language switch
|
||||||
|
{
|
||||||
|
ProgrammingLanguages.NONE => TB("No programming language selected"),
|
||||||
|
|
||||||
|
ProgrammingLanguages.C => "C",
|
||||||
|
ProgrammingLanguages.CPP => "C++",
|
||||||
|
ProgrammingLanguages.CSHARP => "C#",
|
||||||
|
ProgrammingLanguages.GO => "Go",
|
||||||
|
ProgrammingLanguages.JAVA => "Java",
|
||||||
|
ProgrammingLanguages.JAVASCRIPT => "JavaScript",
|
||||||
|
ProgrammingLanguages.JULIA => "Julia",
|
||||||
|
ProgrammingLanguages.MATLAB => "MATLAB",
|
||||||
|
ProgrammingLanguages.PHP => "PHP",
|
||||||
|
ProgrammingLanguages.PYTHON => "Python",
|
||||||
|
ProgrammingLanguages.RUST => "Rust",
|
||||||
|
|
||||||
|
ProgrammingLanguages.OTHER => TB("Other"),
|
||||||
|
_ => TB("Unknown")
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string ToPrompt(this ProgrammingLanguages language) => language switch
|
||||||
{
|
{
|
||||||
ProgrammingLanguages.NONE => "No programming language selected",
|
ProgrammingLanguages.NONE => "No programming language selected",
|
||||||
|
|
||||||
|
|||||||
@@ -2,35 +2,35 @@
|
|||||||
@using AIStudio.Settings
|
@using AIStudio.Settings
|
||||||
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogI18N>
|
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogI18N>
|
||||||
|
|
||||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidatingTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="Target language" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="Custom target language" SelectionUpdated="_ => this.OnChangedLanguage()" />
|
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelecting())" @bind-Value="@this.selectedTargetLanguage" ValidateSelection="@this.ValidatingTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" SelectionUpdated="_ => this.OnChangedLanguage()" />
|
||||||
<ConfigurationSelect OptionDescription="Language plugin used for comparision" SelectedValue="@(() => this.selectedLanguagePluginId)" Data="@ConfigurationSelectDataFactory.GetLanguagesData()" SelectionUpdate="@(async void (id) => await this.OnLanguagePluginChanged(id))" OptionHelp="Select the language plugin used for comparision."/>
|
<ConfigurationSelect OptionDescription="@T("Language plugin used for comparision")" SelectedValue="@(() => this.selectedLanguagePluginId)" Data="@ConfigurationSelectDataFactory.GetLanguagesData()" SelectionUpdate="@(async void (id) => await this.OnLanguagePluginChanged(id))" OptionHelp="@T("Select the language plugin used for comparision.")"/>
|
||||||
@if (this.isLoading)
|
@if (this.isLoading)
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.body1" Class="mb-6">
|
<MudText Typo="Typo.body1" Class="mb-6">
|
||||||
The data is being loaded, please wait...
|
@T("The data is being loaded, please wait...")
|
||||||
</MudText>
|
</MudText>
|
||||||
} else if (!this.isLoading && !string.IsNullOrWhiteSpace(this.loadingIssue))
|
} else if (!this.isLoading && !string.IsNullOrWhiteSpace(this.loadingIssue))
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.body1" Class="mb-6">
|
<MudText Typo="Typo.body1" Class="mb-6">
|
||||||
While loading the I18N data, an issue occurred: @this.loadingIssue
|
@T("While loading the I18N data, an issue occurred:") @this.loadingIssue
|
||||||
</MudText>
|
</MudText>
|
||||||
}
|
}
|
||||||
else if (!this.isLoading && string.IsNullOrWhiteSpace(this.loadingIssue))
|
else if (!this.isLoading && string.IsNullOrWhiteSpace(this.loadingIssue))
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.h6">
|
<MudText Typo="Typo.h6">
|
||||||
Added Content (@this.addedContent.Count entries)
|
@this.AddedContentText
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudTable Items="@this.addedContent" Hover="@true" Filter="@this.FilterFunc" Class="border-dashed border rounded-lg mb-6">
|
<MudTable Items="@this.addedContent" Hover="@true" Filter="@this.FilterFunc" Class="border-dashed border rounded-lg mb-6">
|
||||||
<ToolBarContent>
|
<ToolBarContent>
|
||||||
<MudTextField @bind-Value="@this.searchString" Immediate="true" Placeholder="Search" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"/>
|
<MudTextField @bind-Value="@this.searchString" Immediate="true" Placeholder="@T("Search")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"/>
|
||||||
</ToolBarContent>
|
</ToolBarContent>
|
||||||
<ColGroup>
|
<ColGroup>
|
||||||
<col/>
|
<col/>
|
||||||
<col/>
|
<col/>
|
||||||
</ColGroup>
|
</ColGroup>
|
||||||
<HeaderContent>
|
<HeaderContent>
|
||||||
<MudTh>Key</MudTh>
|
<MudTh>@T("Key")</MudTh>
|
||||||
<MudTh>Text</MudTh>
|
<MudTh>@T("Text")</MudTh>
|
||||||
</HeaderContent>
|
</HeaderContent>
|
||||||
<RowTemplate>
|
<RowTemplate>
|
||||||
<MudTd>
|
<MudTd>
|
||||||
@@ -48,19 +48,19 @@ else if (!this.isLoading && string.IsNullOrWhiteSpace(this.loadingIssue))
|
|||||||
</MudTable>
|
</MudTable>
|
||||||
|
|
||||||
<MudText Typo="Typo.h6">
|
<MudText Typo="Typo.h6">
|
||||||
Removed Content (@this.removedContent.Count entries)
|
@this.RemovedContentText
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudTable Items="@this.removedContent" Hover="@true" Filter="@this.FilterFunc" Class="border-dashed border rounded-lg mb-6">
|
<MudTable Items="@this.removedContent" Hover="@true" Filter="@this.FilterFunc" Class="border-dashed border rounded-lg mb-6">
|
||||||
<ToolBarContent>
|
<ToolBarContent>
|
||||||
<MudTextField @bind-Value="@this.searchString" Immediate="true" Placeholder="Search" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"/>
|
<MudTextField @bind-Value="@this.searchString" Immediate="true" Placeholder="@T("Search")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"/>
|
||||||
</ToolBarContent>
|
</ToolBarContent>
|
||||||
<ColGroup>
|
<ColGroup>
|
||||||
<col/>
|
<col/>
|
||||||
<col/>
|
<col/>
|
||||||
</ColGroup>
|
</ColGroup>
|
||||||
<HeaderContent>
|
<HeaderContent>
|
||||||
<MudTh>Key</MudTh>
|
<MudTh>@T("Key")</MudTh>
|
||||||
<MudTh>Text</MudTh>
|
<MudTh>@T("Text")</MudTh>
|
||||||
</HeaderContent>
|
</HeaderContent>
|
||||||
<RowTemplate>
|
<RowTemplate>
|
||||||
<MudTd>
|
<MudTd>
|
||||||
@@ -80,7 +80,7 @@ else if (!this.isLoading && string.IsNullOrWhiteSpace(this.loadingIssue))
|
|||||||
@if (this.selectedTargetLanguage is CommonLanguages.EN_US)
|
@if (this.selectedTargetLanguage is CommonLanguages.EN_US)
|
||||||
{
|
{
|
||||||
<MudJustifiedText Typo="Typo.body1" Class="mb-6">
|
<MudJustifiedText Typo="Typo.body1" Class="mb-6">
|
||||||
Please note: neither is a translation needed nor performed for English (USA). Anyway, you might want to generate the related Lua code.
|
@T("Please note: neither is a translation needed nor performed for English (USA). Anyway, you might want to generate the related Lua code.")
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -92,19 +92,19 @@ else if (!this.isLoading && string.IsNullOrWhiteSpace(this.loadingIssue))
|
|||||||
{
|
{
|
||||||
<hr style="width: 100%; border-width: 0.25ch;" class="mt-6 mb-6"/>
|
<hr style="width: 100%; border-width: 0.25ch;" class="mt-6 mb-6"/>
|
||||||
<MudText Typo="Typo.h6">
|
<MudText Typo="Typo.h6">
|
||||||
Localized Content (@this.localizedContent.Count entries of @this.NumTotalItems)
|
@this.LocalizedContentText
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudTable Items="@this.localizedContent" Hover="@true" Filter="@this.FilterFunc" Class="border-dashed border rounded-lg mb-6">
|
<MudTable Items="@this.localizedContent" Hover="@true" Filter="@this.FilterFunc" Class="border-dashed border rounded-lg mb-6">
|
||||||
<ToolBarContent>
|
<ToolBarContent>
|
||||||
<MudTextField @bind-Value="@this.searchString" Immediate="true" Placeholder="Search" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"/>
|
<MudTextField @bind-Value="@this.searchString" Immediate="true" Placeholder="@T("Search")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0"/>
|
||||||
</ToolBarContent>
|
</ToolBarContent>
|
||||||
<ColGroup>
|
<ColGroup>
|
||||||
<col/>
|
<col/>
|
||||||
<col/>
|
<col/>
|
||||||
</ColGroup>
|
</ColGroup>
|
||||||
<HeaderContent>
|
<HeaderContent>
|
||||||
<MudTh>Key</MudTh>
|
<MudTh>@T("Key")</MudTh>
|
||||||
<MudTh>Text</MudTh>
|
<MudTh>@T("Text")</MudTh>
|
||||||
</HeaderContent>
|
</HeaderContent>
|
||||||
<RowTemplate>
|
<RowTemplate>
|
||||||
<MudTd>
|
<MudTd>
|
||||||
|
|||||||
@@ -18,12 +18,9 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
{
|
{
|
||||||
public override Tools.Components Component => Tools.Components.I18N_ASSISTANT;
|
public override Tools.Components Component => Tools.Components.I18N_ASSISTANT;
|
||||||
|
|
||||||
protected override string Title => "Localization";
|
protected override string Title => T("Localization");
|
||||||
|
|
||||||
protected override string Description =>
|
protected override string Description => T("Translate MindWork AI Studio text content into another language.");
|
||||||
"""
|
|
||||||
Translate MindWork AI Studio text content into another language.
|
|
||||||
""";
|
|
||||||
|
|
||||||
protected override string SystemPrompt =>
|
protected override string SystemPrompt =>
|
||||||
$"""
|
$"""
|
||||||
@@ -59,7 +56,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
[
|
[
|
||||||
new ButtonData
|
new ButtonData
|
||||||
{
|
{
|
||||||
Text = "Copy Lua code to clipboard",
|
Text = T("Copy Lua code to clipboard"),
|
||||||
Icon = Icons.Material.Filled.Extension,
|
Icon = Icons.Material.Filled.Extension,
|
||||||
Color = Color.Default,
|
Color = Color.Default,
|
||||||
AsyncAction = async () => await this.RustService.CopyText2Clipboard(this.Snackbar, this.finalLuaCode.ToString()),
|
AsyncAction = async () => await this.RustService.CopyText2Clipboard(this.Snackbar, this.finalLuaCode.ToString()),
|
||||||
@@ -67,7 +64,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
protected override string SubmitText => "Localize AI Studio & generate the Lua code";
|
protected override string SubmitText => T("Localize AI Studio & generate the Lua code");
|
||||||
|
|
||||||
protected override Func<Task> SubmitAction => this.LocalizeTextContent;
|
protected override Func<Task> SubmitAction => this.LocalizeTextContent;
|
||||||
|
|
||||||
@@ -143,12 +140,12 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
this.localizationPossible = false;
|
this.localizationPossible = false;
|
||||||
if (PluginFactory.RunningPlugins.FirstOrDefault(n => n is PluginLanguage && n.Id == this.selectedLanguagePluginId) is not PluginLanguage comparisonPlugin)
|
if (PluginFactory.RunningPlugins.FirstOrDefault(n => n is PluginLanguage && n.Id == this.selectedLanguagePluginId) is not PluginLanguage comparisonPlugin)
|
||||||
{
|
{
|
||||||
this.loadingIssue = $"Was not able to load the language plugin for comparison ({this.selectedLanguagePluginId}). Please select a valid, loaded & running language plugin.";
|
this.loadingIssue = string.Format(T("Was not able to load the language plugin for comparison ({0}). Please select a valid, loaded & running language plugin."), this.selectedLanguagePluginId);
|
||||||
this.selectedLanguagePlugin = null;
|
this.selectedLanguagePlugin = null;
|
||||||
}
|
}
|
||||||
else if (comparisonPlugin.IETFTag != this.selectedTargetLanguage.ToIETFTag())
|
else if (comparisonPlugin.IETFTag != this.selectedTargetLanguage.ToIETFTag())
|
||||||
{
|
{
|
||||||
this.loadingIssue = $"The selected language plugin for comparison uses the IETF tag '{comparisonPlugin.IETFTag}' which does not match the selected target language '{this.selectedTargetLanguage.ToIETFTag()}'. Please select a valid, loaded & running language plugin which matches the target language.";
|
this.loadingIssue = string.Format(T("The selected language plugin for comparison uses the IETF tag '{0}' which does not match the selected target language '{1}'. Please select a valid, loaded & running language plugin which matches the target language."), comparisonPlugin.IETFTag, this.selectedTargetLanguage.ToIETFTag());
|
||||||
this.selectedLanguagePlugin = null;
|
this.selectedLanguagePlugin = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -165,7 +162,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
{
|
{
|
||||||
if (this.selectedLanguagePlugin is null)
|
if (this.selectedLanguagePlugin is null)
|
||||||
{
|
{
|
||||||
this.loadingIssue = "Please select a language plugin for comparison.";
|
this.loadingIssue = T("Please select a language plugin for comparison.");
|
||||||
this.localizationPossible = false;
|
this.localizationPossible = false;
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.StateHasChanged();
|
this.StateHasChanged();
|
||||||
@@ -202,7 +199,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NoPlugin:
|
case NoPlugin:
|
||||||
this.loadingIssue = "Was not able to load the I18N plugin. Please check the plugin code.";
|
this.loadingIssue = T("Was not able to load the I18N plugin. Please check the plugin code.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case { IsValid: false } plugin when plugin.Issues.Any():
|
case { IsValid: false } plugin when plugin.Issues.Any():
|
||||||
@@ -241,7 +238,7 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
private string? ValidatingTargetLanguage(CommonLanguages language)
|
private string? ValidatingTargetLanguage(CommonLanguages language)
|
||||||
{
|
{
|
||||||
if(language == CommonLanguages.AS_IS)
|
if(language == CommonLanguages.AS_IS)
|
||||||
return "Please select a target language.";
|
return T("Please select a target language.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -249,13 +246,19 @@ public partial class AssistantI18N : AssistantBaseCore<SettingsDialogI18N>
|
|||||||
private string? ValidateCustomLanguage(string language)
|
private string? ValidateCustomLanguage(string language)
|
||||||
{
|
{
|
||||||
if(this.selectedTargetLanguage == CommonLanguages.OTHER && string.IsNullOrWhiteSpace(language))
|
if(this.selectedTargetLanguage == CommonLanguages.OTHER && string.IsNullOrWhiteSpace(language))
|
||||||
return "Please provide a custom language.";
|
return T("Please provide a custom language.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int NumTotalItems => (this.selectedLanguagePlugin?.Content.Count ?? 0) + this.addedContent.Count - this.removedContent.Count;
|
private int NumTotalItems => (this.selectedLanguagePlugin?.Content.Count ?? 0) + this.addedContent.Count - this.removedContent.Count;
|
||||||
|
|
||||||
|
private string AddedContentText => string.Format(T("Added Content ({0} entries)"), this.addedContent.Count);
|
||||||
|
|
||||||
|
private string RemovedContentText => string.Format(T("Removed Content ({0} entries)"), this.removedContent.Count);
|
||||||
|
|
||||||
|
private string LocalizedContentText => string.Format(T("Localized Content ({0} entries of {1})"), this.localizedContent.Count, this.NumTotalItems);
|
||||||
|
|
||||||
private async Task LocalizeTextContent()
|
private async Task LocalizeTextContent()
|
||||||
{
|
{
|
||||||
await this.form!.Validate();
|
await this.form!.Validate();
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,15 +1,15 @@
|
|||||||
@attribute [Route(Routes.ASSISTANT_JOB_POSTING)]
|
@attribute [Route(Routes.ASSISTANT_JOB_POSTING)]
|
||||||
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogJobPostings>
|
@inherits AssistantBaseCore<AIStudio.Dialogs.Settings.SettingsDialogJobPostings>
|
||||||
|
|
||||||
<MudTextField T="string" @bind-Text="@this.inputCompanyName" Label="(Optional) The company name" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Warehouse" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
<MudTextField T="string" @bind-Text="@this.inputCompanyName" Label="@T("(Optional) The company name")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Warehouse" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||||
<MudTextField T="string" @bind-Text="@this.inputCountryLegalFramework" Label="Provide the country, where the company is located" Validation="@this.ValidateCountryLegalFramework" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Flag" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3" HelperText="This is important to consider the legal framework of the country."/>
|
<MudTextField T="string" @bind-Text="@this.inputCountryLegalFramework" Label="@T("Provide the country, where the company is located")" Validation="@this.ValidateCountryLegalFramework" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Flag" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3" HelperText="@T("This is important to consider the legal framework of the country.")"/>
|
||||||
<MudTextField T="string" @bind-Text="@this.inputMandatoryInformation" Label="(Optional) Provide mandatory information" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.TextSnippet" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="Mandatory information that your company requires for all job postings. This can include the company description, etc." />
|
<MudTextField T="string" @bind-Text="@this.inputMandatoryInformation" Label="@T("(Optional) Provide mandatory information")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.TextSnippet" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="@T("Mandatory information that your company requires for all job postings. This can include the company description, etc.")" />
|
||||||
<MudTextField T="string" @bind-Text="@this.inputJobDescription" Label="Job description" Validation="@this.ValidateJobDescription" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Settings" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="Describe what the person is supposed to do in the company. This might be just short bullet points." />
|
<MudTextField T="string" @bind-Text="@this.inputJobDescription" Label="@T("Job description")" Validation="@this.ValidateJobDescription" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Settings" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="@T("Describe what the person is supposed to do in the company. This might be just short bullet points.")" />
|
||||||
<MudTextField T="string" @bind-Text="@this.inputQualifications" Label="(Optional) Provide necessary job qualifications" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Settings" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="Describe what the person should bring to the table. This might be just short bullet points." />
|
<MudTextField T="string" @bind-Text="@this.inputQualifications" Label="@T("(Optional) Provide necessary job qualifications")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Settings" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="@T("Describe what the person should bring to the table. This might be just short bullet points.")" />
|
||||||
<MudTextField T="string" @bind-Text="@this.inputResponsibilities" Label="(Optional) Provide job responsibilities" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Settings" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="Describe the responsibilities the person should take on in the company." />
|
<MudTextField T="string" @bind-Text="@this.inputResponsibilities" Label="@T("(Optional) Provide job responsibilities")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Settings" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES" HelperText="@T("Describe the responsibilities the person should take on in the company.")" />
|
||||||
<MudTextField T="string" @bind-Text="@this.inputWorkLocation" Label="(Optional) Provide the work location" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.MyLocation" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
<MudTextField T="string" @bind-Text="@this.inputWorkLocation" Label="@T("(Optional) Provide the work location")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.MyLocation" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||||
<MudTextField T="string" @bind-Text="@this.inputEntryDate" Label="(Optional) Provide the entry date" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.DateRange" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
<MudTextField T="string" @bind-Text="@this.inputEntryDate" Label="@T("(Optional) Provide the entry date")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.DateRange" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||||
<MudTextField T="string" @bind-Text="@this.inputValidUntil" Label="(Optional) Provide the date until the job posting is valid" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.DateRange" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
<MudTextField T="string" @bind-Text="@this.inputValidUntil" Label="@T("(Optional) Provide the date until the job posting is valid")" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.DateRange" Variant="Variant.Outlined" Margin="Margin.Dense" UserAttributes="@USER_INPUT_ATTRIBUTES" Class="mb-3"/>
|
||||||
|
|
||||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="Target language" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="Custom target language" />
|
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.NameSelectingOptional())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" OtherValue="CommonLanguages.OTHER" @bind-OtherInput="@this.customTargetLanguage" ValidateOther="@this.ValidateCustomLanguage" LabelOther="@T("Custom target language")" />
|
||||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||||
@@ -7,13 +7,9 @@ public partial class AssistantJobPostings : AssistantBaseCore<SettingsDialogJobP
|
|||||||
{
|
{
|
||||||
public override Tools.Components Component => Tools.Components.JOB_POSTING_ASSISTANT;
|
public override Tools.Components Component => Tools.Components.JOB_POSTING_ASSISTANT;
|
||||||
|
|
||||||
protected override string Title => "Job Posting";
|
protected override string Title => T("Job Posting");
|
||||||
|
|
||||||
protected override string Description =>
|
protected override string Description => T("Provide some key points about the job you want to post. The AI will then formulate a suggestion that you can finalize.");
|
||||||
"""
|
|
||||||
Provide some key points about the job you want to post. The AI will then
|
|
||||||
formulate a suggestion that you can finalize.
|
|
||||||
""";
|
|
||||||
|
|
||||||
protected override string SystemPrompt =>
|
protected override string SystemPrompt =>
|
||||||
$"""
|
$"""
|
||||||
@@ -47,7 +43,7 @@ public partial class AssistantJobPostings : AssistantBaseCore<SettingsDialogJobP
|
|||||||
|
|
||||||
protected override IReadOnlyList<IButtonData> FooterButtons => [];
|
protected override IReadOnlyList<IButtonData> FooterButtons => [];
|
||||||
|
|
||||||
protected override string SubmitText => "Create the job posting";
|
protected override string SubmitText => T("Create the job posting");
|
||||||
|
|
||||||
protected override Func<Task> SubmitAction => this.CreateJobPosting;
|
protected override Func<Task> SubmitAction => this.CreateJobPosting;
|
||||||
|
|
||||||
@@ -126,7 +122,7 @@ public partial class AssistantJobPostings : AssistantBaseCore<SettingsDialogJobP
|
|||||||
private string? ValidateCustomLanguage(string language)
|
private string? ValidateCustomLanguage(string language)
|
||||||
{
|
{
|
||||||
if(this.selectedTargetLanguage == CommonLanguages.OTHER && string.IsNullOrWhiteSpace(language))
|
if(this.selectedTargetLanguage == CommonLanguages.OTHER && string.IsNullOrWhiteSpace(language))
|
||||||
return "Please provide a custom target language.";
|
return T("Please provide a custom target language.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -134,7 +130,7 @@ public partial class AssistantJobPostings : AssistantBaseCore<SettingsDialogJobP
|
|||||||
private string? ValidateJobDescription(string jobDescription)
|
private string? ValidateJobDescription(string jobDescription)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(jobDescription))
|
if(string.IsNullOrWhiteSpace(jobDescription))
|
||||||
return "Please provide a job description.";
|
return T("Please provide a job description.");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -142,7 +138,7 @@ public partial class AssistantJobPostings : AssistantBaseCore<SettingsDialogJobP
|
|||||||
private string? ValidateCountryLegalFramework(string countryLegalFramework)
|
private string? ValidateCountryLegalFramework(string countryLegalFramework)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(countryLegalFramework))
|
if(string.IsNullOrWhiteSpace(countryLegalFramework))
|
||||||
return "Please provide the country where the job is posted (legal framework).";
|
return T("Please provide the country where the job is posted (legal framework).");
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
@if (!this.SettingsManager.ConfigurationData.LegalCheck.HideWebContentReader)
|
@if (!this.SettingsManager.ConfigurationData.LegalCheck.HideWebContentReader)
|
||||||
{
|
{
|
||||||
<ReadWebContent @bind-Content="@this.inputLegalDocument" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions && this.SettingsManager.ConfigurationData.LegalCheck.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions && this.SettingsManager.ConfigurationData.LegalCheck.PreselectContentCleanerAgent)"/>
|
<ReadWebContent @bind-Content="@this.inputLegalDocument" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ReadPDFContent @bind-PDFContent="@this.inputLegalDocument"/>
|
<ReadFileContent @bind-FileContent="@this.inputLegalDocument"/>
|
||||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputLegalDocument" Validation="@this.ValidatingLegalDocument" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Legal document")" Variant="Variant.Outlined" Lines="12" AutoGrow="@true" MaxLines="24" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputLegalDocument" Validation="@this.ValidatingLegalDocument" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Legal document")" Variant="Variant.Outlined" Lines="12" AutoGrow="@true" MaxLines="24" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputQuestions" Validation="@this.ValidatingQuestions" AdornmentIcon="@Icons.Material.Filled.QuestionAnswer" Adornment="Adornment.Start" Label="@T("Your questions")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputQuestions" Validation="@this.ValidatingQuestions" AdornmentIcon="@Icons.Material.Filled.QuestionAnswer" Adornment="Adornment.Start" Label="@T("Your questions")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||||
@@ -37,11 +37,27 @@ public partial class AssistantLegalCheck : AssistantBaseCore<SettingsDialogLegal
|
|||||||
{
|
{
|
||||||
this.inputLegalDocument = string.Empty;
|
this.inputLegalDocument = string.Empty;
|
||||||
this.inputQuestions = string.Empty;
|
this.inputQuestions = string.Empty;
|
||||||
this.MightPreselectValues();
|
if (!this.MightPreselectValues())
|
||||||
|
{
|
||||||
|
this.showWebContentReader = false;
|
||||||
|
this.useContentCleanerAgent = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool MightPreselectValues() => false;
|
|
||||||
|
|
||||||
|
protected override bool MightPreselectValues()
|
||||||
|
{
|
||||||
|
if (this.SettingsManager.ConfigurationData.LegalCheck.PreselectOptions)
|
||||||
|
{
|
||||||
|
this.showWebContentReader = this.SettingsManager.ConfigurationData.LegalCheck.PreselectWebContentReader;
|
||||||
|
this.useContentCleanerAgent = this.SettingsManager.ConfigurationData.LegalCheck.PreselectContentCleanerAgent;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool showWebContentReader;
|
||||||
|
private bool useContentCleanerAgent;
|
||||||
private bool isAgentRunning;
|
private bool isAgentRunning;
|
||||||
private string inputLegalDocument = string.Empty;
|
private string inputLegalDocument = string.Empty;
|
||||||
private string inputQuestions = string.Empty;
|
private string inputQuestions = string.Empty;
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
@if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader)
|
@if (!this.SettingsManager.ConfigurationData.TextSummarizer.HideWebContentReader)
|
||||||
{
|
{
|
||||||
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions && this.SettingsManager.ConfigurationData.TextSummarizer.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions && this.SettingsManager.ConfigurationData.TextSummarizer.PreselectContentCleanerAgent)"/>
|
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ReadPDFContent @bind-PDFContent="@this.inputText"/>
|
<ReadFileContent @bind-FileContent="@this.inputText"/>
|
||||||
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
<MudTextField T="string" Disabled="@this.isAgentRunning" @bind-Text="@this.inputText" Validation="@this.ValidatingText" AdornmentIcon="@Icons.Material.Filled.DocumentScanner" Adornment="Adornment.Start" Label="@T("Your input")" Variant="Variant.Outlined" Lines="6" AutoGrow="@true" MaxLines="12" Class="mb-3" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
|
||||||
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
|
<EnumSelection T="CommonLanguages" NameFunc="@(language => language.Name())" @bind-Value="@this.selectedTargetLanguage" Icon="@Icons.Material.Filled.Translate" Label="@T("Target language")" AllowOther="@true" @bind-OtherInput="@this.customTargetLanguage" OtherValue="CommonLanguages.OTHER" LabelOther="@T("Custom target language")" ValidateOther="@this.ValidateCustomLanguage" />
|
||||||
<EnumSelection T="Complexity" NameFunc="@(complexity => complexity.Name())" @bind-Value="@this.selectedComplexity" Icon="@Icons.Material.Filled.Layers" Label="@T("Target complexity")" AllowOther="@true" @bind-OtherInput="@this.expertInField" OtherValue="Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS" LabelOther="@T("Your expertise")" ValidateOther="@this.ValidateExpertInField" />
|
<EnumSelection T="Complexity" NameFunc="@(complexity => complexity.Name())" @bind-Value="@this.selectedComplexity" Icon="@Icons.Material.Filled.Layers" Label="@T("Target complexity")" AllowOther="@true" @bind-OtherInput="@this.expertInField" OtherValue="Complexity.SCIENTIFIC_LANGUAGE_OTHER_EXPERTS" LabelOther="@T("Your expertise")" ValidateOther="@this.ValidateExpertInField" />
|
||||||
|
<MudTextField T="string" AutoGrow="true" Lines="2" @bind-Text="@this.importantAspects" class="mb-3" Label="@T("(Optional) Important Aspects")" HelperText="@T("(Optional) Specify aspects for the LLM to focus on when generating a summary, such as summary length or specific topics to emphasize.")" ShrinkLabel="true" Variant="Variant.Outlined" AdornmentIcon="@Icons.Material.Filled.List" Adornment="Adornment.Start"/>
|
||||||
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
<ProviderSelection @bind-ProviderSettings="@this.providerSettings" ValidateProvider="@this.ValidatingProvider"/>
|
||||||
@@ -12,13 +12,13 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
|||||||
protected override string Description => T("Summarize long text into a shorter version while retaining the main points. You might want to change the language of the summary to make it more readable. It is also possible to change the complexity of the summary to make it easy to understand.");
|
protected override string Description => T("Summarize long text into a shorter version while retaining the main points. You might want to change the language of the summary to make it more readable. It is also possible to change the complexity of the summary to make it easy to understand.");
|
||||||
|
|
||||||
protected override string SystemPrompt =>
|
protected override string SystemPrompt =>
|
||||||
"""
|
$"""
|
||||||
You get a long text as input. The user wants to get a summary of the text.
|
You get a long text as input. The text is marked with ```. The user wants to get a summary of the text.
|
||||||
The user might want to change the language of the summary. In this case,
|
{this.selectedTargetLanguage.PromptSummarizing(this.customTargetLanguage)}
|
||||||
you should provide a summary in the requested language. Eventually, the user
|
{this.selectedComplexity.Prompt(this.expertInField)}
|
||||||
want to change the complexity of the text. In this case, you should provide
|
{this.PromptImportantAspects()}
|
||||||
a summary with the requested complexity. In any case, do not add any information.
|
In any case, only use information that is provided in the text for the summary.
|
||||||
""";
|
""";
|
||||||
|
|
||||||
protected override bool AllowProfiles => false;
|
protected override bool AllowProfiles => false;
|
||||||
|
|
||||||
@@ -40,10 +40,13 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
|||||||
this.inputText = string.Empty;
|
this.inputText = string.Empty;
|
||||||
if(!this.MightPreselectValues())
|
if(!this.MightPreselectValues())
|
||||||
{
|
{
|
||||||
|
this.showWebContentReader = false;
|
||||||
|
this.useContentCleanerAgent = false;
|
||||||
this.selectedTargetLanguage = CommonLanguages.AS_IS;
|
this.selectedTargetLanguage = CommonLanguages.AS_IS;
|
||||||
this.customTargetLanguage = string.Empty;
|
this.customTargetLanguage = string.Empty;
|
||||||
this.selectedComplexity = Complexity.NO_CHANGE;
|
this.selectedComplexity = Complexity.NO_CHANGE;
|
||||||
this.expertInField = string.Empty;
|
this.expertInField = string.Empty;
|
||||||
|
this.importantAspects = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,22 +54,28 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
|||||||
{
|
{
|
||||||
if (this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions)
|
if (this.SettingsManager.ConfigurationData.TextSummarizer.PreselectOptions)
|
||||||
{
|
{
|
||||||
|
this.showWebContentReader = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectWebContentReader;
|
||||||
|
this.useContentCleanerAgent = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectContentCleanerAgent;
|
||||||
this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedTargetLanguage;
|
this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedTargetLanguage;
|
||||||
this.customTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedOtherLanguage;
|
this.customTargetLanguage = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedOtherLanguage;
|
||||||
this.selectedComplexity = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedComplexity;
|
this.selectedComplexity = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedComplexity;
|
||||||
this.expertInField = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedExpertInField;
|
this.expertInField = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedExpertInField;
|
||||||
|
this.importantAspects = this.SettingsManager.ConfigurationData.TextSummarizer.PreselectedImportantAspects;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool showWebContentReader;
|
||||||
|
private bool useContentCleanerAgent;
|
||||||
private string inputText = string.Empty;
|
private string inputText = string.Empty;
|
||||||
private bool isAgentRunning;
|
private bool isAgentRunning;
|
||||||
private CommonLanguages selectedTargetLanguage;
|
private CommonLanguages selectedTargetLanguage;
|
||||||
private string customTargetLanguage = string.Empty;
|
private string customTargetLanguage = string.Empty;
|
||||||
private Complexity selectedComplexity;
|
private Complexity selectedComplexity;
|
||||||
private string expertInField = string.Empty;
|
private string expertInField = string.Empty;
|
||||||
|
private string importantAspects = string.Empty;
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
@@ -105,6 +114,17 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string PromptImportantAspects()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(this.importantAspects))
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
return $"""
|
||||||
|
Emphasize the following aspects in your summary:
|
||||||
|
{this.importantAspects}
|
||||||
|
""";
|
||||||
|
}
|
||||||
|
|
||||||
private async Task SummarizeText()
|
private async Task SummarizeText()
|
||||||
{
|
{
|
||||||
await this.form!.Validate();
|
await this.form!.Validate();
|
||||||
@@ -114,11 +134,7 @@ public partial class AssistantTextSummarizer : AssistantBaseCore<SettingsDialogT
|
|||||||
this.CreateChatThread();
|
this.CreateChatThread();
|
||||||
var time = this.AddUserRequest(
|
var time = this.AddUserRequest(
|
||||||
$"""
|
$"""
|
||||||
{this.selectedTargetLanguage.PromptSummarizing(this.customTargetLanguage)}
|
|
||||||
{this.selectedComplexity.Prompt(this.expertInField)}
|
|
||||||
|
|
||||||
Please summarize the following text:
|
Please summarize the following text:
|
||||||
|
|
||||||
```
|
```
|
||||||
{this.inputText}
|
{this.inputText}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
|
|
||||||
@if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)
|
@if (!this.SettingsManager.ConfigurationData.Translation.HideWebContentReader)
|
||||||
{
|
{
|
||||||
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" Preselect="@(this.SettingsManager.ConfigurationData.Translation.PreselectOptions && this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader)" PreselectContentCleanerAgent="@(this.SettingsManager.ConfigurationData.Translation.PreselectOptions && this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent)"/>
|
<ReadWebContent @bind-Content="@this.inputText" ProviderSettings="@this.providerSettings" @bind-AgentIsRunning="@this.isAgentRunning" @bind-Preselect="@this.showWebContentReader" @bind-PreselectContentCleanerAgent="@this.useContentCleanerAgent"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ReadPDFContent @bind-PDFContent="@this.inputText"/>
|
<ReadFileContent @bind-FileContent="@this.inputText"/>
|
||||||
|
|
||||||
<MudTextSwitch Label="@T("Live translation")" @bind-Value="@this.liveTranslation" LabelOn="@T("Live translation")" LabelOff="@T("No live translation")"/>
|
<MudTextSwitch Label="@T("Live translation")" @bind-Value="@this.liveTranslation" LabelOn="@T("Live translation")" LabelOff="@T("No live translation")"/>
|
||||||
@if (this.liveTranslation)
|
@if (this.liveTranslation)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
|
|||||||
this.inputTextLastTranslation = string.Empty;
|
this.inputTextLastTranslation = string.Empty;
|
||||||
if (!this.MightPreselectValues())
|
if (!this.MightPreselectValues())
|
||||||
{
|
{
|
||||||
|
this.showWebContentReader = false;
|
||||||
|
this.useContentCleanerAgent = false;
|
||||||
this.liveTranslation = false;
|
this.liveTranslation = false;
|
||||||
this.selectedTargetLanguage = CommonLanguages.AS_IS;
|
this.selectedTargetLanguage = CommonLanguages.AS_IS;
|
||||||
this.customTargetLanguage = string.Empty;
|
this.customTargetLanguage = string.Empty;
|
||||||
@@ -50,6 +52,8 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
|
|||||||
{
|
{
|
||||||
if (this.SettingsManager.ConfigurationData.Translation.PreselectOptions)
|
if (this.SettingsManager.ConfigurationData.Translation.PreselectOptions)
|
||||||
{
|
{
|
||||||
|
this.showWebContentReader = this.SettingsManager.ConfigurationData.Translation.PreselectWebContentReader;
|
||||||
|
this.useContentCleanerAgent = this.SettingsManager.ConfigurationData.Translation.PreselectContentCleanerAgent;
|
||||||
this.liveTranslation = this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation;
|
this.liveTranslation = this.SettingsManager.ConfigurationData.Translation.PreselectLiveTranslation;
|
||||||
this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage;
|
this.selectedTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectedTargetLanguage;
|
||||||
this.customTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage;
|
this.customTargetLanguage = this.SettingsManager.ConfigurationData.Translation.PreselectOtherLanguage;
|
||||||
@@ -59,6 +63,8 @@ public partial class AssistantTranslation : AssistantBaseCore<SettingsDialogTran
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool showWebContentReader;
|
||||||
|
private bool useContentCleanerAgent;
|
||||||
private bool liveTranslation;
|
private bool liveTranslation;
|
||||||
private bool isAgentRunning;
|
private bool isAgentRunning;
|
||||||
private string inputText = string.Empty;
|
private string inputText = string.Empty;
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ namespace AIStudio.Chat;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed record ChatThread
|
public sealed record ChatThread
|
||||||
{
|
{
|
||||||
|
private static readonly ILogger<ChatThread> LOGGER = Program.LOGGER_FACTORY.CreateLogger<ChatThread>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The unique identifier of the chat thread.
|
/// The unique identifier of the chat thread.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -59,11 +61,6 @@ public sealed record ChatThread
|
|||||||
/// The name of the chat thread. Usually generated by an AI model or manually edited by the user.
|
/// The name of the chat thread. Usually generated by an AI model or manually edited by the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The seed for the chat thread. Some providers use this to generate deterministic results.
|
|
||||||
/// </summary>
|
|
||||||
public int Seed { get; init; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current system prompt for the chat thread.
|
/// The current system prompt for the chat thread.
|
||||||
@@ -87,9 +84,8 @@ public sealed record ChatThread
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="settingsManager">The settings manager instance to use.</param>
|
/// <param name="settingsManager">The settings manager instance to use.</param>
|
||||||
/// <param name="chatThread">The chat thread to prepare the system prompt for.</param>
|
/// <param name="chatThread">The chat thread to prepare the system prompt for.</param>
|
||||||
/// <param name="logger">The logger instance to use.</param>
|
|
||||||
/// <returns>The prepared system prompt.</returns>
|
/// <returns>The prepared system prompt.</returns>
|
||||||
public string PrepareSystemPrompt(SettingsManager settingsManager, ChatThread chatThread, ILogger logger)
|
public string PrepareSystemPrompt(SettingsManager settingsManager, ChatThread chatThread)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Use the information from the chat template, if provided. Otherwise, use the default system prompt
|
// Use the information from the chat template, if provided. Otherwise, use the default system prompt
|
||||||
@@ -100,16 +96,16 @@ public sealed record ChatThread
|
|||||||
systemPromptTextWithChatTemplate = chatThread.SystemPrompt;
|
systemPromptTextWithChatTemplate = chatThread.SystemPrompt;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!Guid.TryParse(chatThread.SelectedChatTemplate, out var chatTeamplateId))
|
if(!Guid.TryParse(chatThread.SelectedChatTemplate, out var chatTemplateId))
|
||||||
systemPromptTextWithChatTemplate = chatThread.SystemPrompt;
|
systemPromptTextWithChatTemplate = chatThread.SystemPrompt;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(chatThread.SelectedChatTemplate == ChatTemplate.NO_CHAT_TEMPLATE.Id || chatTeamplateId == Guid.Empty)
|
if(chatThread.SelectedChatTemplate == ChatTemplate.NO_CHAT_TEMPLATE.Id || chatTemplateId == Guid.Empty)
|
||||||
systemPromptTextWithChatTemplate = chatThread.SystemPrompt;
|
systemPromptTextWithChatTemplate = chatThread.SystemPrompt;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var chatTemplate = settingsManager.ConfigurationData.ChatTemplates.FirstOrDefault(x => x.Id == chatThread.SelectedChatTemplate);
|
var chatTemplate = settingsManager.ConfigurationData.ChatTemplates.FirstOrDefault(x => x.Id == chatThread.SelectedChatTemplate);
|
||||||
if(chatTemplate == default)
|
if(chatTemplate == null)
|
||||||
systemPromptTextWithChatTemplate = chatThread.SystemPrompt;
|
systemPromptTextWithChatTemplate = chatThread.SystemPrompt;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -121,7 +117,12 @@ public sealed record ChatThread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation(logMessage);
|
// We need a way to save the changed system prompt in our chat thread.
|
||||||
|
// Otherwise, the chat thread will always tell us that it is using the
|
||||||
|
// default system prompt:
|
||||||
|
chatThread = chatThread with { SystemPrompt = systemPromptTextWithChatTemplate };
|
||||||
|
|
||||||
|
LOGGER.LogInformation(logMessage);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add augmented data, if available:
|
// Add augmented data, if available:
|
||||||
@@ -139,9 +140,9 @@ public sealed record ChatThread
|
|||||||
};
|
};
|
||||||
|
|
||||||
if(isAugmentedDataAvailable)
|
if(isAugmentedDataAvailable)
|
||||||
logger.LogInformation("Augmented data is available for the chat thread.");
|
LOGGER.LogInformation("Augmented data is available for the chat thread.");
|
||||||
else
|
else
|
||||||
logger.LogInformation("No augmented data is available for the chat thread.");
|
LOGGER.LogInformation("No augmented data is available for the chat thread.");
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -177,7 +178,7 @@ public sealed record ChatThread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.LogInformation(logMessage);
|
LOGGER.LogInformation(logMessage);
|
||||||
return systemPromptText;
|
return systemPromptText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ public class ContentBlock
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HideFromUser { get; init; }
|
public bool HideFromUser { get; init; }
|
||||||
|
|
||||||
public ContentBlock DeepClone() => new()
|
public ContentBlock DeepClone(bool changeHideState = false, bool hideFromUser = true) => new()
|
||||||
{
|
{
|
||||||
Time = this.Time,
|
Time = this.Time,
|
||||||
ContentType = this.ContentType,
|
ContentType = this.ContentType,
|
||||||
Content = this.Content?.DeepClone(),
|
Content = this.Content?.DeepClone(),
|
||||||
Role = this.Role,
|
Role = this.Role,
|
||||||
HideFromUser = this.HideFromUser,
|
HideFromUser = changeHideState ? hideFromUser : this.HideFromUser,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
@using AIStudio.Tools
|
@using AIStudio.Tools
|
||||||
@using MudBlazor
|
@using MudBlazor
|
||||||
|
@using AIStudio.Components
|
||||||
@inherits AIStudio.Components.MSGComponentBase
|
@inherits AIStudio.Components.MSGComponentBase
|
||||||
<MudCard Class="@this.CardClasses" Outlined="@true">
|
<MudCard Class="@this.CardClasses" Outlined="@true">
|
||||||
<MudCardHeader>
|
<MudCardHeader>
|
||||||
@@ -10,10 +11,18 @@
|
|||||||
</CardHeaderAvatar>
|
</CardHeaderAvatar>
|
||||||
<CardHeaderContent>
|
<CardHeaderContent>
|
||||||
<MudText Typo="Typo.body1">
|
<MudText Typo="Typo.body1">
|
||||||
@this.Role.ToName() (@this.Time)
|
@this.Role.ToName() (@this.Time.LocalDateTime)
|
||||||
</MudText>
|
</MudText>
|
||||||
</CardHeaderContent>
|
</CardHeaderContent>
|
||||||
<CardHeaderActions>
|
<CardHeaderActions>
|
||||||
|
@if (this.Content.Sources.Count > 0)
|
||||||
|
{
|
||||||
|
<MudTooltip Text="@T("Number of sources")" Placement="Placement.Bottom">
|
||||||
|
<MudBadge Content="@this.Content.Sources.Count" Color="Color.Primary" Overlap="true" BadgeClass="sources-card-header">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Link" />
|
||||||
|
</MudBadge>
|
||||||
|
</MudTooltip>
|
||||||
|
}
|
||||||
@if (this.IsSecondToLastBlock && this.Role is ChatRole.USER && this.EditLastUserBlockFunc is not null)
|
@if (this.IsSecondToLastBlock && this.Role is ChatRole.USER && this.EditLastUserBlockFunc is not null)
|
||||||
{
|
{
|
||||||
<MudTooltip Text="@T("Edit")" Placement="Placement.Bottom">
|
<MudTooltip Text="@T("Edit")" Placement="Placement.Bottom">
|
||||||
@@ -38,9 +47,7 @@
|
|||||||
<MudIconButton Icon="@Icons.Material.Filled.Delete" Color="Color.Error" OnClick="@this.RemoveBlock"/>
|
<MudIconButton Icon="@Icons.Material.Filled.Delete" Color="Color.Error" OnClick="@this.RemoveBlock"/>
|
||||||
</MudTooltip>
|
</MudTooltip>
|
||||||
}
|
}
|
||||||
<MudTooltip Text="@T("Copies the content to the clipboard")" Placement="Placement.Bottom">
|
<MudCopyClipboardButton Content="@this.Content" Type="@this.Type" Size="Size.Medium"/>
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" Color="Color.Default" OnClick="@this.CopyToClipboard"/>
|
|
||||||
</MudTooltip>
|
|
||||||
</CardHeaderActions>
|
</CardHeaderActions>
|
||||||
</MudCardHeader>
|
</MudCardHeader>
|
||||||
<MudCardContent>
|
<MudCardContent>
|
||||||
@@ -67,12 +74,16 @@
|
|||||||
@if (this.Content.IsStreaming)
|
@if (this.Content.IsStreaming)
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.body1" Style="white-space: pre-wrap;">
|
<MudText Typo="Typo.body1" Style="white-space: pre-wrap;">
|
||||||
@textContent.Text
|
@textContent.Text.RemoveThinkTags()
|
||||||
</MudText>
|
</MudText>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudMarkdown Value="@textContent.Text" OverrideHeaderTypo="@Markdown.OverrideHeaderTypo" CodeBlockTheme="@this.CodeColorPalette"/>
|
<MudMarkdown Value="@textContent.Text.RemoveThinkTags().Trim()" Props="Markdown.DefaultConfig" Styling="@this.MarkdownStyling" />
|
||||||
|
@if (textContent.Sources.Count > 0)
|
||||||
|
{
|
||||||
|
<MudMarkdown Value="@textContent.Sources.ToMarkdown()" Props="Markdown.DefaultConfig" Styling="@this.MarkdownStyling" />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using AIStudio.Components;
|
using AIStudio.Components;
|
||||||
using AIStudio.Tools.Services;
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
@@ -61,12 +60,6 @@ public partial class ContentBlockComponent : MSGComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<bool> RegenerateEnabled { get; set; } = () => false;
|
public Func<bool> RegenerateEnabled { get; set; } = () => false;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private RustService RustService { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private ISnackbar Snackbar { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private IDialogService DialogService { get; init; } = null!;
|
private IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
@@ -115,33 +108,15 @@ public partial class ContentBlockComponent : MSGComponentBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copy this block's content to the clipboard.
|
|
||||||
/// </summary>
|
|
||||||
private async Task CopyToClipboard()
|
|
||||||
{
|
|
||||||
switch (this.Type)
|
|
||||||
{
|
|
||||||
case ContentType.TEXT:
|
|
||||||
var textContent = (ContentText) this.Content;
|
|
||||||
await this.RustService.CopyText2Clipboard(this.Snackbar, textContent.Text);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
this.Snackbar.Add(T("Cannot copy this content type to clipboard!"), Severity.Error, config =>
|
|
||||||
{
|
|
||||||
config.Icon = Icons.Material.Filled.ContentCopy;
|
|
||||||
config.IconSize = Size.Large;
|
|
||||||
config.IconColor = Color.Error;
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string CardClasses => $"my-2 rounded-lg {this.Class}";
|
private string CardClasses => $"my-2 rounded-lg {this.Class}";
|
||||||
|
|
||||||
private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default;
|
private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default;
|
||||||
|
|
||||||
|
private MudMarkdownStyling MarkdownStyling => new()
|
||||||
|
{
|
||||||
|
CodeBlock = { Theme = this.CodeColorPalette },
|
||||||
|
};
|
||||||
|
|
||||||
private async Task RemoveBlock()
|
private async Task RemoveBlock()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,10 @@ public sealed class ContentImage : IContent, IImageSource
|
|||||||
public Func<Task> StreamingEvent { get; set; } = () => Task.CompletedTask;
|
public Func<Task> StreamingEvent { get; set; } = () => Task.CompletedTask;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<ChatThread> CreateFromProviderAsync(IProvider provider, Model chatModel, IContent? lastPrompt, ChatThread? chatChatThread, CancellationToken token = default)
|
public List<Source> Sources { get; set; } = [];
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public Task<ChatThread> CreateFromProviderAsync(IProvider provider, Model chatModel, IContent? lastUserPrompt, ChatThread? chatChatThread, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ namespace AIStudio.Chat;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class ContentText : IContent
|
public sealed class ContentText : IContent
|
||||||
{
|
{
|
||||||
|
private static readonly ILogger<ContentText> LOGGER = Program.LOGGER_FACTORY.CreateLogger<ContentText>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum time between two streaming events, when the user
|
/// The minimum time between two streaming events, when the user
|
||||||
/// enables the energy saving mode.
|
/// enables the energy saving mode.
|
||||||
@@ -24,7 +26,7 @@ public sealed class ContentText : IContent
|
|||||||
public bool InitialRemoteWait { get; set; }
|
public bool InitialRemoteWait { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
// [JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IsStreaming { get; set; }
|
public bool IsStreaming { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -36,30 +38,31 @@ public sealed class ContentText : IContent
|
|||||||
public Func<Task> StreamingEvent { get; set; } = () => Task.CompletedTask;
|
public Func<Task> StreamingEvent { get; set; } = () => Task.CompletedTask;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<ChatThread> CreateFromProviderAsync(IProvider provider, Model chatModel, IContent? lastPrompt, ChatThread? chatThread, CancellationToken token = default)
|
public List<Source> Sources { get; set; } = [];
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public async Task<ChatThread> CreateFromProviderAsync(IProvider provider, Model chatModel, IContent? lastUserPrompt, ChatThread? chatThread, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if(chatThread is null)
|
if(chatThread is null)
|
||||||
return new();
|
return new();
|
||||||
|
|
||||||
if(!chatThread.IsLLMProviderAllowed(provider))
|
if(!chatThread.IsLLMProviderAllowed(provider))
|
||||||
{
|
{
|
||||||
var logger = Program.SERVICE_PROVIDER.GetService<ILogger<ContentText>>()!;
|
LOGGER.LogError("The provider is not allowed for this chat thread due to data security reasons. Skipping the AI process.");
|
||||||
logger.LogError("The provider is not allowed for this chat thread due to data security reasons. Skipping the AI process.");
|
|
||||||
return chatThread;
|
return chatThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the RAG process. Right now, we only have one RAG process:
|
// Call the RAG process. Right now, we only have one RAG process:
|
||||||
if (lastPrompt is not null)
|
if (lastUserPrompt is not null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var rag = new AISrcSelWithRetCtxVal();
|
var rag = new AISrcSelWithRetCtxVal();
|
||||||
chatThread = await rag.ProcessAsync(provider, lastPrompt, chatThread, token);
|
chatThread = await rag.ProcessAsync(provider, lastUserPrompt, chatThread, token);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
var logger = Program.SERVICE_PROVIDER.GetService<ILogger<ContentText>>()!;
|
LOGGER.LogError(e, "Skipping the RAG process due to an error.");
|
||||||
logger.LogError(e, "Skipping the RAG process due to an error.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +83,7 @@ public sealed class ContentText : IContent
|
|||||||
this.InitialRemoteWait = true;
|
this.InitialRemoteWait = true;
|
||||||
|
|
||||||
// Iterate over the responses from the AI:
|
// Iterate over the responses from the AI:
|
||||||
await foreach (var deltaText in provider.StreamChatCompletion(chatModel, chatThread, settings, token))
|
await foreach (var contentStreamChunk in provider.StreamChatCompletion(chatModel, chatThread, settings, token))
|
||||||
{
|
{
|
||||||
// When the user cancels the request, we stop the loop:
|
// When the user cancels the request, we stop the loop:
|
||||||
if (token.IsCancellationRequested)
|
if (token.IsCancellationRequested)
|
||||||
@@ -91,7 +94,10 @@ public sealed class ContentText : IContent
|
|||||||
this.IsStreaming = true;
|
this.IsStreaming = true;
|
||||||
|
|
||||||
// Add the response to the text:
|
// Add the response to the text:
|
||||||
this.Text += deltaText;
|
this.Text += contentStreamChunk;
|
||||||
|
|
||||||
|
// Merge the sources:
|
||||||
|
this.Sources.MergeSources(contentStreamChunk.Sources);
|
||||||
|
|
||||||
// Notify the UI that the content has changed,
|
// Notify the UI that the content has changed,
|
||||||
// depending on the energy saving mode:
|
// depending on the energy saving mode:
|
||||||
@@ -119,6 +125,8 @@ public sealed class ContentText : IContent
|
|||||||
this.InitialRemoteWait = false;
|
this.InitialRemoteWait = false;
|
||||||
this.IsStreaming = false;
|
this.IsStreaming = false;
|
||||||
}, token);
|
}, token);
|
||||||
|
|
||||||
|
this.Text = this.Text.RemoveThinkTags().Trim();
|
||||||
|
|
||||||
// Inform the UI that the streaming is done:
|
// Inform the UI that the streaming is done:
|
||||||
await this.StreamingDone();
|
await this.StreamingDone();
|
||||||
|
|||||||
@@ -37,11 +37,21 @@ public interface IContent
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Func<Task> StreamingDone { get; set; }
|
public Func<Task> StreamingDone { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The provided sources, if any.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// We cannot use ISource here because System.Text.Json does not support
|
||||||
|
/// interface serialization. So we have to use a concrete class.
|
||||||
|
/// </remarks>
|
||||||
|
[JsonIgnore]
|
||||||
|
public List<Source> Sources { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Uses the provider to create the content.
|
/// Uses the provider to create the content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Task<ChatThread> CreateFromProviderAsync(IProvider provider, Model chatModel, IContent? lastPrompt, ChatThread? chatChatThread, CancellationToken token = default);
|
public Task<ChatThread> CreateFromProviderAsync(IProvider provider, Model chatModel, IContent? lastUserPrompt, ChatThread? chatChatThread, CancellationToken token = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a deep copy
|
/// Creates a deep copy
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace AIStudio.Chat;
|
||||||
|
|
||||||
|
public static class StringExtensions
|
||||||
|
{
|
||||||
|
public static string RemoveThinkTags(this string input)
|
||||||
|
{
|
||||||
|
const string OPEN_TAG = "<think>";
|
||||||
|
const string CLOSE_TAG = "</think>";
|
||||||
|
if (string.IsNullOrWhiteSpace(input) || !input.StartsWith(OPEN_TAG, StringComparison.Ordinal))
|
||||||
|
return input;
|
||||||
|
|
||||||
|
var endIndex = input.IndexOf(CLOSE_TAG, StringComparison.Ordinal);
|
||||||
|
if (endIndex == -1)
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
return input[(endIndex + CLOSE_TAG.Length)..];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,13 @@ public partial class Changelog
|
|||||||
|
|
||||||
public static readonly Log[] LOGS =
|
public static readonly Log[] LOGS =
|
||||||
[
|
[
|
||||||
|
new (227, "v0.9.52, build 227 (2025-10-24 06:00 UTC)", "v0.9.52.md"),
|
||||||
|
new (226, "v0.9.51, build 226 (2025-09-04 18:02 UTC)", "v0.9.51.md"),
|
||||||
|
new (225, "v0.9.50, build 225 (2025-08-10 16:40 UTC)", "v0.9.50.md"),
|
||||||
|
new (224, "v0.9.49, build 224 (2025-07-02 12:12 UTC)", "v0.9.49.md"),
|
||||||
|
new (223, "v0.9.48, build 223 (2025-06-10 13:15 UTC)", "v0.9.48.md"),
|
||||||
|
new (222, "v0.9.47, build 222 (2025-06-02 18:25 UTC)", "v0.9.47.md"),
|
||||||
|
new (221, "v0.9.46, build 221 (2025-06-01 19:19 UTC)", "v0.9.46.md"),
|
||||||
new (220, "v0.9.45, build 220 (2025-05-25 13:56 UTC)", "v0.9.45.md"),
|
new (220, "v0.9.45, build 220 (2025-05-25 13:56 UTC)", "v0.9.45.md"),
|
||||||
new (219, "v0.9.44, build 219 (2025-05-18 19:33 UTC)", "v0.9.44.md"),
|
new (219, "v0.9.44, build 219 (2025-05-18 19:33 UTC)", "v0.9.44.md"),
|
||||||
new (218, "v0.9.43, build 218 (2025-05-11 17:22 UTC)", "v0.9.43.md"),
|
new (218, "v0.9.43, build 218 (2025-05-11 17:22 UTC)", "v0.9.43.md"),
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
}
|
}
|
||||||
</MudSelect>
|
</MudSelect>
|
||||||
|
|
||||||
<MudMarkdown Value="@this.LogContent" OverrideHeaderTypo="@Markdown.OverrideHeaderTypo"/>
|
<MudMarkdown Value="@this.LogContent" Props="Markdown.DefaultConfig"/>
|
||||||
@@ -81,7 +81,8 @@
|
|||||||
</MudTooltip>
|
</MudTooltip>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ChatTemplateSelection CurrentChatTemplate="@this.currentChatTemplate" CurrentChatTemplateChanged="@this.ChatTemplateWasChanged"/>
|
<ChatTemplateSelection CanChatThreadBeUsedForTemplate="@this.CanThreadBeSaved" CurrentChatThread="@this.ChatThread" CurrentChatTemplate="@this.currentChatTemplate" CurrentChatTemplateChanged="@this.ChatTemplateWasChanged"/>
|
||||||
|
|
||||||
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
|
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
|
||||||
{
|
{
|
||||||
<MudTooltip Text="@T("Delete this chat & start a new one.")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
<MudTooltip Text="@T("Delete this chat & start a new one.")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<ChatThread?> ChatThreadChanged { get; set; }
|
public EventCallback<ChatThread?> ChatThreadChanged { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public AIStudio.Settings.Provider Provider { get; set; }
|
public AIStudio.Settings.Provider Provider { get; set; } = AIStudio.Settings.Provider.NONE;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<AIStudio.Settings.Provider> ProviderChanged { get; set; }
|
public EventCallback<AIStudio.Settings.Provider> ProviderChanged { get; set; }
|
||||||
@@ -34,9 +34,6 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
[Inject]
|
[Inject]
|
||||||
private ILogger<ChatComponent> Logger { get; set; } = null!;
|
private ILogger<ChatComponent> Logger { get; set; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private ThreadSafeRandom RNG { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private IDialogService DialogService { get; init; } = null!;
|
private IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
@@ -80,6 +77,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
|
|
||||||
// Get the preselected chat template:
|
// Get the preselected chat template:
|
||||||
this.currentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(Tools.Components.CHAT);
|
this.currentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(Tools.Components.CHAT);
|
||||||
|
this.userInput = this.currentChatTemplate.PredefinedUserPrompt;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for deferred messages of the kind 'SEND_TO_CHAT',
|
// Check for deferred messages of the kind 'SEND_TO_CHAT',
|
||||||
@@ -272,7 +270,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanThreadBeSaved => this.ChatThread is not null && this.ChatThread.Blocks.Count > 0;
|
private bool CanThreadBeSaved => this.ChatThread is not null && this.ChatThread.Blocks.Any(b => !b.HideFromUser);
|
||||||
|
|
||||||
private string TooltipAddChatToWorkspace => string.Format(T("Start new chat in workspace '{0}'"), this.currentWorkspaceName);
|
private string TooltipAddChatToWorkspace => string.Format(T("Start new chat in workspace '{0}'"), this.currentWorkspaceName);
|
||||||
|
|
||||||
@@ -326,6 +324,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
private async Task ChatTemplateWasChanged(ChatTemplate chatTemplate)
|
private async Task ChatTemplateWasChanged(ChatTemplate chatTemplate)
|
||||||
{
|
{
|
||||||
this.currentChatTemplate = chatTemplate;
|
this.currentChatTemplate = chatTemplate;
|
||||||
|
if(!string.IsNullOrWhiteSpace(this.currentChatTemplate.PredefinedUserPrompt))
|
||||||
|
this.userInput = this.currentChatTemplate.PredefinedUserPrompt;
|
||||||
|
|
||||||
if(this.ChatThread is null)
|
if(this.ChatThread is null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -432,8 +433,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
ChatId = Guid.NewGuid(),
|
ChatId = Guid.NewGuid(),
|
||||||
DataSourceOptions = this.earlyDataSourceOptions,
|
DataSourceOptions = this.earlyDataSourceOptions,
|
||||||
Name = this.ExtractThreadName(this.userInput),
|
Name = this.ExtractThreadName(this.userInput),
|
||||||
Seed = this.RNG.Next(),
|
Blocks = this.currentChatTemplate == ChatTemplate.NO_CHAT_TEMPLATE ? [] : this.currentChatTemplate.ExampleConversation.Select(x => x.DeepClone()).ToList(),
|
||||||
Blocks = this.currentChatTemplate == default ? [] : this.currentChatTemplate.ExampleConversation.Select(x => x.DeepClone()).ToList(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.ChatThreadChanged.InvokeAsync(this.ChatThread);
|
await this.ChatThreadChanged.InvokeAsync(this.ChatThread);
|
||||||
@@ -505,7 +505,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Clear the input field:
|
// Clear the input field:
|
||||||
|
await this.inputField.FocusAsync();
|
||||||
this.userInput = string.Empty;
|
this.userInput = string.Empty;
|
||||||
|
await this.inputField.BlurAsync();
|
||||||
|
|
||||||
// Enable the stream state for the chat component:
|
// Enable the stream state for the chat component:
|
||||||
this.isStreaming = true;
|
this.isStreaming = true;
|
||||||
@@ -526,7 +528,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
// Use the selected provider to get the AI response.
|
// Use the selected provider to get the AI response.
|
||||||
// By awaiting this line, we wait for the entire
|
// By awaiting this line, we wait for the entire
|
||||||
// content to be streamed.
|
// content to be streamed.
|
||||||
this.ChatThread = await aiText.CreateFromProviderAsync(this.Provider.CreateProvider(this.Logger), this.Provider.Model, lastUserPrompt, this.ChatThread, this.cancellationTokenSource.Token);
|
this.ChatThread = await aiText.CreateFromProviderAsync(this.Provider.CreateProvider(), this.Provider.Model, lastUserPrompt, this.ChatThread, this.cancellationTokenSource.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cancellationTokenSource = null;
|
this.cancellationTokenSource = null;
|
||||||
@@ -581,9 +583,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
//
|
//
|
||||||
if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges)
|
if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges)
|
||||||
{
|
{
|
||||||
var dialogParameters = new DialogParameters
|
var dialogParameters = new DialogParameters<ConfirmDialog>
|
||||||
{
|
{
|
||||||
{ "Message", "Are you sure you want to start a new chat? All unsaved changes will be lost." },
|
{ x => x.Message, "Are you sure you want to start a new chat? All unsaved changes will be lost." },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Chat", dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Chat", dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
@@ -628,7 +630,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
case AddChatProviderBehavior.ADDED_CHATS_USE_LATEST_PROVIDER:
|
case AddChatProviderBehavior.ADDED_CHATS_USE_LATEST_PROVIDER:
|
||||||
if(this.Provider == default)
|
if(this.Provider == AIStudio.Settings.Provider.NONE)
|
||||||
{
|
{
|
||||||
this.Provider = this.SettingsManager.GetPreselectedProvider(Tools.Components.CHAT);
|
this.Provider = this.SettingsManager.GetPreselectedProvider(Tools.Components.CHAT);
|
||||||
await this.ProviderChanged.InvokeAsync(this.Provider);
|
await this.ProviderChanged.InvokeAsync(this.Provider);
|
||||||
@@ -668,11 +670,12 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
WorkspaceId = this.currentWorkspaceId,
|
WorkspaceId = this.currentWorkspaceId,
|
||||||
ChatId = Guid.NewGuid(),
|
ChatId = Guid.NewGuid(),
|
||||||
Name = string.Empty,
|
Name = string.Empty,
|
||||||
Seed = this.RNG.Next(),
|
Blocks = this.currentChatTemplate == ChatTemplate.NO_CHAT_TEMPLATE ? [] : this.currentChatTemplate.ExampleConversation.Select(x => x.DeepClone()).ToList(),
|
||||||
Blocks = this.currentChatTemplate == default ? [] : this.currentChatTemplate.ExampleConversation.Select(x => x.DeepClone()).ToList(),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.userInput = this.currentChatTemplate.PredefinedUserPrompt;
|
||||||
|
|
||||||
// Now, we have to reset the data source options as well:
|
// Now, we have to reset the data source options as well:
|
||||||
this.ApplyStandardDataSourceOptions();
|
this.ApplyStandardDataSourceOptions();
|
||||||
|
|
||||||
@@ -687,9 +690,9 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
|
|
||||||
if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges)
|
if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY && this.hasUnsavedChanges)
|
||||||
{
|
{
|
||||||
var confirmationDialogParameters = new DialogParameters
|
var confirmationDialogParameters = new DialogParameters<ConfirmDialog>
|
||||||
{
|
{
|
||||||
{ "Message", T("Are you sure you want to move this chat? All unsaved changes will be lost.") },
|
{ x => x.Message, T("Are you sure you want to move this chat? All unsaved changes will be lost.") },
|
||||||
};
|
};
|
||||||
|
|
||||||
var confirmationDialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Unsaved Changes", confirmationDialogParameters, DialogOptions.FULLSCREEN);
|
var confirmationDialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Unsaved Changes", confirmationDialogParameters, DialogOptions.FULLSCREEN);
|
||||||
@@ -698,11 +701,11 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dialogParameters = new DialogParameters
|
var dialogParameters = new DialogParameters<WorkspaceSelectionDialog>
|
||||||
{
|
{
|
||||||
{ "Message", T("Please select the workspace where you want to move the chat to.") },
|
{ x => x.Message, T("Please select the workspace where you want to move the chat to.") },
|
||||||
{ "SelectedWorkspace", this.ChatThread?.WorkspaceId },
|
{ x => x.SelectedWorkspace, this.ChatThread?.WorkspaceId ?? Guid.Empty },
|
||||||
{ "ConfirmText", T("Move chat") },
|
{ x => x.ConfirmText, T("Move chat") },
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialogReference = await this.DialogService.ShowAsync<WorkspaceSelectionDialog>(T("Move Chat to Workspace"), dialogParameters, DialogOptions.FULLSCREEN);
|
var dialogReference = await this.DialogService.ShowAsync<WorkspaceSelectionDialog>(T("Move Chat to Workspace"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
@@ -789,7 +792,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LoadingChatProviderBehavior.ALWAYS_USE_LATEST_CHAT_PROVIDER:
|
case LoadingChatProviderBehavior.ALWAYS_USE_LATEST_CHAT_PROVIDER:
|
||||||
if(this.Provider == default)
|
if(this.Provider == AIStudio.Settings.Provider.NONE)
|
||||||
this.Provider = this.SettingsManager.GetPreselectedProvider(Tools.Components.CHAT);
|
this.Provider = this.SettingsManager.GetPreselectedProvider(Tools.Components.CHAT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -807,9 +810,8 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
// Try to select the chat template:
|
// Try to select the chat template:
|
||||||
if (!string.IsNullOrWhiteSpace(chatChatTemplate))
|
if (!string.IsNullOrWhiteSpace(chatChatTemplate))
|
||||||
{
|
{
|
||||||
this.currentChatTemplate = this.SettingsManager.ConfigurationData.ChatTemplates.FirstOrDefault(x => x.Id == chatChatTemplate);
|
var selectedTemplate = this.SettingsManager.ConfigurationData.ChatTemplates.FirstOrDefault(x => x.Id == chatChatTemplate);
|
||||||
if(this.currentChatTemplate == default)
|
this.currentChatTemplate = selectedTemplate ?? ChatTemplate.NO_CHAT_TEMPLATE;
|
||||||
this.currentChatTemplate = ChatTemplate.NO_CHAT_TEMPLATE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
<ChildContent>
|
<ChildContent>
|
||||||
<MudMenuItem Icon="@Icons.Material.Filled.Settings" Label="@T("Manage your templates")" OnClick="async () => await this.OpenSettingsDialog()" />
|
<MudMenuItem Icon="@Icons.Material.Filled.Settings" Label="@T("Manage your templates")" OnClick="async () => await this.OpenSettingsDialog()" />
|
||||||
<MudDivider/>
|
<MudDivider/>
|
||||||
|
<MudMenuItem Icon="@Icons.Material.Filled.AddComment" Label="@T("Create template from current chat")" OnClick="async () => await this.CreateNewChatTemplateFromChat()" Disabled="@(!this.CanChatThreadBeUsedForTemplate)"/>
|
||||||
|
<MudDivider/>
|
||||||
@foreach (var chatTemplate in this.SettingsManager.ConfigurationData.ChatTemplates.GetAllChatTemplates())
|
@foreach (var chatTemplate in this.SettingsManager.ConfigurationData.ChatTemplates.GetAllChatTemplates())
|
||||||
{
|
{
|
||||||
<MudMenuItem Icon="@Icons.Material.Filled.RateReview" OnClick="async () => await this.SelectionChanged(chatTemplate)">
|
<MudMenuItem Icon="@Icons.Material.Filled.RateReview" OnClick="async () => await this.SelectionChanged(chatTemplate)">
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using AIStudio.Chat;
|
||||||
using AIStudio.Dialogs.Settings;
|
using AIStudio.Dialogs.Settings;
|
||||||
using AIStudio.Settings;
|
using AIStudio.Settings;
|
||||||
|
|
||||||
@@ -11,6 +12,12 @@ public partial class ChatTemplateSelection : MSGComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public ChatTemplate CurrentChatTemplate { get; set; } = ChatTemplate.NO_CHAT_TEMPLATE;
|
public ChatTemplate CurrentChatTemplate { get; set; } = ChatTemplate.NO_CHAT_TEMPLATE;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool CanChatThreadBeUsedForTemplate { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public ChatThread? CurrentChatThread { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<ChatTemplate> CurrentChatTemplateChanged { get; set; }
|
public EventCallback<ChatTemplate> CurrentChatTemplateChanged { get; set; }
|
||||||
|
|
||||||
@@ -36,4 +43,14 @@ public partial class ChatTemplateSelection : MSGComponentBase
|
|||||||
var dialogParameters = new DialogParameters();
|
var dialogParameters = new DialogParameters();
|
||||||
await this.DialogService.ShowAsync<SettingsDialogChatTemplate>(T("Open Chat Template Options"), dialogParameters, DialogOptions.FULLSCREEN);
|
await this.DialogService.ShowAsync<SettingsDialogChatTemplate>(T("Open Chat Template Options"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task CreateNewChatTemplateFromChat()
|
||||||
|
{
|
||||||
|
var dialogParameters = new DialogParameters<SettingsDialogChatTemplate>
|
||||||
|
{
|
||||||
|
{ x => x.CreateTemplateFromExistingChatThread, true },
|
||||||
|
{ x => x.ExistingChatThread, this.CurrentChatThread }
|
||||||
|
};
|
||||||
|
await this.DialogService.ShowAsync<SettingsDialogChatTemplate>(T("Open Chat Template Options"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
@if (!this.IsInline)
|
||||||
|
{
|
||||||
|
@if (this.ParentTabs is null)
|
||||||
|
{
|
||||||
|
<MudPaper Class="code-block no-elevation" Style="@this.BlockPadding">
|
||||||
|
<pre>
|
||||||
|
<code>
|
||||||
|
@this.ChildContent
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
</MudPaper>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<span class="inline-code-block">
|
||||||
|
<kbd>
|
||||||
|
@this.ChildContent
|
||||||
|
</kbd>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Rendering;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public partial class CodeBlock : ComponentBase
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public RenderFragment? ChildContent { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string? Title { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool IsInline { get; set; }
|
||||||
|
|
||||||
|
[CascadingParameter]
|
||||||
|
public CodeTabs? ParentTabs { get; set; }
|
||||||
|
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
if (this.ParentTabs is not null && this.Title is not null)
|
||||||
|
{
|
||||||
|
void BlockSelf(RenderTreeBuilder builder)
|
||||||
|
{
|
||||||
|
builder.OpenComponent<CodeBlock>(0);
|
||||||
|
builder.AddAttribute(1, "Title", this.Title);
|
||||||
|
builder.AddAttribute(2, "ChildContent", this.ChildContent);
|
||||||
|
builder.CloseComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ParentTabs.RegisterBlock(this.Title, BlockSelf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string BlockPadding => this.ParentTabs is null ? "padding: 16px !important;" : "padding: 8px !important";
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<MudTabs ActivePanelIndex="this.SelectedIndex" ActivePanelIndexChanged="async idx => await this.TabChanged(idx)" PanelClass="code-block mt-1" MinimumTabWidth="30px" Class="mt-2">
|
||||||
|
@foreach (var block in this.blocks)
|
||||||
|
{
|
||||||
|
<MudTabPanel Text="@block.Title">
|
||||||
|
@block.Fragment
|
||||||
|
</MudTabPanel>
|
||||||
|
}
|
||||||
|
</MudTabs>
|
||||||
|
<CascadingValue Value="this">
|
||||||
|
@this.ChildContent
|
||||||
|
</CascadingValue>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public partial class CodeTabs : ComponentBase
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public RenderFragment? ChildContent { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public int SelectedIndex { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<int> SelectedIndexChanged { get; set; }
|
||||||
|
|
||||||
|
private readonly List<CodeTabItem> blocks = new();
|
||||||
|
|
||||||
|
internal void RegisterBlock(string title, RenderFragment fragment)
|
||||||
|
{
|
||||||
|
this.blocks.Add(new CodeTabItem
|
||||||
|
{
|
||||||
|
Title = title,
|
||||||
|
Fragment = fragment,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CodeTabItem
|
||||||
|
{
|
||||||
|
public string Title { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
public RenderFragment Fragment { get; init; } = null!;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task TabChanged(int index)
|
||||||
|
{
|
||||||
|
this.SelectedIndex = index;
|
||||||
|
await this.SelectedIndexChanged.InvokeAsync(index);
|
||||||
|
await this.InvokeAsync(this.StateHasChanged);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,7 +44,7 @@ public partial class ConfidenceInfo : MSGComponentBase
|
|||||||
{
|
{
|
||||||
var index = 0;
|
var index = 0;
|
||||||
foreach (var source in this.currentConfidence.Sources)
|
foreach (var source in this.currentConfidence.Sources)
|
||||||
yield return ($"Source {++index}", source);
|
yield return (string.Format(T("Source {0}"), ++index), source);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetCurrentConfidenceColor() => $"color: {this.currentConfidence.Level.GetColor(this.SettingsManager)};";
|
private string GetCurrentConfidenceColor() => $"color: {this.currentConfidence.Level.GetColor(this.SettingsManager)};";
|
||||||
|
|||||||
@@ -1 +1,23 @@
|
|||||||
@inherits MSGComponentBase
|
@inherits MSGComponentBase
|
||||||
|
|
||||||
|
@if (this.Body is not null)
|
||||||
|
{
|
||||||
|
@if (!this.Disabled() && this.IsLocked())
|
||||||
|
{
|
||||||
|
<MudField Label="@this.Label" Variant="@this.Variant" Underline="false" HelperText="@this.OptionHelp" Class="@this.Classes" InnerPadding="false">
|
||||||
|
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.FlexStart" Wrap="Wrap.NoWrap" StretchItems="this.StretchItems">
|
||||||
|
@* MudTooltip.RootStyle is set as a workaround for issue -> https://github.com/MudBlazor/MudBlazor/issues/10882 *@
|
||||||
|
<MudTooltip Text="@TB("This feature is managed by your organization and has therefore been disabled.")" Arrow="true" Placement="Placement.Right" RootStyle="display:inline-flex;">
|
||||||
|
<MudIcon Icon="@Icons.Material.Filled.Lock" Color="Color.Error" Size="Size.Small" Class="mr-1"/>
|
||||||
|
</MudTooltip>
|
||||||
|
@this.Body
|
||||||
|
</MudStack>
|
||||||
|
</MudField>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudField Label="@this.Label" Variant="@this.Variant" Underline="false" HelperText="@this.OptionHelp" Class="@this.Classes" InnerPadding="false">
|
||||||
|
@this.Body
|
||||||
|
</MudField>
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ namespace AIStudio.Components;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A base class for configuration options.
|
/// A base class for configuration options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ConfigurationBase : MSGComponentBase
|
public abstract partial class ConfigurationBase : MSGComponentBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The description of the option, i.e., the name. Should be
|
/// The description of the option, i.e., the name. Should be
|
||||||
@@ -26,7 +26,42 @@ public partial class ConfigurationBase : MSGComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<bool> Disabled { get; set; } = () => false;
|
public Func<bool> Disabled { get; set; } = () => false;
|
||||||
|
|
||||||
protected const string MARGIN_CLASS = "mb-6";
|
/// <summary>
|
||||||
|
/// Is the option locked by a configuration plugin?
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public Func<bool> IsLocked { get; set; } = () => false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should the option be stretched to fill the available space?
|
||||||
|
/// </summary>
|
||||||
|
protected abstract bool Stretch { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The CSS class to apply to the component.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual string GetClassForBase => string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The visual variant of the option.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual Variant Variant => Variant.Text;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The label to display for the option.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual string Label => string.Empty;
|
||||||
|
|
||||||
|
private StretchItems StretchItems => this.Stretch ? StretchItems.End : StretchItems.None;
|
||||||
|
|
||||||
|
protected bool IsDisabled => this.Disabled() || this.IsLocked();
|
||||||
|
|
||||||
|
private string Classes => $"{this.GetClassForBase} {MARGIN_CLASS}";
|
||||||
|
|
||||||
|
private protected virtual RenderFragment? Body => null;
|
||||||
|
|
||||||
|
private const string MARGIN_CLASS = "mb-6";
|
||||||
|
|
||||||
protected static readonly Dictionary<string, object?> SPELLCHECK_ATTRIBUTES = new();
|
protected static readonly Dictionary<string, object?> SPELLCHECK_ATTRIBUTES = new();
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
@@ -39,7 +74,9 @@ public partial class ConfigurationBase : MSGComponentBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private string TB(string fallbackEN) => this.T(fallbackEN, typeof(ConfigurationBase).Namespace, nameof(ConfigurationBase));
|
||||||
|
|
||||||
protected async Task InformAboutChange() => await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
protected async Task InformAboutChange() => await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
|
||||||
|
|
||||||
#region Overrides of MSGComponentBase
|
#region Overrides of MSGComponentBase
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Rendering;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public abstract class ConfigurationBaseCore : ConfigurationBase
|
||||||
|
{
|
||||||
|
private protected sealed override RenderFragment Body => this.BuildRenderTree;
|
||||||
|
|
||||||
|
// Allow content to be provided by a .razor file but without
|
||||||
|
// overriding the content of the base class
|
||||||
|
protected new virtual void BuildRenderTree(RenderTreeBuilder builder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
@using AIStudio.Settings
|
@using AIStudio.Settings
|
||||||
@inherits MSGComponentBase
|
@inherits MSGComponentBase
|
||||||
<ConfigurationSelect Disabled="@this.Disabled" OptionDescription="@T("Select a minimum confidence level")" SelectedValue="@this.FilteredSelectedValue" Data="@ConfigurationSelectDataFactory.GetConfidenceLevelsData(this.SettingsManager, this.RestrictToGlobalMinimumConfidence)" SelectionUpdate="@this.SelectionUpdate" OptionHelp="@T("Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level.")"/>
|
<ConfigurationSelect IsLocked="this.IsLocked" Disabled="this.Disabled" OptionDescription="@T("Select a minimum confidence level")" SelectedValue="@this.FilteredSelectedValue" Data="@ConfigurationSelectDataFactory.GetConfidenceLevelsData(this.SettingsManager, this.RestrictToGlobalMinimumConfidence)" SelectionUpdate="@this.SelectionUpdate" OptionHelp="@T("Choose the minimum confidence level that all LLM providers must meet. This way, you can ensure that only trustworthy providers are used. You cannot use any provider that falls below this level.")"/>
|
||||||
@@ -18,17 +18,17 @@ public partial class ConfigurationMinConfidenceSelection : MSGComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Action<ConfidenceLevel> SelectionUpdate { get; set; } = _ => { };
|
public Action<ConfidenceLevel> SelectionUpdate { get; set; } = _ => { };
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Is the selection component disabled?
|
|
||||||
/// </summary>
|
|
||||||
[Parameter]
|
|
||||||
public Func<bool> Disabled { get; set; } = () => false;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Boolean value indicating whether the selection is restricted to a global minimum confidence level.
|
/// Boolean value indicating whether the selection is restricted to a global minimum confidence level.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public bool RestrictToGlobalMinimumConfidence { get; set; }
|
public bool RestrictToGlobalMinimumConfidence { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Func<bool> Disabled { get; set; } = () => false;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Func<bool> IsLocked { get; set; } = () => false;
|
||||||
|
|
||||||
private ConfidenceLevel FilteredSelectedValue()
|
private ConfidenceLevel FilteredSelectedValue()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@inherits ConfigurationBase
|
@inherits ConfigurationBaseCore
|
||||||
@typeparam TData
|
@typeparam TData
|
||||||
|
|
||||||
<MudSelectExtended
|
<MudSelectExtended
|
||||||
@@ -7,12 +7,10 @@
|
|||||||
MultiSelectionTextFunc="@this.GetMultiSelectionText"
|
MultiSelectionTextFunc="@this.GetMultiSelectionText"
|
||||||
SelectedValues="@this.SelectedValues()"
|
SelectedValues="@this.SelectedValues()"
|
||||||
Strict="@true"
|
Strict="@true"
|
||||||
Disabled="@this.Disabled()"
|
Disabled="@this.IsDisabled"
|
||||||
Margin="Margin.Dense"
|
Margin="Margin.Dense"
|
||||||
Label="@this.OptionDescription"
|
Class="rounded-lg"
|
||||||
Class="@GetClass"
|
Underline="false"
|
||||||
Variant="Variant.Outlined"
|
|
||||||
HelperText="@this.OptionHelp"
|
|
||||||
SelectedValuesChanged="@this.OptionChanged">
|
SelectedValuesChanged="@this.OptionChanged">
|
||||||
@foreach (var data in this.Data)
|
@foreach (var data in this.Data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace AIStudio.Components;
|
|||||||
/// Configuration component for selecting many values from a list.
|
/// Configuration component for selecting many values from a list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TData">The type of the value to select.</typeparam>
|
/// <typeparam name="TData">The type of the value to select.</typeparam>
|
||||||
public partial class ConfigurationMultiSelect<TData> : ConfigurationBase
|
public partial class ConfigurationMultiSelect<TData> : ConfigurationBaseCore
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The data to select from.
|
/// The data to select from.
|
||||||
@@ -28,6 +28,19 @@ public partial class ConfigurationMultiSelect<TData> : ConfigurationBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Action<HashSet<TData>> SelectionUpdate { get; set; } = _ => { };
|
public Action<HashSet<TData>> SelectionUpdate { get; set; } = _ => { };
|
||||||
|
|
||||||
|
#region Overrides of ConfigurationBase
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override bool Stretch => true;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override Variant Variant => Variant.Outlined;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override string Label => this.OptionDescription;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
private async Task OptionChanged(IEnumerable<TData?>? updatedValues)
|
private async Task OptionChanged(IEnumerable<TData?>? updatedValues)
|
||||||
{
|
{
|
||||||
if(updatedValues is null)
|
if(updatedValues is null)
|
||||||
@@ -39,8 +52,6 @@ public partial class ConfigurationMultiSelect<TData> : ConfigurationBase
|
|||||||
await this.InformAboutChange();
|
await this.InformAboutChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetClass => $"{MARGIN_CLASS} rounded-lg";
|
|
||||||
|
|
||||||
private string GetMultiSelectionText(List<TData?>? selectedValues)
|
private string GetMultiSelectionText(List<TData?>? selectedValues)
|
||||||
{
|
{
|
||||||
if(selectedValues is null || selectedValues.Count == 0)
|
if(selectedValues is null || selectedValues.Count == 0)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@inherits ConfigurationBase
|
@inherits ConfigurationBaseCore
|
||||||
|
|
||||||
<MudField Disabled="@this.Disabled()" Label="@this.OptionDescription" Variant="Variant.Outlined" HelperText="@this.OptionHelp" Class="@MARGIN_CLASS">
|
<MudSwitch T="bool" Disabled="@this.IsDisabled" Value="@this.State()" ValueChanged="@this.OptionChanged" Color="Color.Primary">
|
||||||
<MudSwitch T="bool" Disabled="@this.Disabled()" Value="@this.State()" ValueChanged="@this.OptionChanged" Color="Color.Primary">
|
@(this.State() ? this.LabelOn : this.LabelOff)
|
||||||
@(this.State() ? this.LabelOn : this.LabelOff)
|
</MudSwitch>
|
||||||
</MudSwitch>
|
|
||||||
</MudField>
|
|
||||||
@@ -5,7 +5,7 @@ namespace AIStudio.Components;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configuration component for any boolean option.
|
/// Configuration component for any boolean option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ConfigurationOption : ConfigurationBase
|
public partial class ConfigurationOption : ConfigurationBaseCore
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Text to display when the option is true.
|
/// Text to display when the option is true.
|
||||||
@@ -31,6 +31,19 @@ public partial class ConfigurationOption : ConfigurationBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Action<bool> StateUpdate { get; set; } = _ => { };
|
public Action<bool> StateUpdate { get; set; } = _ => { };
|
||||||
|
|
||||||
|
#region Overrides of ConfigurationBase
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override bool Stretch => true;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override Variant Variant => Variant.Outlined;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override string Label => this.OptionDescription;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
private async Task OptionChanged(bool updatedState)
|
private async Task OptionChanged(bool updatedState)
|
||||||
{
|
{
|
||||||
this.StateUpdate(updatedState);
|
this.StateUpdate(updatedState);
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
@inherits MSGComponentBase
|
@inherits MSGComponentBase
|
||||||
<ConfigurationSelect OptionDescription="@T("Preselected provider")" Disabled="@this.Disabled" OptionHelp="@this.HelpText()" Data="@this.FilteredData()" SelectedValue="@this.SelectedValue" SelectionUpdate="@this.SelectionUpdate"/>
|
<ConfigurationSelect IsLocked="@this.IsLocked" OptionDescription="@T("Preselected provider")" Disabled="@(() => this.Disabled())" OptionHelp="@this.HelpText()" Data="@this.FilteredData()" SelectedValue="@this.SelectedValue" SelectionUpdate="@this.SelectionUpdate"/>
|
||||||
@@ -20,27 +20,17 @@ public partial class ConfigurationProviderSelection : MSGComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public IEnumerable<ConfigurationSelectData<string>> Data { get; set; } = new List<ConfigurationSelectData<string>>();
|
public IEnumerable<ConfigurationSelectData<string>> Data { get; set; } = new List<ConfigurationSelectData<string>>();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Is the selection component disabled?
|
|
||||||
/// </summary>
|
|
||||||
[Parameter]
|
|
||||||
public Func<bool> Disabled { get; set; } = () => false;
|
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<string> HelpText { get; set; } = () => TB("Select a provider that is preselected.");
|
public Func<string> HelpText { get; set; } = () => TB("Select a provider that is preselected.");
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Tools.Components Component { get; set; } = Tools.Components.NONE;
|
public Tools.Components Component { get; set; } = Tools.Components.NONE;
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
[Parameter]
|
||||||
|
public Func<bool> Disabled { get; set; } = () => false;
|
||||||
protected override async Task OnParametersSetAsync()
|
|
||||||
{
|
[Parameter]
|
||||||
this.ApplyFilters([], [ Event.CONFIGURATION_CHANGED ]);
|
public Func<bool> IsLocked { get; set; } = () => false;
|
||||||
await base.OnParametersSetAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
[SuppressMessage("Usage", "MWAIS0001:Direct access to `Providers` is not allowed")]
|
||||||
private IEnumerable<ConfigurationSelectData<string>> FilteredData()
|
private IEnumerable<ConfigurationSelectData<string>> FilteredData()
|
||||||
@@ -52,6 +42,9 @@ public partial class ConfigurationProviderSelection : MSGComponentBase
|
|||||||
foreach (var providerId in this.Data)
|
foreach (var providerId in this.Data)
|
||||||
{
|
{
|
||||||
var provider = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == providerId.Value);
|
var provider = this.SettingsManager.ConfigurationData.Providers.FirstOrDefault(x => x.Id == providerId.Value);
|
||||||
|
if (provider is null)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
||||||
yield return providerId;
|
yield return providerId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@inherits ConfigurationBase
|
@inherits ConfigurationBaseCore
|
||||||
@typeparam T
|
@typeparam TConfig
|
||||||
|
|
||||||
<MudSelect T="T" Value="@this.SelectedValue()" Strict="@true" ShrinkLabel="@true" Disabled="@this.Disabled()" Margin="Margin.Dense" Label="@this.OptionDescription" Class="@GetClass" Variant="Variant.Outlined" HelperText="@this.OptionHelp" ValueChanged="@this.OptionChanged">
|
<MudSelect T="TConfig" Value="@this.SelectedValue()" Strict="@true" ShrinkLabel="@true" Disabled="@this.IsDisabled" Margin="Margin.Dense" Class="rounded-lg mb-0" Underline="false" ValueChanged="@this.OptionChanged">
|
||||||
@foreach (var data in this.Data)
|
@foreach (var data in this.Data)
|
||||||
{
|
{
|
||||||
<MudSelectItem Value="@data.Value">
|
<MudSelectItem Value="@data.Value">
|
||||||
|
|||||||
@@ -7,33 +7,44 @@ namespace AIStudio.Components;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configuration component for selecting a value from a list.
|
/// Configuration component for selecting a value from a list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of the value to select.</typeparam>
|
/// <typeparam name="TConfig">The type of the value to select.</typeparam>
|
||||||
public partial class ConfigurationSelect<T> : ConfigurationBase
|
public partial class ConfigurationSelect<TConfig> : ConfigurationBaseCore
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The data to select from.
|
/// The data to select from.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public IEnumerable<ConfigurationSelectData<T>> Data { get; set; } = [];
|
public IEnumerable<ConfigurationSelectData<TConfig>> Data { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The selected value.
|
/// The selected value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<T> SelectedValue { get; set; } = () => default!;
|
public Func<TConfig> SelectedValue { get; set; } = () => default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An action that is called when the selection changes.
|
/// An action that is called when the selection changes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Action<T> SelectionUpdate { get; set; } = _ => { };
|
public Action<TConfig> SelectionUpdate { get; set; } = _ => { };
|
||||||
|
|
||||||
private async Task OptionChanged(T updatedValue)
|
#region Overrides of ConfigurationBase
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override bool Stretch => true;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override string Label => this.OptionDescription;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override Variant Variant => Variant.Outlined;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private async Task OptionChanged(TConfig updatedValue)
|
||||||
{
|
{
|
||||||
this.SelectionUpdate(updatedValue);
|
this.SelectionUpdate(updatedValue);
|
||||||
await this.SettingsManager.StoreSettings();
|
await this.SettingsManager.StoreSettings();
|
||||||
await this.InformAboutChange();
|
await this.InformAboutChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetClass => $"{MARGIN_CLASS} rounded-lg";
|
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
@typeparam T
|
@typeparam T
|
||||||
@inherits ConfigurationBase
|
@inherits ConfigurationBaseCore
|
||||||
|
|
||||||
<MudField Label="@this.OptionDescription" Variant="Variant.Outlined" Class="mb-3" Disabled="@this.Disabled()">
|
<MudSlider T="@T" Size="Size.Medium" Value="@this.Value()" ValueChanged="@this.OptionChanged" Min="@this.Min" Max="@this.Max" Step="@this.Step" Immediate="@true" Disabled="@this.IsDisabled" Class="mb-1">
|
||||||
<MudSlider T="@T" Size="Size.Medium" Value="@this.Value()" ValueChanged="@this.OptionChanged" Min="@this.Min" Max="@this.Max" Step="@this.Step" Immediate="@true" Disabled="@this.Disabled()">
|
@this.Value() @this.Unit
|
||||||
@this.Value() @this.Unit
|
</MudSlider>
|
||||||
</MudSlider>
|
|
||||||
</MudField>
|
|
||||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Components;
|
|||||||
|
|
||||||
namespace AIStudio.Components;
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
public partial class ConfigurationSlider<T> : ConfigurationBase where T : struct, INumber<T>
|
public partial class ConfigurationSlider<T> : ConfigurationBaseCore where T : struct, INumber<T>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum value for the slider.
|
/// The minimum value for the slider.
|
||||||
@@ -42,6 +42,18 @@ public partial class ConfigurationSlider<T> : ConfigurationBase where T : struct
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public Action<T> ValueUpdate { get; set; } = _ => { };
|
public Action<T> ValueUpdate { get; set; } = _ => { };
|
||||||
|
|
||||||
|
#region Overrides of ConfigurationBase
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override bool Stretch => true;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override Variant Variant => Variant.Outlined;
|
||||||
|
|
||||||
|
protected override string Label => this.OptionDescription;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
@inherits ConfigurationBase
|
@inherits ConfigurationBaseCore
|
||||||
|
|
||||||
<MudTextField
|
<MudTextField
|
||||||
T="string"
|
T="string"
|
||||||
Text="@this.Text()"
|
Text="@this.Text()"
|
||||||
TextChanged="@this.InternalUpdate"
|
TextChanged="@this.InternalUpdate"
|
||||||
Label="@this.OptionDescription"
|
Disabled="@this.IsDisabled"
|
||||||
Disabled="@this.Disabled()"
|
|
||||||
Class="@MARGIN_CLASS"
|
|
||||||
Adornment="Adornment.Start"
|
Adornment="Adornment.Start"
|
||||||
AdornmentIcon="@this.Icon"
|
AdornmentIcon="@this.Icon"
|
||||||
AdornmentColor="@this.IconColor"
|
AdornmentColor="@this.IconColor"
|
||||||
@@ -15,5 +13,5 @@
|
|||||||
AutoGrow="@this.AutoGrow"
|
AutoGrow="@this.AutoGrow"
|
||||||
MaxLines="@this.GetMaxLines"
|
MaxLines="@this.GetMaxLines"
|
||||||
Immediate="@true"
|
Immediate="@true"
|
||||||
Variant="Variant.Outlined"
|
Underline="false"
|
||||||
/>
|
/>
|
||||||
@@ -4,7 +4,7 @@ using Timer = System.Timers.Timer;
|
|||||||
|
|
||||||
namespace AIStudio.Components;
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
public partial class ConfigurationText : ConfigurationBase
|
public partial class ConfigurationText : ConfigurationBaseCore
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The text used for the textfield.
|
/// The text used for the textfield.
|
||||||
@@ -43,10 +43,21 @@ public partial class ConfigurationText : ConfigurationBase
|
|||||||
public int MaxLines { get; set; } = 12;
|
public int MaxLines { get; set; } = 12;
|
||||||
|
|
||||||
private string internalText = string.Empty;
|
private string internalText = string.Empty;
|
||||||
private Timer timer = new(TimeSpan.FromMilliseconds(500))
|
private readonly Timer timer = new(TimeSpan.FromMilliseconds(500))
|
||||||
{
|
{
|
||||||
AutoReset = false
|
AutoReset = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#region Overrides of ConfigurationBase
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override bool Stretch => true;
|
||||||
|
|
||||||
|
protected override Variant Variant => Variant.Outlined;
|
||||||
|
|
||||||
|
protected override string Label => this.OptionDescription;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Overrides of ConfigurationBase
|
#region Overrides of ConfigurationBase
|
||||||
|
|
||||||
@@ -56,8 +67,6 @@ public partial class ConfigurationText : ConfigurationBase
|
|||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
this.internalText = this.Text();
|
this.internalText = this.Text();
|
||||||
@@ -66,8 +75,6 @@ public partial class ConfigurationText : ConfigurationBase
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private bool AutoGrow => this.NumLines > 1;
|
private bool AutoGrow => this.NumLines > 1;
|
||||||
|
|
||||||
private int GetMaxLines => this.AutoGrow ? this.MaxLines : 1;
|
private int GetMaxLines => this.AutoGrow ? this.MaxLines : 1;
|
||||||
@@ -85,4 +92,23 @@ public partial class ConfigurationText : ConfigurationBase
|
|||||||
await this.SettingsManager.StoreSettings();
|
await this.SettingsManager.StoreSettings();
|
||||||
await this.InformAboutChange();
|
await this.InformAboutChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Overrides of MSGComponentBase
|
||||||
|
|
||||||
|
protected override void DisposeResources()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.timer.Stop();
|
||||||
|
this.timer.Dispose();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
base.DisposeResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
}
|
}
|
||||||
else if (this.showDataSourceSelection)
|
else if (this.showDataSourceSelection)
|
||||||
{
|
{
|
||||||
<MudTextSwitch Label="Are data sources enabled?" Value="@this.areDataSourcesEnabled" LabelOn="@T("Yes, I want to use data sources.")" LabelOff="@T("No, I don't want to use data sources.")" ValueChanged="@this.EnabledChanged"/>
|
<MudTextSwitch Label="@T("Are data sources enabled?")" Value="@this.areDataSourcesEnabled" LabelOn="@T("Yes, I want to use data sources.")" LabelOff="@T("No, I don't want to use data sources.")" ValueChanged="@this.EnabledChanged"/>
|
||||||
@if (this.areDataSourcesEnabled)
|
@if (this.areDataSourcesEnabled)
|
||||||
{
|
{
|
||||||
<MudTextSwitch Label="@T("AI-based data source selection")" Value="@this.aiBasedSourceSelection" LabelOn="@T("Yes, let the AI decide which data sources are needed.")" LabelOff="@T("No, I manually decide which data source to use.")" ValueChanged="@this.AutoModeChanged"/>
|
<MudTextSwitch Label="@T("AI-based data source selection")" Value="@this.aiBasedSourceSelection" LabelOn="@T("Yes, let the AI decide which data sources are needed.")" LabelOff="@T("No, I manually decide which data source to use.")" ValueChanged="@this.AutoModeChanged"/>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Timer = System.Timers.Timer;
|
|||||||
|
|
||||||
namespace AIStudio.Components;
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
public partial class DebouncedTextField : MudComponentBase
|
public partial class DebouncedTextField : MudComponentBase, IDisposable
|
||||||
{
|
{
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string Label { get; set; } = string.Empty;
|
public string Label { get; set; } = string.Empty;
|
||||||
@@ -50,12 +50,15 @@ public partial class DebouncedTextField : MudComponentBase
|
|||||||
|
|
||||||
private readonly Timer debounceTimer = new();
|
private readonly Timer debounceTimer = new();
|
||||||
private string text = string.Empty;
|
private string text = string.Empty;
|
||||||
|
private string lastParameterText = string.Empty;
|
||||||
|
private bool isInitialized;
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
this.text = this.Text;
|
this.text = this.Text;
|
||||||
|
this.lastParameterText = this.Text;
|
||||||
this.debounceTimer.AutoReset = false;
|
this.debounceTimer.AutoReset = false;
|
||||||
this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds;
|
this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds;
|
||||||
this.debounceTimer.Elapsed += (_, _) =>
|
this.debounceTimer.Elapsed += (_, _) =>
|
||||||
@@ -66,8 +69,31 @@ public partial class DebouncedTextField : MudComponentBase
|
|||||||
this.InvokeAsync(() => this.WhenTextCanged(this.text));
|
this.InvokeAsync(() => this.WhenTextCanged(this.text));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.isInitialized = true;
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override async Task OnParametersSetAsync()
|
||||||
|
{
|
||||||
|
// Ensure the timer uses the latest debouncing interval:
|
||||||
|
if (!this.isInitialized)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(Math.Abs(this.debounceTimer.Interval - this.DebounceTime.TotalMilliseconds) > 1)
|
||||||
|
this.debounceTimer.Interval = this.DebounceTime.TotalMilliseconds;
|
||||||
|
|
||||||
|
// Only sync when the parent's parameter actually changed since the last change:
|
||||||
|
if (this.Text != this.lastParameterText)
|
||||||
|
{
|
||||||
|
this.text = this.Text;
|
||||||
|
this.lastParameterText = this.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.debounceTimer.Stop();
|
||||||
|
this.debounceTimer.Start();
|
||||||
|
|
||||||
|
await base.OnParametersSetAsync();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -77,4 +103,21 @@ public partial class DebouncedTextField : MudComponentBase
|
|||||||
this.debounceTimer.Stop();
|
this.debounceTimer.Stop();
|
||||||
this.debounceTimer.Start();
|
this.debounceTimer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region IDisposable
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.debounceTimer.Stop();
|
||||||
|
this.debounceTimer.Dispose();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<MudExpansionPanel Class="border-solid border rounded-lg" Expanded="@this.IsExpanded">
|
<MudExpansionPanel Class="border-solid border rounded-lg" Expanded="@this.IsExpanded" MaxHeight="@this.MaxHeight" ExpandedChanged="async s => await this.ExpandedChanged(s)">
|
||||||
<TitleContent>
|
<TitleContent>
|
||||||
<div class="d-flex align-center">
|
<div class="d-flex align-center">
|
||||||
<MudIcon Icon="@this.HeaderIcon" Size="@this.IconSize" Color="@this.IconColor" class="mr-3"/>
|
<MudIcon Icon="@this.HeaderIcon" Size="@this.IconSize" Color="@this.IconColor" class="mr-3"/>
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ public partial class ExpansionPanel : ComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public string HeaderText { get; set; } = "n/a";
|
public string HeaderText { get; set; } = "n/a";
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public int? MaxHeight { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Func<bool, Task> ExpandedChanged { get; set; } = _ => Task.CompletedTask;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public RenderFragment? ChildContent { get; set; }
|
public RenderFragment? ChildContent { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
@inherits ConfigurationBaseCore
|
||||||
|
|
||||||
|
<MudButton Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@this.Icon" Disabled="@this.IsDisabled" OnClick="@(async () => await this.ClickAsync())">
|
||||||
|
@this.Text
|
||||||
|
</MudButton>
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public partial class LockableButton : ConfigurationBaseCore
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public string Icon { get; set; } = Icons.Material.Filled.Info;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Func<Task> OnClickAsync { get; set; } = () => Task.CompletedTask;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public Action OnClick { get; set; } = () => { };
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public string Class { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
#region Overrides of ConfigurationBase
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override bool Stretch => false;
|
||||||
|
|
||||||
|
protected override string GetClassForBase => this.Class;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private async Task ClickAsync()
|
||||||
|
{
|
||||||
|
if (this.IsLocked() || this.Disabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
await this.OnClickAsync();
|
||||||
|
this.OnClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,10 +13,6 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus
|
|||||||
[Inject]
|
[Inject]
|
||||||
protected MessageBus MessageBus { get; init; } = null!;
|
protected MessageBus MessageBus { get; init; } = null!;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
// ReSharper disable once UnusedAutoPropertyAccessor.Local
|
|
||||||
private ILogger<MSGComponentBase> Logger { get; init; } = null!;
|
|
||||||
|
|
||||||
private ILanguagePlugin Lang { get; set; } = PluginFactory.BaseLanguage;
|
private ILanguagePlugin Lang { get; set; } = PluginFactory.BaseLanguage;
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
@@ -45,19 +41,22 @@ public abstract class MSGComponentBase : ComponentBase, IDisposable, IMessageBus
|
|||||||
|
|
||||||
public async Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
public async Task ProcessMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data)
|
||||||
{
|
{
|
||||||
switch (triggeredEvent)
|
await this.InvokeAsync(async () =>
|
||||||
{
|
{
|
||||||
case Event.COLOR_THEME_CHANGED:
|
switch (triggeredEvent)
|
||||||
this.StateHasChanged();
|
{
|
||||||
break;
|
case Event.COLOR_THEME_CHANGED:
|
||||||
|
this.StateHasChanged();
|
||||||
|
break;
|
||||||
|
|
||||||
case Event.PLUGINS_RELOADED:
|
case Event.PLUGINS_RELOADED:
|
||||||
this.Lang = await this.SettingsManager.GetActiveLanguagePlugin();
|
this.Lang = await this.SettingsManager.GetActiveLanguagePlugin();
|
||||||
await this.InvokeAsync(this.StateHasChanged);
|
await this.InvokeAsync(this.StateHasChanged);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.ProcessIncomingMessage(sendingComponent, triggeredEvent, data);
|
await this.ProcessIncomingMessage(sendingComponent, triggeredEvent, data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TResult?> ProcessMessageWithResult<TPayload, TResult>(ComponentBase? sendingComponent, Event triggeredEvent, TPayload? data)
|
public async Task<TResult?> ProcessMessageWithResult<TPayload, TResult>(ComponentBase? sendingComponent, Event triggeredEvent, TPayload? data)
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
@inherits MSGComponentBase
|
||||||
|
|
||||||
|
<MudStack Row="false" Class="mb-3 pa-3 border-dashed border rounded-lg">
|
||||||
|
<MudJustifiedText Typo="Typo.body1">
|
||||||
|
@this.DetermineIntroText()
|
||||||
|
</MudJustifiedText>
|
||||||
|
<MudButton Color="@this.DetermineButtonColor()" Variant="Variant.Filled" OnClick="() => this.ShowPandocDialogAsync()">
|
||||||
|
@this.DetermineButtonText()
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
using AIStudio.Dialogs;
|
||||||
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
using DialogOptions = AIStudio.Dialogs.DialogOptions;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public partial class ManagePandocDependency : MSGComponentBase
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public string IntroText { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private IDialogService DialogService { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
|
private PandocInstallation pandocInstallation;
|
||||||
|
|
||||||
|
#region Overrides of MSGComponentBase
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
this.pandocInstallation = await Pandoc.CheckAvailabilityAsync(this.RustService, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Color DetermineButtonColor()
|
||||||
|
{
|
||||||
|
if (this.pandocInstallation == default)
|
||||||
|
return Color.Default;
|
||||||
|
|
||||||
|
switch (this.pandocInstallation)
|
||||||
|
{
|
||||||
|
case { CheckWasSuccessful: true, IsAvailable: true }:
|
||||||
|
return Color.Default;
|
||||||
|
|
||||||
|
case { CheckWasSuccessful: true, IsAvailable: false }:
|
||||||
|
return Color.Warning;
|
||||||
|
|
||||||
|
case { CheckWasSuccessful: false }:
|
||||||
|
return Color.Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string DetermineButtonText()
|
||||||
|
{
|
||||||
|
if(this.pandocInstallation == default)
|
||||||
|
return T("Please wait while we check the availability of Pandoc.");
|
||||||
|
|
||||||
|
switch (this.pandocInstallation)
|
||||||
|
{
|
||||||
|
case { CheckWasSuccessful: true, IsAvailable: true }:
|
||||||
|
return T("Check your Pandoc installation");
|
||||||
|
|
||||||
|
case { CheckWasSuccessful: true, IsAvailable: false }:
|
||||||
|
return T("Update Pandoc");
|
||||||
|
|
||||||
|
case { CheckWasSuccessful: false }:
|
||||||
|
return T("Install Pandoc");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string DetermineIntroText()
|
||||||
|
{
|
||||||
|
if (this.pandocInstallation == default)
|
||||||
|
return $"{this.IntroText} {T("Please wait while we check the availability of Pandoc.")}";
|
||||||
|
|
||||||
|
switch (this.pandocInstallation)
|
||||||
|
{
|
||||||
|
case { CheckWasSuccessful: true, IsAvailable: true }:
|
||||||
|
return $"{this.IntroText} {T("Your Pandoc installation meets the requirements.")}";
|
||||||
|
|
||||||
|
case { CheckWasSuccessful: true, IsAvailable: false }:
|
||||||
|
return $"{this.IntroText} {T("Your Pandoc installation is outdated. Please update it to the latest version to ensure compatibility with all features.")}";
|
||||||
|
|
||||||
|
case { CheckWasSuccessful: false }:
|
||||||
|
return $"{this.IntroText} {T("Pandoc is not installed or not available. Please install it to use the features that require Pandoc.")}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ShowPandocDialogAsync()
|
||||||
|
{
|
||||||
|
var dialogReference = await this.DialogService.ShowAsync<PandocDialog>(T("Pandoc Installation"), DialogOptions.FULLSCREEN);
|
||||||
|
await dialogReference.Result;
|
||||||
|
|
||||||
|
// Refresh the availability of Pandoc after the dialog is closed:
|
||||||
|
this.pandocInstallation = await Pandoc.CheckAvailabilityAsync(this.RustService, false);
|
||||||
|
|
||||||
|
await this.InvokeAsync(this.StateHasChanged);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<MudTooltip Text="@this.TooltipMessage" Placement="Placement.Bottom">
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.ContentCopy" Size="@this.Size" OnClick="@(() => this.HandleCopyClick())"/>
|
||||||
|
</MudTooltip>
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
using AIStudio.Chat;
|
||||||
|
using AIStudio.Tools.PluginSystem;
|
||||||
|
using AIStudio.Tools.Services;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public partial class MudCopyClipboardButton : ComponentBase
|
||||||
|
{
|
||||||
|
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(MudCopyClipboardButton).Namespace, nameof(MudCopyClipboardButton));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The string, if you want to copy a string.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public string StringContent { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The content, if you want to copy content.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public IContent? Content { get; init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The content type, if you want to copy Content.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public ContentType Type { get; init; } = ContentType.NONE;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The tooltip that should be shown to the user.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public string TooltipMessage { get; set; } = TB("Copies the content to the clipboard");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The size of the button. The default size is small.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter]
|
||||||
|
public Size Size { get; set; } = Size.Small;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private ISnackbar Snackbar { get; init; } = null!;
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
|
private async Task HandleCopyClick()
|
||||||
|
{
|
||||||
|
if (this.Type is ContentType.NONE)
|
||||||
|
await this.CopyToClipboard(this.StringContent);
|
||||||
|
else
|
||||||
|
await this.CopyToClipboard(this.Content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy this the string to the clipboard.
|
||||||
|
/// </summary>
|
||||||
|
private async Task CopyToClipboard(string textContent)
|
||||||
|
{
|
||||||
|
await this.RustService.CopyText2Clipboard(this.Snackbar, textContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy this block's content to the clipboard.
|
||||||
|
/// </summary>
|
||||||
|
private async Task CopyToClipboard(IContent? contentToCopy)
|
||||||
|
{
|
||||||
|
if (contentToCopy is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (this.Type)
|
||||||
|
{
|
||||||
|
case ContentType.TEXT:
|
||||||
|
var textContent = (ContentText) contentToCopy;
|
||||||
|
await this.RustService.CopyText2Clipboard(this.Snackbar, textContent.Text);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this.Snackbar.Add(TB("Cannot copy this content type to clipboard."), Severity.Error, config =>
|
||||||
|
{
|
||||||
|
config.Icon = Icons.Material.Filled.ContentCopy;
|
||||||
|
config.IconSize = Size.Large;
|
||||||
|
config.IconColor = Color.Error;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.Person4" />
|
<MudIconButton Size="Size.Small" Icon="@Icons.Material.Filled.Person4" />
|
||||||
}
|
}
|
||||||
</ActivatorContent>
|
</ActivatorContent>
|
||||||
<ChildContent>
|
<ChildContent>
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ public partial class ProviderSelection : MSGComponentBase
|
|||||||
{
|
{
|
||||||
[CascadingParameter]
|
[CascadingParameter]
|
||||||
public AssistantBase<NoComponent>? AssistantBase { get; set; }
|
public AssistantBase<NoComponent>? AssistantBase { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public AIStudio.Settings.Provider ProviderSettings { get; set; }
|
public AIStudio.Settings.Provider ProviderSettings { get; set; } = AIStudio.Settings.Provider.NONE;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<AIStudio.Settings.Provider> ProviderSettingsChanged { get; set; }
|
public EventCallback<AIStudio.Settings.Provider> ProviderSettingsChanged { get; set; }
|
||||||
@@ -32,7 +32,8 @@ public partial class ProviderSelection : MSGComponentBase
|
|||||||
{
|
{
|
||||||
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(this.AssistantBase?.Component ?? Tools.Components.NONE);
|
var minimumLevel = this.SettingsManager.GetMinimumConfidenceLevel(this.AssistantBase?.Component ?? Tools.Components.NONE);
|
||||||
foreach (var provider in this.SettingsManager.ConfigurationData.Providers)
|
foreach (var provider in this.SettingsManager.ConfigurationData.Providers)
|
||||||
if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
if (provider.UsedLLMProvider != LLMProviders.NONE)
|
||||||
yield return provider;
|
if (provider.UsedLLMProvider.GetConfidence(this.SettingsManager).Level >= minimumLevel)
|
||||||
|
yield return provider;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
@inherits MSGComponentBase
|
@inherits MSGComponentBase
|
||||||
<MudButton StartIcon="@Icons.Material.Filled.Description" OnClick="async () => await this.SelectFile()" Variant="Variant.Filled" Class="mb-3">
|
<MudButton StartIcon="@Icons.Material.Filled.Description" OnClick="async () => await this.SelectFile()" Variant="Variant.Filled" Class="mb-3">
|
||||||
@T("Use PDF content as input")
|
@T("Use file content as input")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using AIStudio.Tools.Rust;
|
||||||
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public partial class ReadFileContent : MSGComponentBase
|
||||||
|
{
|
||||||
|
[Parameter]
|
||||||
|
public string FileContent { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<string> FileContentChanged { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
private RustService RustService { get; init; } = null!;
|
||||||
|
|
||||||
|
private async Task SelectFile()
|
||||||
|
{
|
||||||
|
var selectedFile = await this.RustService.SelectFile(T("Select file to read its content"));
|
||||||
|
if (selectedFile.UserCancelled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!File.Exists(selectedFile.SelectedFilePath))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var ext = Path.GetExtension(selectedFile.SelectedFilePath).TrimStart('.');
|
||||||
|
if (Array.Exists(FileTypeFilter.Executables.FilterExtensions, x => x.Equals(ext, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.AppBlocking, T("Executables are not allowed")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.Exists(FileTypeFilter.AllImages.FilterExtensions, x => x.Equals(ext, StringComparison.OrdinalIgnoreCase)))
|
||||||
|
{
|
||||||
|
await MessageBus.INSTANCE.SendWarning(new(Icons.Material.Filled.ImageNotSupported, T("Images are not supported yet")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileContent = await this.RustService.ReadArbitraryFileData(selectedFile.SelectedFilePath, int.MaxValue);
|
||||||
|
await this.FileContentChanged.InvokeAsync(fileContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
using AIStudio.Tools.Rust;
|
|
||||||
using AIStudio.Tools.Services;
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
|
||||||
|
|
||||||
namespace AIStudio.Components;
|
|
||||||
|
|
||||||
public partial class ReadPDFContent : MSGComponentBase
|
|
||||||
{
|
|
||||||
[Parameter]
|
|
||||||
public string PDFContent { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public EventCallback<string> PDFContentChanged { get; set; }
|
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private RustService RustService { get; init; } = null!;
|
|
||||||
|
|
||||||
private async Task SelectFile()
|
|
||||||
{
|
|
||||||
var pdfFile = await this.RustService.SelectFile(T("Select PDF file"), FileTypeFilter.PDF);
|
|
||||||
if (pdfFile.UserCancelled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(!File.Exists(pdfFile.SelectedFilePath))
|
|
||||||
return;
|
|
||||||
|
|
||||||
var pdfText = await this.RustService.GetPDFText(pdfFile.SelectedFilePath);
|
|
||||||
await this.PDFContentChanged.InvokeAsync(pdfText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
@inherits MSGComponentBase
|
@inherits MSGComponentBase
|
||||||
<MudPaper Class="pa-3 mb-3 border-dashed border rounded-lg">
|
<MudPaper Class="pa-3 mb-3 border-dashed border rounded-lg">
|
||||||
<MudTextSwitch Label="@T("Read content from web?")" Disabled="@this.AgentIsRunning" @bind-Value="@this.showWebContentReader" LabelOn="@T("Show web content options")" LabelOff="@T("Hide web content options")" />
|
<MudTextSwitch Label="@T("Read content from web?")" Disabled="@this.AgentIsRunning" Value="@this.Preselect" ValueChanged="@this.ShowWebContentReaderChanged" LabelOn="@T("Show web content options")" LabelOff="@T("Hide web content options")" />
|
||||||
@if (this.showWebContentReader)
|
@if (this.Preselect)
|
||||||
{
|
{
|
||||||
<MudTextSwitch Label="@T("Cleanup content by using an LLM agent?")" @bind-Value="@this.useContentCleanerAgent" Validation="@this.ValidateProvider" Disabled="@this.AgentIsRunning" LabelOn="@T("The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.")" LabelOff="@T("No content cleaning")" />
|
<MudTextSwitch Label="@T("Cleanup content by using an LLM agent?")" Value="@this.PreselectContentCleanerAgent" ValueChanged="@this.UseContentCleanerAgentChanged" Validation="@this.ValidateProvider" Disabled="@this.AgentIsRunning" LabelOn="@T("The content is cleaned using an LLM agent: the main content is extracted, advertisements and other irrelevant things are attempted to be removed; relative links are attempted to be converted into absolute links so that they can be used.")" LabelOff="@T("No content cleaning")" />
|
||||||
<MudStack Row="@true" AlignItems="@AlignItems.Baseline" Class="mb-3">
|
<MudStack Row="@true" AlignItems="@AlignItems.Baseline" Class="mb-3">
|
||||||
<MudTextField T="string" Label="@T("URL from which to load the content")" @bind-Value="@this.providedURL" Validation="@this.ValidateURL" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Link" Placeholder="https://..." HelperText="@T("Loads the content from your URL. Does not work when the content is hidden behind a paywall.")" Variant="Variant.Outlined" Immediate="@true" Disabled="@this.AgentIsRunning"/>
|
<MudTextField T="string" Label="@T("URL from which to load the content")" @bind-Value="@this.providedURL" Validation="@this.ValidateURL" Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Link" Placeholder="https://..." HelperText="@T("Loads the content from your URL. Does not work when the content is hidden behind a paywall.")" Variant="Variant.Outlined" Immediate="@true" Disabled="@this.AgentIsRunning"/>
|
||||||
<MudButton Disabled="@(!this.IsReady || this.AgentIsRunning)" Variant="Variant.Filled" Size="Size.Large" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Download" OnClick="() => this.LoadFromWeb()">
|
<MudButton Disabled="@(!this.IsReady || this.AgentIsRunning)" Variant="Variant.Filled" Size="Size.Large" Color="Color.Primary" StartIcon="@Icons.Material.Filled.Download" OnClick="() => this.LoadFromWeb()">
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public partial class ReadWebContent : MSGComponentBase
|
|||||||
public EventCallback<string> ContentChanged { get; set; }
|
public EventCallback<string> ContentChanged { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public AIStudio.Settings.Provider ProviderSettings { get; set; }
|
public AIStudio.Settings.Provider ProviderSettings { get; set; } = AIStudio.Settings.Provider.NONE;
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public bool AgentIsRunning { get; set; }
|
public bool AgentIsRunning { get; set; }
|
||||||
@@ -31,31 +31,32 @@ public partial class ReadWebContent : MSGComponentBase
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public bool Preselect { get; set; }
|
public bool Preselect { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<bool> PreselectChanged { get; set; }
|
||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public bool PreselectContentCleanerAgent { get; set; }
|
public bool PreselectContentCleanerAgent { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventCallback<bool> PreselectContentCleanerAgentChanged { get; set; }
|
||||||
|
|
||||||
private Process<ReadWebContentSteps> process = Process<ReadWebContentSteps>.INSTANCE;
|
private readonly Process<ReadWebContentSteps> process = Process<ReadWebContentSteps>.INSTANCE;
|
||||||
private ProcessStepValue processStep;
|
private ProcessStepValue processStep;
|
||||||
|
|
||||||
private bool showWebContentReader;
|
|
||||||
private bool useContentCleanerAgent;
|
|
||||||
private string providedURL = string.Empty;
|
private string providedURL = string.Empty;
|
||||||
private bool urlIsValid;
|
private bool urlIsValid;
|
||||||
private bool isProviderValid;
|
private bool isProviderValid;
|
||||||
|
|
||||||
private AIStudio.Settings.Provider providerSettings;
|
private AIStudio.Settings.Provider providerSettings = AIStudio.Settings.Provider.NONE;
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
if(this.Preselect)
|
|
||||||
this.showWebContentReader = true;
|
|
||||||
|
|
||||||
if(this.PreselectContentCleanerAgent)
|
|
||||||
this.useContentCleanerAgent = true;
|
|
||||||
|
|
||||||
this.ProviderSettings = this.SettingsManager.GetPreselectedProvider(Tools.Components.AGENT_TEXT_CONTENT_CLEANER, this.ProviderSettings.Id, true);
|
this.ProviderSettings = this.SettingsManager.GetPreselectedProvider(Tools.Components.AGENT_TEXT_CONTENT_CLEANER, this.ProviderSettings.Id, true);
|
||||||
|
this.providerSettings = this.ProviderSettings;
|
||||||
|
this.ValidateProvider(this.PreselectContentCleanerAgent);
|
||||||
|
|
||||||
await base.OnInitializedAsync();
|
await base.OnInitializedAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ public partial class ReadWebContent : MSGComponentBase
|
|||||||
if (!this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)
|
if (!this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)
|
||||||
this.providerSettings = this.ProviderSettings;
|
this.providerSettings = this.ProviderSettings;
|
||||||
|
|
||||||
|
this.ValidateProvider(this.PreselectContentCleanerAgent);
|
||||||
await base.OnParametersSetAsync();
|
await base.OnParametersSetAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +88,7 @@ public partial class ReadWebContent : MSGComponentBase
|
|||||||
this.StateHasChanged();
|
this.StateHasChanged();
|
||||||
markdown = this.HTMLParser.ParseToMarkdown(html);
|
markdown = this.HTMLParser.ParseToMarkdown(html);
|
||||||
|
|
||||||
if (this.useContentCleanerAgent)
|
if (this.PreselectContentCleanerAgent && this.providerSettings != AIStudio.Settings.Provider.NONE)
|
||||||
{
|
{
|
||||||
this.AgentTextContentCleaner.ProviderSettings = this.providerSettings;
|
this.AgentTextContentCleaner.ProviderSettings = this.providerSettings;
|
||||||
var additionalData = new Dictionary<string, string>
|
var additionalData = new Dictionary<string, string>
|
||||||
@@ -140,16 +142,26 @@ public partial class ReadWebContent : MSGComponentBase
|
|||||||
if(!this.urlIsValid)
|
if(!this.urlIsValid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(this.useContentCleanerAgent && !this.isProviderValid)
|
if(this.PreselectContentCleanerAgent && !this.isProviderValid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task ShowWebContentReaderChanged(bool state)
|
||||||
|
{
|
||||||
|
await this.PreselectChanged.InvokeAsync(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UseContentCleanerAgentChanged(bool state)
|
||||||
|
{
|
||||||
|
await this.PreselectContentCleanerAgentChanged.InvokeAsync(state);
|
||||||
|
}
|
||||||
|
|
||||||
private string? ValidateProvider(bool shouldUseAgent)
|
private string? ValidateProvider(bool shouldUseAgent)
|
||||||
{
|
{
|
||||||
if(shouldUseAgent && this.providerSettings == default)
|
if(shouldUseAgent && this.providerSettings == AIStudio.Settings.Provider.NONE)
|
||||||
{
|
{
|
||||||
this.isProviderValid = false;
|
this.isProviderValid = false;
|
||||||
return T("Please select a provider to use the cleanup agent.");
|
return T("Please select a provider to use the cleanup agent.");
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using AIStudio.Tools.PluginSystem;
|
||||||
|
|
||||||
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
|
public static class ReadWebContentStepsExtensions
|
||||||
|
{
|
||||||
|
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ReadWebContentStepsExtensions).Namespace, nameof(ReadWebContentStepsExtensions));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the text representation of a given ReadWebContentSteps enum value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="step">The ReadWebContentSteps enum value.</param>
|
||||||
|
/// <returns>>The text representation of the process step.</returns>
|
||||||
|
public static string GetText(this ReadWebContentSteps step) => step switch
|
||||||
|
{
|
||||||
|
ReadWebContentSteps.START => TB("Start"),
|
||||||
|
ReadWebContentSteps.LOADING => TB("Loading"),
|
||||||
|
ReadWebContentSteps.PARSING => TB("Parsing"),
|
||||||
|
ReadWebContentSteps.CLEANING => TB("Cleaning"),
|
||||||
|
ReadWebContentSteps.DONE => TB("Done"),
|
||||||
|
|
||||||
|
_ => TB("n/a")
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@inherits MSGComponentBase
|
||||||
|
|
||||||
<MudStack Row="@true" Spacing="3" Class="mb-3" StretchItems="StretchItems.None" AlignItems="AlignItems.Center">
|
<MudStack Row="@true" Spacing="3" Class="mb-3" StretchItems="StretchItems.None" AlignItems="AlignItems.Center">
|
||||||
<MudTextField
|
<MudTextField
|
||||||
T="string"
|
T="string"
|
||||||
@@ -12,6 +14,6 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<MudButton StartIcon="@Icons.Material.Filled.FolderOpen" Variant="Variant.Outlined" Color="Color.Primary" Disabled="this.Disabled" OnClick="@this.OpenDirectoryDialog">
|
<MudButton StartIcon="@Icons.Material.Filled.FolderOpen" Variant="Variant.Outlined" Color="Color.Primary" Disabled="this.Disabled" OnClick="@this.OpenDirectoryDialog">
|
||||||
Choose Directory
|
@T("Choose Directory")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
using AIStudio.Settings;
|
|
||||||
using AIStudio.Tools.Services;
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
namespace AIStudio.Components;
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
public partial class SelectDirectory : ComponentBase
|
public partial class SelectDirectory : MSGComponentBase
|
||||||
{
|
{
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string Directory { get; set; } = string.Empty;
|
public string Directory { get; set; } = string.Empty;
|
||||||
@@ -24,9 +23,6 @@ public partial class SelectDirectory : ComponentBase
|
|||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<string, string?> Validation { get; set; } = _ => null;
|
public Func<string, string?> Validation { get; set; } = _ => null;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private SettingsManager SettingsManager { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
public RustService RustService { get; set; } = null!;
|
public RustService RustService { get; set; } = null!;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@inherits MSGComponentBase
|
||||||
|
|
||||||
<MudStack Row="@true" Spacing="3" Class="mb-3" StretchItems="StretchItems.None" AlignItems="AlignItems.Center">
|
<MudStack Row="@true" Spacing="3" Class="mb-3" StretchItems="StretchItems.None" AlignItems="AlignItems.Center">
|
||||||
<MudTextField
|
<MudTextField
|
||||||
T="string"
|
T="string"
|
||||||
@@ -12,6 +14,6 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<MudButton StartIcon="@Icons.Material.Filled.FolderOpen" Variant="Variant.Outlined" Color="Color.Primary" Disabled="this.Disabled" OnClick="@this.OpenFileDialog">
|
<MudButton StartIcon="@Icons.Material.Filled.FolderOpen" Variant="Variant.Outlined" Color="Color.Primary" Disabled="this.Disabled" OnClick="@this.OpenFileDialog">
|
||||||
Choose File
|
@T("Choose File")
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
using AIStudio.Settings;
|
|
||||||
using AIStudio.Tools.Rust;
|
using AIStudio.Tools.Rust;
|
||||||
using AIStudio.Tools.Services;
|
using AIStudio.Tools.Services;
|
||||||
|
|
||||||
@@ -6,7 +5,7 @@ using Microsoft.AspNetCore.Components;
|
|||||||
|
|
||||||
namespace AIStudio.Components;
|
namespace AIStudio.Components;
|
||||||
|
|
||||||
public partial class SelectFile : ComponentBase
|
public partial class SelectFile : MSGComponentBase
|
||||||
{
|
{
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public string File { get; set; } = string.Empty;
|
public string File { get; set; } = string.Empty;
|
||||||
@@ -28,9 +27,6 @@ public partial class SelectFile : ComponentBase
|
|||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public Func<string, string?> Validation { get; set; } = _ => null;
|
public Func<string, string?> Validation { get; set; } = _ => null;
|
||||||
|
|
||||||
[Inject]
|
|
||||||
private SettingsManager SettingsManager { get; init; } = null!;
|
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
public RustService RustService { get; set; } = null!;
|
public RustService RustService { get; set; } = null!;
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
@inherits SettingsPanelBase
|
@inherits SettingsPanelBase
|
||||||
|
|
||||||
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.TextFields" HeaderText="Agent: Text Content Cleaner Options">
|
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.TextFields" HeaderText="@T("Agent: Text Content Cleaner Options")">
|
||||||
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
<MudText Typo="Typo.body1" Class="mb-3">
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things,
|
@T("Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used.")
|
||||||
and attempts to convert relative links into absolute links so that they can be used.
|
|
||||||
</MudText>
|
</MudText>
|
||||||
<ConfigurationOption OptionDescription="Preselect text content cleaner options?" LabelOn="Options are preselected" LabelOff="No options are preselected" State="@(() => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions = updatedState)" OptionHelp="When enabled, you can preselect some agent options. This is might be useful when you prefer an LLM."/>
|
<ConfigurationOption OptionDescription="@T("Preselect text content cleaner options?")" LabelOn="@T("Options are preselected")" LabelOff="@T("No options are preselected")" State="@(() => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions = updatedState)" OptionHelp="@T("When enabled, you can preselect some agent options. This is might be useful when you prefer an LLM.")"/>
|
||||||
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider = selectedValue)"/>
|
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.TextContentCleaner.PreselectedAgentProvider = selectedValue)"/>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
</ExpansionPanel>
|
</ExpansionPanel>
|
||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
@inherits SettingsPanelBase
|
@inherits SettingsPanelBase
|
||||||
|
|
||||||
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.SelectAll" HeaderText="Agent: Data Source Selection Options">
|
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.SelectAll" HeaderText="@T("Agent: Data Source Selection Options")">
|
||||||
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
<MudText Typo="Typo.body1" Class="mb-3">
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
Use Case: this agent is used to select the appropriate data sources for the current prompt.
|
@T("Use Case: this agent is used to select the appropriate data sources for the current prompt.")
|
||||||
</MudText>
|
</MudText>
|
||||||
<ConfigurationOption OptionDescription="Preselect data source selection options?" LabelOn="Options are preselected" LabelOff="No options are preselected" State="@(() => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions = updatedState)" OptionHelp="When enabled, you can preselect some agent options. This is might be useful when you prefer an LLM."/>
|
<ConfigurationOption OptionDescription="@T("Preselect data source selection options?")" LabelOn="@T("Options are preselected")" LabelOff="@T("No options are preselected")" State="@(() => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions = updatedState)" OptionHelp="@T("When enabled, you can preselect some agent options. This is might be useful when you prefer an LLM.")"/>
|
||||||
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectedAgentProvider = selectedValue)"/>
|
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AgentDataSourceSelection.PreselectedAgentProvider = selectedValue)"/>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
</ExpansionPanel>
|
</ExpansionPanel>
|
||||||
+5
-7
@@ -1,17 +1,15 @@
|
|||||||
@inherits SettingsPanelBase
|
@inherits SettingsPanelBase
|
||||||
|
|
||||||
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Assessment" HeaderText="Agent: Retrieval Context Validation Options">
|
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Assessment" HeaderText="@T("Agent: Retrieval Context Validation Options")">
|
||||||
<MudText Typo="Typo.body1" Class="mb-3">
|
<MudText Typo="Typo.body1" Class="mb-3">
|
||||||
Use Case: this agent is used to validate any retrieval context of any retrieval process. Perhaps there are many of these
|
@T("Use Case: this agent is used to validate any retrieval context of any retrieval process. Perhaps there are many of these retrieval contexts and you want to validate them all. Therefore, you might want to use a cheap and fast LLM for this job. When using a local or self-hosted LLM, look for a small (e.g. 3B) and fast model.")
|
||||||
retrieval contexts and you want to validate them all. Therefore, you might want to use a cheap and fast LLM for this
|
|
||||||
job. When using a local or self-hosted LLM, look for a small (e.g. 3B) and fast model.
|
|
||||||
</MudText>
|
</MudText>
|
||||||
<ConfigurationOption OptionDescription="Enable the retrieval context validation agent?" LabelOn="The validation agent is enabled" LabelOff="No validation is performed" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation = updatedState)" OptionHelp="When enabled, the retrieval context validation agent will check each retrieval context of any retrieval process, whether a context makes sense for the given prompt."/>
|
<ConfigurationOption OptionDescription="@T("Enable the retrieval context validation agent?")" LabelOn="@T("The validation agent is enabled")" LabelOff="@T("No validation is performed")" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation = updatedState)" OptionHelp="@T("When enabled, the retrieval context validation agent will check each retrieval context of any retrieval process, whether a context makes sense for the given prompt.")"/>
|
||||||
@if (this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)
|
@if (this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)
|
||||||
{
|
{
|
||||||
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
|
||||||
<ConfigurationOption OptionDescription="Preselect retrieval context validation options?" LabelOn="Options are preselected" LabelOff="No options are preselected" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions = updatedState)" OptionHelp="When enabled, you can preselect some agent options. This is might be useful when you prefer an LLM."/>
|
<ConfigurationOption OptionDescription="@T("Preselect retrieval context validation options?")" LabelOn="@T("Options are preselected")" LabelOff="@T("No options are preselected")" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions = updatedState)" OptionHelp="@T("When enabled, you can preselect some agent options. This is might be useful when you prefer an LLM.")"/>
|
||||||
<ConfigurationSlider T="int" OptionDescription="How many validation agents should work simultaneously?" Min="1" Max="100" Step="1" Unit="agents" Value="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.NumParallelValidations)" ValueUpdate="@(updatedValue => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.NumParallelValidations = updatedValue)" OptionHelp="More active agents also mean that a corresponding number of requests are made simultaneously. Some providers limit the number of requests per minute. When you are unsure, choose a low setting between 1 to 6 agents."/>
|
<ConfigurationSlider T="int" OptionDescription="@T("How many validation agents should work simultaneously?")" Min="1" Max="100" Step="1" Unit="@T("agents")" Value="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.NumParallelValidations)" ValueUpdate="@(updatedValue => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.NumParallelValidations = updatedValue)" OptionHelp="@T("More active agents also mean that a corresponding number of requests are made simultaneously. Some providers limit the number of requests per minute. When you are unsure, choose a low setting between 1 to 6 agents.")"/>
|
||||||
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider = selectedValue)"/>
|
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider = selectedValue)"/>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
}
|
}
|
||||||
|
|||||||
Loaded 100 of 336 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user