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
- 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>.
- 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?
3 Answer(s)
-
0
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 generatedmodels.tsfiles:- Duplicate / conflicting
ActionResultdeclarations (non-generic + generic with the same name). ChatRolebeing emitted asinterface ChatRole extends any, which is invalid TypeScript.
- Duplicate / conflicting
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
- Remove (or revert) the broken generated proxies in your main app proxy folder (since they are already invalid TS).
- Generate only AI Management proxies using the module-scoped command:
abp generate-proxy -t ng --module aiManagementThis 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 appand generate AI Management only when/where you need it using the
--module aiManagementcommand 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) -
0
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) -
0
Hi,
The chat controller in the AI Management client package (
ChatCompletionsController) ends up in your app proxies. The invalidActionResultandChatRoletypes come from it.You don't need to generate proxies for AI Management. The
@volo/abp.ng.ai-managementpackage 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
ConfigureServicesof your HttpApi.Host module. The module file needsusing Microsoft.AspNetCore.Mvc;andusing Microsoft.Extensions.DependencyInjection;:Configure<MvcOptions>(options => { options.Conventions.Add(new HideChatCompletionsControllerConvention()); });After that:
- Delete the
src/app/proxyfolder in your Angular app. Itsgenerate-proxy.jsonremembers that you generatedai-management, so it gets generated again on every run. - Restart the host and run
abp generate-proxy -t ngagain, 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) - Delete the