mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-13 12:07:21 +00:00
Changed all icons of AI Studio to Lucide (#1187)
This commit is contained in:
1 parent
9a676101f7
commit
7ef26cd5c8
352 files changed
+6261
-1620
No files matched your search
@@ -152,7 +152,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
}
|
||||
|
||||
protected Task SendTimeoutError(string action) => MessageBus.INSTANCE.SendError(new(
|
||||
Icons.Material.Filled.HourglassTop,
|
||||
AppIcons.TIMEOUT,
|
||||
string.Format(
|
||||
TB("The request to the LLM provider '{0}' (type={1}) timed out after {2} while {3}. Please try again or check whether the provider is still responding."),
|
||||
this.InstanceName,
|
||||
@@ -774,7 +774,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
|
||||
if (nextResponse.StatusCode is HttpStatusCode.Forbidden)
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Block, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). You might not be able to use this provider from your location. The provider message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.BLOCKED, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). You might not be able to use this provider from your location. The provider message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
|
||||
errorMessage = nextResponse.ReasonPhrase;
|
||||
failureAlreadyExplained = true;
|
||||
@@ -799,7 +799,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
if (string.IsNullOrWhiteSpace(tooLargeMessage))
|
||||
tooLargeMessage = nextResponse.ReasonPhrase;
|
||||
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, this.GetContextTooLargeUserMessage(tooLargeMessage)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.PROVIDER_ERROR, this.GetContextTooLargeUserMessage(tooLargeMessage)));
|
||||
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
|
||||
errorMessage = nextResponse.ReasonPhrase;
|
||||
failureAlreadyExplained = true;
|
||||
@@ -824,7 +824,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
var classifiedMessage = this.GetProviderRequestFailureUserMessage(providerRequestFailure);
|
||||
if(!string.IsNullOrWhiteSpace(classifiedMessage))
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, classifiedMessage));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.PROVIDER_ERROR, classifiedMessage));
|
||||
}
|
||||
|
||||
// Check if the error body contains "context" and "token" (case-insensitive),
|
||||
@@ -832,11 +832,11 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
else if(errorBody.Contains("context", StringComparison.InvariantCultureIgnoreCase) &&
|
||||
errorBody.Contains("token", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, this.GetContextTooLargeUserMessage(badRequestMessage)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.PROVIDER_ERROR, this.GetContextTooLargeUserMessage(badRequestMessage)));
|
||||
}
|
||||
else
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The required message format might be changed. The provider message is: '{2}'"), this.InstanceName, this.Provider, badRequestMessage)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.PROVIDER_ERROR, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The required message format might be changed. The provider message is: '{2}'"), this.InstanceName, this.Provider, badRequestMessage)));
|
||||
}
|
||||
|
||||
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
|
||||
@@ -847,7 +847,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
|
||||
if(nextResponse.StatusCode is HttpStatusCode.NotFound)
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.PROVIDER_ERROR, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). Something was not found. The provider message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
|
||||
errorMessage = nextResponse.ReasonPhrase;
|
||||
failureAlreadyExplained = true;
|
||||
@@ -856,7 +856,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
|
||||
if(nextResponse.StatusCode is HttpStatusCode.Unauthorized)
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Key, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The API key might be invalid. The provider message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.KEY, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The API key might be invalid. The provider message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
|
||||
errorMessage = nextResponse.ReasonPhrase;
|
||||
failureAlreadyExplained = true;
|
||||
@@ -865,7 +865,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
|
||||
if(nextResponse.StatusCode is HttpStatusCode.InternalServerError)
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The server might be down or having issues. The provider message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.PROVIDER_ERROR, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The server might be down or having issues. The provider message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
|
||||
errorMessage = nextResponse.ReasonPhrase;
|
||||
failureAlreadyExplained = true;
|
||||
@@ -874,7 +874,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
|
||||
if(nextResponse.StatusCode is HttpStatusCode.ServiceUnavailable)
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The provider is overloaded. The message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.PROVIDER_ERROR, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The provider is overloaded. The message is: '{2}'"), this.InstanceName, this.Provider, nextResponse.ReasonPhrase)));
|
||||
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
|
||||
errorMessage = nextResponse.ReasonPhrase;
|
||||
failureAlreadyExplained = true;
|
||||
@@ -899,7 +899,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
if (string.IsNullOrWhiteSpace(refusalMessage))
|
||||
refusalMessage = nextResponse.ReasonPhrase;
|
||||
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.CloudOff, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The provider turned the request down with the status code {2} and would turn it down again, so we stopped trying. The provider message is: '{3}'"), this.InstanceName, this.Provider, (int)nextResponse.StatusCode, refusalMessage)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.PROVIDER_ERROR, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). The provider turned the request down with the status code {2} and would turn it down again, so we stopped trying. The provider message is: '{3}'"), this.InstanceName, this.Provider, (int)nextResponse.StatusCode, refusalMessage)));
|
||||
this.logger.LogError("Failed request with status code {ResponseStatusCode} (message = '{ResponseReasonPhrase}', error body = '{ErrorBody}').", nextResponse.StatusCode, nextResponse.ReasonPhrase, errorBody);
|
||||
errorMessage = nextResponse.ReasonPhrase;
|
||||
failureAlreadyExplained = true;
|
||||
@@ -940,7 +940,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
// which explains nothing is the one arriving last.
|
||||
//
|
||||
if(!failureAlreadyExplained)
|
||||
await MessageBus.INSTANCE.SendError(new DataErrorMessage(Icons.Material.Filled.CloudOff, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). Even after {2} retries, there were some problems with the request. The provider message is: '{3}'."), this.InstanceName, this.Provider, MAX_RETRIES, errorMessage)));
|
||||
await MessageBus.INSTANCE.SendError(new DataErrorMessage(AppIcons.PROVIDER_ERROR, string.Format(TB("We tried to communicate with the LLM provider '{0}' (type={1}). Even after {2} retries, there were some problems with the request. The provider message is: '{3}'."), this.InstanceName, this.Provider, MAX_RETRIES, errorMessage)));
|
||||
|
||||
return new HttpRateLimitedStreamResult(false, true, errorMessage ?? $"Failed after {MAX_RETRIES} retries; no provider message available", response);
|
||||
}
|
||||
@@ -999,7 +999,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
}
|
||||
else
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Stream, string.Format(TB("Tried to communicate with the LLM provider '{0}'. There were some problems with the request. The provider message is: '{1}'"), this.InstanceName, e.Message)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.ANSWER_STREAM, string.Format(TB("Tried to communicate with the LLM provider '{0}'. There were some problems with the request. The provider message is: '{1}'"), this.InstanceName, e.Message)));
|
||||
this.logger.LogError(e, "Failed to stream the {OperationName} from {ProviderName} '{ProviderInstanceName}': {ErrorMessage}", operationName, providerName, this.InstanceName, e.Message);
|
||||
}
|
||||
}
|
||||
@@ -1044,7 +1044,7 @@ public abstract class BaseProvider : IProvider, ISecretId
|
||||
}
|
||||
else
|
||||
{
|
||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Stream, string.Format(TB("Tried to stream the LLM provider '{0}' answer. Was not able to read the stream. The message is: '{1}'"), this.InstanceName, e.Message)));
|
||||
await MessageBus.INSTANCE.SendError(new(AppIcons.ANSWER_STREAM, string.Format(TB("Tried to stream the LLM provider '{0}' answer. Was not able to read the stream. The message is: '{1}'"), this.InstanceName, e.Message)));
|
||||
this.logger.LogError(e, "Failed to read the stream from {ProviderName} '{ProviderInstanceName}': {ErrorMessage}", providerName, this.InstanceName, e.Message);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,14 @@ public static class ConfidenceLevelExtensions
|
||||
_ => TB("Unknown confidence level"),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The color of the level for icons, text, and borders on the background of the app.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// In dark mode, these are light tones: the dark ones of <see cref="GetBackgroundColor"/> almost vanish on the
|
||||
/// dark background, especially as the thin strokes of a Lucide icon.
|
||||
/// </remarks>
|
||||
/// <param name="settingsManager">The settings manager, which knows whether the app shows its dark mode.</param>
|
||||
public string GetColor(SettingsManager settingsManager) => (level, settingsManager.IsDarkMode) switch
|
||||
{
|
||||
(ConfidenceLevel.NONE, false) => "#cccccc",
|
||||
@@ -33,27 +41,49 @@ public static class ConfidenceLevelExtensions
|
||||
(ConfidenceLevel.UNKNOWN, true) => "#aaaaaa",
|
||||
|
||||
(ConfidenceLevel.UNTRUSTED, false) => "#ff0000",
|
||||
(ConfidenceLevel.UNTRUSTED, true) => "#800000",
|
||||
(ConfidenceLevel.UNTRUSTED, true) => "#fe7c75",
|
||||
|
||||
(ConfidenceLevel.VERY_LOW, false) => "#ff6600",
|
||||
(ConfidenceLevel.VERY_LOW, true) => "#803300",
|
||||
(ConfidenceLevel.VERY_LOW, true) => "#f58b4b",
|
||||
|
||||
(ConfidenceLevel.LOW, false) => "#ffcc00",
|
||||
(ConfidenceLevel.LOW, true) => "#806600",
|
||||
(ConfidenceLevel.LOW, true) => "#e3b842",
|
||||
|
||||
(ConfidenceLevel.MODERATE, false) => "#99cc00",
|
||||
(ConfidenceLevel.MODERATE, true) => "#4d6600",
|
||||
(ConfidenceLevel.MODERATE, true) => "#afc84e",
|
||||
|
||||
(ConfidenceLevel.MEDIUM, false) => "#86b300",
|
||||
(ConfidenceLevel.MEDIUM, true) => "#394d00",
|
||||
(ConfidenceLevel.MEDIUM, true) => "#8bc55c",
|
||||
|
||||
(ConfidenceLevel.HIGH, false) => "#009933",
|
||||
(ConfidenceLevel.HIGH, true) => "#004d1a",
|
||||
(ConfidenceLevel.HIGH, true) => "#5ac576",
|
||||
|
||||
(_, false) => "#cc6600",
|
||||
(_, true) => "#663300",
|
||||
(_, true) => "#db9152",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The color of the level as the background of white text, such as the levels in the confidence scheme.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// In light mode, this is the color of <see cref="GetColor"/>. In dark mode, these are dark tones, so the white
|
||||
/// text on them stays readable.
|
||||
/// </remarks>
|
||||
/// <param name="settingsManager">The settings manager, which knows whether the app shows its dark mode.</param>
|
||||
public string GetBackgroundColor(SettingsManager settingsManager) => settingsManager.IsDarkMode ? level switch
|
||||
{
|
||||
ConfidenceLevel.NONE => "#666666",
|
||||
ConfidenceLevel.UNKNOWN => "#555555",
|
||||
ConfidenceLevel.UNTRUSTED => "#800000",
|
||||
ConfidenceLevel.VERY_LOW => "#803300",
|
||||
ConfidenceLevel.LOW => "#806600",
|
||||
ConfidenceLevel.MODERATE => "#4d6600",
|
||||
ConfidenceLevel.MEDIUM => "#394d00",
|
||||
ConfidenceLevel.HIGH => "#004d1a",
|
||||
|
||||
_ => "#663300",
|
||||
} : level.GetColor(settingsManager);
|
||||
|
||||
public string SetColorStyle(SettingsManager settingsManager) => $"--confidence-color: {level.GetColor(settingsManager)};";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user