1- import {
2- EnvironmentInjector ,
3- inject ,
4- Injectable ,
5- runInInjectionContext ,
6- } from '@angular/core' ;
1+ import { inject , Injectable } from '@angular/core' ;
72import {
83 type AgUiChatResourceRef ,
94 agUiResource ,
@@ -25,31 +20,28 @@ import { flightWidget } from './widgets/flight-widget';
2520export class TicketingChatService {
2621 private readonly config = inject ( ConfigService ) ;
2722 private readonly chatStore = inject ( ChatRegistry ) ;
28- private readonly injector = inject ( EnvironmentInjector ) ;
2923
3024 private chat : AgUiChatResourceRef | null = null ;
3125
3226 public init ( ) : void {
3327 if ( ! this . chat ) {
34- this . chat = runInInjectionContext ( this . injector , ( ) =>
35- agUiResource ( {
36- url : this . config . agUiUrl ,
37- model : this . config . model ,
38- useServerMemory : true ,
39- tools : [
40- findFlightsTool ,
41- getLoadedFlightsTool ,
42- toggleFlightSelectionTool ,
43- getCurrentBasketTool ,
44- displayFlightDetailTool ,
45- createShowComponentsTool ( [
46- messageWidget ,
47- flightWidget ,
48- mcpAppsWidgetComponent ,
49- ] ) ,
50- ] ,
51- } ) ,
52- ) ;
28+ this . chat = agUiResource ( {
29+ url : this . config . agUiUrl ,
30+ model : this . config . model ,
31+ useServerMemory : true ,
32+ tools : [
33+ findFlightsTool ,
34+ getLoadedFlightsTool ,
35+ toggleFlightSelectionTool ,
36+ getCurrentBasketTool ,
37+ displayFlightDetailTool ,
38+ createShowComponentsTool ( [
39+ messageWidget ,
40+ flightWidget ,
41+ mcpAppsWidgetComponent ,
42+ ] ) ,
43+ ] ,
44+ } ) ;
5345 }
5446 this . chatStore . setChat ( this . chat ) ;
5547 }
0 commit comments