mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 16:49:06 +00:00
Fixed the bug where the user input was not cleared in the chat (#134)
This commit is contained in:
parent
a5bdb3267b
commit
54588fc92d
@ -47,9 +47,8 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
|||||||
private bool mustScrollToBottomAfterRender;
|
private bool mustScrollToBottomAfterRender;
|
||||||
private byte scrollRenderCountdown;
|
private byte scrollRenderCountdown;
|
||||||
|
|
||||||
// Unfortunately, we need the input field reference to clear it after sending a message.
|
// Unfortunately, we need the input field reference to blur the focus away. Without
|
||||||
// This is necessary because we have to handle the key events ourselves. Otherwise,
|
// this, we cannot clear the input field.
|
||||||
// the clearing would be done automatically.
|
|
||||||
private MudTextField<string> inputField = null!;
|
private MudTextField<string> inputField = null!;
|
||||||
|
|
||||||
#region Overrides of ComponentBase
|
#region Overrides of ComponentBase
|
||||||
@ -142,6 +141,10 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
|||||||
if (!this.IsProviderSelected)
|
if (!this.IsProviderSelected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// We need to blur the focus away from the input field
|
||||||
|
// to be able to clear the field:
|
||||||
|
await this.inputField.BlurAsync();
|
||||||
|
|
||||||
// Create a new chat thread if necessary:
|
// Create a new chat thread if necessary:
|
||||||
var threadName = this.ExtractThreadName(this.userInput);
|
var threadName = this.ExtractThreadName(this.userInput);
|
||||||
|
|
||||||
@ -210,7 +213,6 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Clear the input field:
|
// Clear the input field:
|
||||||
await this.inputField.Clear();
|
|
||||||
this.userInput = string.Empty;
|
this.userInput = string.Empty;
|
||||||
|
|
||||||
// Enable the stream state for the chat component:
|
// Enable the stream state for the chat component:
|
||||||
@ -358,7 +360,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.inputField.Clear();
|
this.userInput = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task MoveChatToWorkspace()
|
private async Task MoveChatToWorkspace()
|
||||||
@ -428,7 +430,7 @@ public partial class Chat : MSGComponentBase, IAsyncDisposable
|
|||||||
this.currentWorkspaceId = this.chatThread?.WorkspaceId ?? Guid.Empty;
|
this.currentWorkspaceId = this.chatThread?.WorkspaceId ?? Guid.Empty;
|
||||||
this.currentWorkspaceName = this.chatThread is null ? string.Empty : await this.workspaces.LoadWorkspaceName(this.chatThread.WorkspaceId);
|
this.currentWorkspaceName = this.chatThread is null ? string.Empty : await this.workspaces.LoadWorkspaceName(this.chatThread.WorkspaceId);
|
||||||
|
|
||||||
await this.inputField.Clear();
|
this.userInput = string.Empty;
|
||||||
if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)
|
if (this.SettingsManager.ConfigurationData.Chat.ShowLatestMessageAfterLoading)
|
||||||
{
|
{
|
||||||
this.mustScrollToBottomAfterRender = true;
|
this.mustScrollToBottomAfterRender = true;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
- Added the possibility to preselect any of your profiles as the default profile for the entire app or configure individual profiles for assistants and chats.
|
- Added the possibility to preselect any of your profiles as the default profile for the entire app or configure individual profiles for assistants and chats.
|
||||||
- Added an introductory description to the provider settings.
|
- Added an introductory description to the provider settings.
|
||||||
- Added an indicator for the current and maximal length of the provider instance name.
|
- Added an indicator for the current and maximal length of the provider instance name.
|
||||||
|
- Fixed the annoying bug that input made in the chat interface was not cleared when sending the message using hotkeys.
|
||||||
- Fixed the bug that the model name for Fireworks was not loaded when editing the provider settings.
|
- Fixed the bug that the model name for Fireworks was not loaded when editing the provider settings.
|
||||||
- Fixed a bug where it was possible that the chat interface was not scrolling to the bottom when new messages were added.
|
- Fixed a bug where it was possible that the chat interface was not scrolling to the bottom when new messages were added.
|
||||||
- Improved hyphenation for continuous text so that the rules of the respective language are taken into account where possible.
|
- Improved hyphenation for continuous text so that the rules of the respective language are taken into account where possible.
|
||||||
|
Loading…
Reference in New Issue
Block a user