Skip to content

Commit

Permalink
Code(WEB::Actions): Add single message mode in actions after backend …
Browse files Browse the repository at this point in the history
…changes
  • Loading branch information
ktutak1337 committed Jun 20, 2024
1 parent f6dc797 commit 67b1f1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@
HelperText="@metapromptGuidelines"
For="@(() => Action!.Metaprompt)" />

<MudText>Single Message Mode</MudText>
<div class="d-flex flex-grow-1">
<HelperText Text="@singleMessageModeGuidelines" />
<MudSwitch @bind-Value="@Action.IsSingleMessageMode" Color="Color.Primary" Class="my-auto" Style="margin-left: auto; margin-right: -4px;" />
</div>

<MudText>Remote action</MudText>
<div class="d-flex flex-grow-1">
<HelperText Text="@remoteActionGuidelines" />
Expand Down Expand Up @@ -108,6 +114,11 @@ Example: { ""status"": ""success"", ""data"": { ""key"": ""value"" } }.";
Enabling this option allows connection to external services, enabling you to trigger automation scenarios
or integrate with various APIs and webhooks.";

private const string singleMessageModeGuidelines = @"
Enabling this option sends only the user's last message to the action instead of the entire chat history.
Some actions require just the latest message, while others need the full conversation context. Enable as needed.";

private bool success;

protected override async Task OnInitializedAsync()
Expand Down Expand Up @@ -175,6 +186,7 @@ or integrate with various APIs and webhooks.";
Icon = action.Icon,
Model = action.Model,
Metaprompt = action.Metaprompt,
IsSingleMessageMode = action.IsSingleMessageMode,
IsRemoteAction = action.IsRemoteAction,
ShouldRephraseResponse = action.ShouldRephraseResponse,
Webhook = new WebhookResponse
Expand All @@ -195,6 +207,7 @@ or integrate with various APIs and webhooks.";

private void SetupNewActionParameters()
{
Action.IsSingleMessageMode = false;
Action.ShouldRephraseResponse = false;
Action.Webhook!.HttpMethod = "POST";
Action.Webhook!.Payload = string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public async ValueTask<Guid> CreateAction(NativeActionResponse action)
action.Icon,
action.Model,
action.Metaprompt,
action.IsSingleMessageMode,
action.IsRemoteAction,
action.ShouldRephraseResponse,
new Webhook(
Expand Down Expand Up @@ -97,6 +98,7 @@ public async ValueTask UpdateAction(NativeActionResponse action)
action.Icon,
action.Model,
action.Metaprompt,
action.IsSingleMessageMode,
action.IsRemoteAction,
action.ShouldRephraseResponse,
new Webhook(
Expand Down

0 comments on commit 67b1f1b

Please sign in to comment.