Open Closed

Integrating AI template in module app #9886


User avatar
0
rcalv002 created

We looked at https://abp.io/community/articles/integrating-.net-ai-chat-template-with-abp-framework-qavb5p2j#gsc.tab=0 to integrate the microsoft ai chat template to our module based app.

Almost everything is working fine, even though the new version differs from the community article at this point. however, there are some ai-libs that should be served, that we can't get right. The page using the ai template is in one of our submodules, not the main "app". when the js function attempts to loading the assistant-message markdown, those libs are not found and so the response is just plain text with no markdown formatting or sanitation

[21:36:14 WRN] The static asset '/ai-libs/dompurify/dist/purify.es.mjs' was not found in the built time manifest. This file will not be available at runtime if it is not available at compile time during the publish process. If the file was not added to the project during development, and is created at runtime, use the StaticFiles middleware to serve it instead. [21:36:14 INF] Executed endpoint 'Fallback {**path:file}' [21:36:14 INF] Request finished HTTP/2 GET https://localhost:44320/ai-libs/dompurify/dist/purify.es.mjs - 404 0 null 8.9684ms [21:36:14 INF] Request reached the end of the middleware pipeline without being handled by application code. Request path: GET https://localhost:44320/ai-libs/dompurify/dist/purify.es.mjs, Response status code: 404


1 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    To resolve the issue with missing AI library static assets (such as dompurify) in a module-based ABP application, especially when the AI chat page is in a submodule, follow these steps:

    1. Ensure the required JS libraries (e.g., dompurify, marked, etc.) are present in your project:

      • Place the necessary files (like /ai-libs/dompurify/dist/purify.es.mjs) in the wwwroot/ai-libs directory of the module or the main web project.
      • If your submodule is a class library, ensure it has a wwwroot folder and that the files are marked as "Content" and "Copy if newer" in the .csproj.
    2. Serve static files from the submodule:

      • In your submodule's module class, add the following configuration to ensure embedded/static files are served:
    Configure<AbpVirtualFileSystemOptions>(options =>
       {
           options.FileSets.AddEmbedded<YourSubmoduleName>();
       });
    
       Configure<AbpAspNetCoreStaticFilesOptions>(options =>
       {
           options.FileSets.AddEmbedded<YourSubmoduleName>();
       });
    

    Replace YourSubmoduleName with the actual module class.

    1. If using embedded resources, ensure the files are embedded:
      • In your .csproj:
    <ItemGroup>
           <EmbeddedResource Include="wwwroot\**" />
         </ItemGroup>
    
    1. If using physical files, ensure the StaticFiles middleware is enabled in your main app's Startup or Program:
    app.UseStaticFiles();
    
    1. Reference the static assets correctly in your page/component:

      • Use /ai-libs/dompurify/dist/purify.es.mjs as the path if the files are in the main web project's wwwroot.
      • If served from a module, the path may be /Your.Module.Name/ai-libs/dompurify/dist/purify.es.mjs.
    2. Publish and verify:

      • After publishing, check that the files are present in the output directory and accessible via the expected URLs.

    This approach ensures that static assets required by the AI chat template are available at runtime, regardless of whether the page is in the main app or a submodule.

    Sources:

    • https://abp.io/community/articles/integrating-.net-ai-chat-template-with-abp-framework-qavb5p2j#gsc.tab=0

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 12, 2025, 10:20