| 1 | using System.Reflection; |
| 2 | |
| 3 | namespace AgentForge.Plugin.View; |
| 4 | |
| 5 | internal static class ForgeViewSlashAssets |
| 6 | { |
| 7 | private static readonly Lazy<string> SlashScript = new(LoadSlashScript); |
| 8 | |
| 9 | internal static IResult ServeSlashScript() => |
| 10 | Results.Content(SlashScript.Value, "application/javascript; charset=utf-8"); |
| 11 | |
| 12 | private static string LoadSlashScript() |
| 13 | { |
| 14 | var assembly = typeof(ForgeViewSlashAssets).Assembly; |
| 15 | const string resourceName = "AgentForge.Plugin.View.wwwroot.forge-slash.js"; |
| 16 | using var stream = assembly.GetManifestResourceStream(resourceName); |
| 17 | if (stream is null) |
| 18 | return "console.warn('forge-slash.js missing');"; |
| 19 | |
| 20 | using var reader = new StreamReader(stream); |
| 21 | return reader.ReadToEnd(); |
| 22 | } |
| 23 | } |
| 24 | |
View only · write via MCP/CIDE