This commit is contained in:
h z
2025-05-04 19:11:12 +01:00
parent 619ddc6ddf
commit a97c71caaf
6 changed files with 32 additions and 16 deletions

View File

@@ -15,6 +15,7 @@
<input @bind="currentSessionIdInput" placeholder="Enter or Generate Session ID" />
<button @onclick="LoadSession" disabled="@isLoading">Load / Start Session</button>
<button @onclick="GenerateSessionId" disabled="@isLoading">Generate New ID</button>
<input @bind="externalWebhookUrl" placeholder="Server url">
@if (!string.IsNullOrEmpty(activeSessionId))
{
<span>Active Session: @activeSessionId</span>
@@ -62,7 +63,7 @@ else if (sessionLoadAttempted)
private string newMessage { get; set; } = string.Empty;
private bool isLoading = false;
private bool sessionLoadAttempted = false;
private string externalWebhookUrl { get; set; } = string.Empty;
private string? _previousSessionId = null;
@@ -170,7 +171,7 @@ else if (sessionLoadAttempted)
private async Task SendMessage()
{
if (currentSession == null || string.IsNullOrWhiteSpace(newMessage) || currentSession.IsWaitingForResponse)
if (currentSession == null || string.IsNullOrWhiteSpace(newMessage) || currentSession.IsWaitingForResponse || String.IsNullOrWhiteSpace(externalWebhookUrl))
return;
var userMessage = new ChatMessage { IsUser = true, Content = newMessage };
@@ -182,7 +183,7 @@ else if (sessionLoadAttempted)
StateHasChanged();
await ChatSessionService.SendMessageToExternalWebhook(activeSessionId, messageToSend);
await ChatSessionService.SendMessageToExternalWebhook(externalWebhookUrl, activeSessionId, messageToSend);
}