Open Closed

ABP 10.7 AI Management installation causes invalid Angular proxies for ActionResult and ChatRole #10948


User avatar
0
rshapiro created

After installing the AI Management module in an existing ABP Angular application, I regenerated the application proxies using: abp generate-proxy -t ng

The Angular application no longer compiles because the generated proxies contain invalid TypeScript.

Environment

  • ABP version: 10.7
  • Angular UI
  • abp/ng.schematics: 10.7
  • volo/abp.ng.ai-management: 10.7
  1. Conflicting ActionResult declarations

src/app/proxy/microsoft/asp-net-core/mvc/models.ts contains: export interface ActionResult { }

export interface ActionResult<TValue> { result?: ActionResult | null; value?: TValue | null; }

export interface IActionResult { }

This produces two instances of: All declarations of 'ActionResult' must have identical type parameters.

It also produces: Generic type 'ActionResult<TValue>' requires 1 type argument(s).

The generated src/app/proxy/volo/aimanagement/client/controllers/chat-completions.service.ts imports ActionResult and uses ActionResult<object>.

  1. Invalid ChatRole declaration

src/app/proxy/microsoft/extensions/ai/models.ts contains: export interface ChatRole extends any { value?: string; }

This produces: An interface cannot extend a primitive type like 'any'. It can only extend other named object types.

The generated src/app/proxy/volo/aimanagement/client/chat/models.ts imports and uses ChatRole.

These errors appeared after installing AI Management and regenerating proxies; I have not customized these module types or endpoints.

Is this a known issue in ABP 10.7? Is there a supported fix or configuration to prevent these AI Management client types from being generated as part of the default application proxies, while retaining the AI Management Angular interface and backend functionality?

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

