22 lines
625 B
C#
22 lines
625 B
C#
// Services/IllustrationBridge.cs
|
|
using Microsoft.JSInterop;
|
|
|
|
namespace BLAIzor.Services
|
|
{
|
|
public static class IllustrationBridge
|
|
{
|
|
// A static delegate to allow any component to register its prompt handler
|
|
public static Func<string, Task>? OnPromptReceived;
|
|
|
|
[JSInvokable("OnNewIllustrationPrompt")]
|
|
public static async Task HandlePrompt(string prompt)
|
|
{
|
|
Console.WriteLine($"[Bridge] Prompt received from JS: {prompt}");
|
|
if (OnPromptReceived is not null)
|
|
{
|
|
await OnPromptReceived(prompt);
|
|
}
|
|
}
|
|
}
|
|
}
|