mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-05-21 20:52:14 +00:00
Changed SendToButton to support sending to chat as input
This commit is contained in:
parent
1f071211f3
commit
5f686bf1c1
@ -372,9 +372,14 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
|
|||||||
switch (destination)
|
switch (destination)
|
||||||
{
|
{
|
||||||
case Tools.Components.CHAT:
|
case Tools.Components.CHAT:
|
||||||
var convertedChatThread = this.ConvertToChatThread;
|
if (sendToButton.SendToChatAsInput)
|
||||||
convertedChatThread = convertedChatThread with { SelectedProvider = this.providerSettings.Id };
|
MessageBus.INSTANCE.DeferMessage(this, Event.SEND_TO_CHAT_INPUT, contentToSend);
|
||||||
MessageBus.INSTANCE.DeferMessage(this, sendToData.Event, convertedChatThread);
|
else
|
||||||
|
{
|
||||||
|
var convertedChatThread = this.ConvertToChatThread;
|
||||||
|
convertedChatThread = convertedChatThread with { SelectedProvider = this.providerSettings.Id };
|
||||||
|
MessageBus.INSTANCE.DeferMessage(this, sendToData.Event, convertedChatThread);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -100,6 +100,7 @@ public partial class AssistantPromptOptimizer : AssistantBaseCore<SettingsDialog
|
|||||||
{
|
{
|
||||||
Self = Tools.Components.PROMPT_OPTIMIZER_ASSISTANT,
|
Self = Tools.Components.PROMPT_OPTIMIZER_ASSISTANT,
|
||||||
UseResultingContentBlockData = false,
|
UseResultingContentBlockData = false,
|
||||||
|
SendToChatAsInput = true,
|
||||||
GetText = () => string.IsNullOrWhiteSpace(this.optimizedPrompt) ? this.inputPrompt : this.optimizedPrompt,
|
GetText = () => string.IsNullOrWhiteSpace(this.optimizedPrompt) ? this.inputPrompt : this.optimizedPrompt,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@ -92,6 +92,10 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable
|
|||||||
this.currentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(Tools.Components.CHAT);
|
this.currentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(Tools.Components.CHAT);
|
||||||
this.userInput = this.currentChatTemplate.PredefinedUserPrompt;
|
this.userInput = this.currentChatTemplate.PredefinedUserPrompt;
|
||||||
|
|
||||||
|
var deferredInput = MessageBus.INSTANCE.CheckDeferredMessages<string>(Event.SEND_TO_CHAT_INPUT).FirstOrDefault();
|
||||||
|
if (!string.IsNullOrWhiteSpace(deferredInput))
|
||||||
|
this.userInput = deferredInput;
|
||||||
|
|
||||||
// Apply template's file attachments, if any:
|
// Apply template's file attachments, if any:
|
||||||
foreach (var attachment in this.currentChatTemplate.FileAttachments)
|
foreach (var attachment in this.currentChatTemplate.FileAttachments)
|
||||||
this.chatDocumentPaths.Add(attachment);
|
this.chatDocumentPaths.Add(attachment);
|
||||||
|
|||||||
@ -44,6 +44,7 @@
|
|||||||
<EmbeddedResource Include="wwwroot\**" CopyToOutputDirectory="PreserveNewest" />
|
<EmbeddedResource Include="wwwroot\**" CopyToOutputDirectory="PreserveNewest" />
|
||||||
<EmbeddedResource Include="Plugins\**" CopyToOutputDirectory="PreserveNewest" />
|
<EmbeddedResource Include="Plugins\**" CopyToOutputDirectory="PreserveNewest" />
|
||||||
<EmbeddedResource Include="Assistants\I18N\allTexts.lua" CopyToOutputDirectory="PreserveNewest" />
|
<EmbeddedResource Include="Assistants\I18N\allTexts.lua" CopyToOutputDirectory="PreserveNewest" />
|
||||||
|
<EmbeddedResource Include="Assistants\PromptOptimizer\prompting_guideline.md" CopyToOutputDirectory="PreserveNewest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -51,6 +51,7 @@ public enum Event
|
|||||||
SEND_TO_CODING_ASSISTANT,
|
SEND_TO_CODING_ASSISTANT,
|
||||||
SEND_TO_TEXT_SUMMARIZER_ASSISTANT,
|
SEND_TO_TEXT_SUMMARIZER_ASSISTANT,
|
||||||
SEND_TO_CHAT,
|
SEND_TO_CHAT,
|
||||||
|
SEND_TO_CHAT_INPUT,
|
||||||
SEND_TO_EMAIL_ASSISTANT,
|
SEND_TO_EMAIL_ASSISTANT,
|
||||||
SEND_TO_LEGAL_CHECK_ASSISTANT,
|
SEND_TO_LEGAL_CHECK_ASSISTANT,
|
||||||
SEND_TO_SYNONYMS_ASSISTANT,
|
SEND_TO_SYNONYMS_ASSISTANT,
|
||||||
|
|||||||
@ -7,7 +7,9 @@ public readonly record struct SendToButton() : IButtonData
|
|||||||
public Func<string> GetText { get; init; } = () => string.Empty;
|
public Func<string> GetText { get; init; } = () => string.Empty;
|
||||||
|
|
||||||
public bool UseResultingContentBlockData { get; init; } = true;
|
public bool UseResultingContentBlockData { get; init; } = true;
|
||||||
|
|
||||||
|
public bool SendToChatAsInput { get; init; }
|
||||||
|
|
||||||
public Components Self { get; init; } = Components.NONE;
|
public Components Self { get; init; } = Components.NONE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user