8 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • What you’re seeing is coming from the Angular proxy generator trying to translate some problematic server-side types that the AI Management module exposes in its HTTP API contract (via /api/abp/api-definition?includeTypes=true). In ABP 10.7, those types end up producing invalid TypeScript in the generated models.ts files:

      • Duplicate / conflicting ActionResult declarations (non-generic + generic with the same name).
      • ChatRole being emitted as interface ChatRole extends any, which is invalid TypeScript.
    • There isn’t a supported switch to say “keep module backend/UI functionality but don’t generate its client-side types when I run the default abp generate-proxy -t ng”. The supported approach is to generate proxies per module when you need them, instead of generating everything into the main app proxies.

    • Supported workaround (recommended): generate only the AI Management proxies separately

      1. Remove (or revert) the broken generated proxies in your main app proxy folder (since they are already invalid TS).
      2. Generate only AI Management proxies using the module-scoped command:
    abp generate-proxy -t ng --module aiManagement
    
     This is the documented way to generate the AI Management module’s Angular services/models.
    
    • If you want to avoid pulling AI Management contracts into your default app proxy output, keep using the default generation for your app module:
    abp generate-proxy -t ng --module app
    

    and generate AI Management only when/where you need it using the --module aiManagement command above.

    • If you must generate everything in one shot (single proxy tree), then the only reliable workaround is manually fixing the generated TypeScript after generation (but that is not a stable/supported workflow because regeneration will overwrite).

    Sources (validated)

    • https://abp.io/docs/10.7/modules/ai-management/
    • https://docs.abp.io/en/abp/latest/UI/Angular/Service-Proxies

    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.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    rshapiro created

    Getting an error with the command abp generate-proxy -t ng --module aiManagement. Found that this is not the correct module name and used ai-management as the module name but now getting the same ActionResult and ChatRole errors and even more now related to the ai management workspaces. Is this functionality actually production ready?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    The chat controller in the AI Management client package (ChatCompletionsController) ends up in your app proxies. The invalid ActionResult and ChatRole types come from it.

    You don't need to generate proxies for AI Management. The @volo/abp.ng.ai-management package already ships them (@volo/abp.ng.ai-management/proxy).

    For now, you can hide this controller from the API definition. The endpoint keeps working, the AI Management Angular UI calls it by URL. It's only hidden from Swagger and proxy generation.

    Add this class to your HttpApi.Host project:

    using Microsoft.AspNetCore.Mvc.ApplicationModels;
    using Volo.AIManagement.Client.Controllers;
    
    namespace YourCompany.YourProject;
    
    public class HideChatCompletionsControllerConvention : IControllerModelConvention
    {
        public void Apply(ControllerModel controller)
        {
            if (controller.ControllerType != typeof(ChatCompletionsController))
            {
                return;
            }
    
            controller.ApiExplorer.IsVisible = false;
            foreach (var action in controller.Actions)
            {
                action.ApiExplorer.IsVisible = false;
            }
        }
    }
    

    Then register it in ConfigureServices of your HttpApi.Host module. The module file needs using Microsoft.AspNetCore.Mvc; and using Microsoft.Extensions.DependencyInjection;:

    Configure<MvcOptions>(options =>
    {
        options.Conventions.Add(new HideChatCompletionsControllerConvention());
    });
    

    After that:

    1. Delete the src/app/proxy folder in your Angular app. Its generate-proxy.json remembers that you generated ai-management, so it gets generated again on every run.
    2. Restart the host and run abp generate-proxy -t ng again, without --module.

    We'll fix the controller in the next release. Your ticket has been refunded.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    rshapiro created

    Thanks, that did the trick.

    Couple more things to mention:

    During the install of the AIManagement module, the installer misses adding a 'using Volo.AIManagement;' to the projects Application Module.This crashes out the install process. Need to manually fix and re-run the install so that it reaches the end of the install process and updates the solution to indicate that the new module is installed. Also, the Angular ai management package doesn't get installed and need to run it manually after the fact.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    The AI Management installer doesn't include the Angular installation info, so ABP Studio skips the Angular part. We'll fix the Angular installation in an upcoming version. For now, you can set it up manually in your Angular app.

    If you haven't already, install the package from your angular folder:

    yarn add @volo/abp.ng.ai-management@10.7.0
    

    If it's missing, add the config provider to the existing providers array in app.config.ts:

    import { provideAIManagementConfig } from '@volo/abp.ng.ai-management/config';
    
    export const appConfig: ApplicationConfig = {
      providers: [
        // ...
        provideAIManagementConfig(),
      ],
    };
    

    If it's missing, add this route to the routes array in app.routes.ts:

    {
      path: 'ai-management',
      loadChildren: () => import('@volo/abp.ng.ai-management').then(c => c.createRoutes()),
    },
    

    About the missing using Volo.AIManagement;: ABP Studio checks the module file as plain text before adding a using. If the file has a commented-out using Volo.AIManagement; line, it skips the using but still adds the DependsOn, and the build fails. We'll fix this as well. Adding the using manually, as you did, is the right fix for now.

    If your Application module didn't contain that text before the install, could you share the file from before the install (from your git history) and your ABP Studio version? You can send them to liming.ma@volosoft.com if you prefer.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    Thanks for the files. Neither of them has using Volo.AIManagement;, even in a comment, so my earlier explanation doesn't apply to your case. I tried both abp add-module and abp install-module with your two files on a 10.7.0 solution, and the using was added each time.

    Could you send:

    • the exact install command, with options, and the folder you ran it from
    • the output of abp --version
    • your OS
    • the full install output

    If you still have the failed branch, please also send the git diff of the affected module file and its .csproj from before you added the using manually.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    rshapiro created

    Hi,

    I just used the command specified on the ABP AI Management (Pro) documentation page. So it was 'abp add-module Volo.AIManagement.'

    The output of abp --verision is 3.1.6 The OS is Windows 11 26H2. I don't have the install output anymore and I don't have the failed files anymore. It's all been corrected and the failures were never commited. Here's the Domain csproj from before the install if that helps at all Whitecap.COE.Domain.csproj

    Thanks, Ruven

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    abp add-module adds AIManagementOpenAIModule to the DependsOn of your Domain module, but it adds the wrong using for it. The class is in the Volo.AIManagement.OpenAI namespace.

    Adding this using to the Domain module fixes it:

    using Volo.AIManagement.OpenAI;
    

    We'll fix this.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 30, 2026, 06:34
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.