File tree Expand file tree Collapse file tree 4 files changed +92
-2
lines changed
frontend/src/angular/src/app Expand file tree Collapse file tree 4 files changed +92
-2
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { MatToolbarModule } from '@angular/material/toolbar';
18
18
import { MatInputModule } from '@angular/material/input' ;
19
19
import { MatFormFieldModule } from '@angular/material/form-field' ;
20
20
import { Router } from '@angular/router' ;
21
+ import { McpServiceService } from '../service/mcp-service.service' ;
21
22
22
23
@Component ( {
23
24
selector : 'app-mcp-client' ,
@@ -36,14 +37,20 @@ export class McpClientComponent {
36
37
protected query = '' ;
37
38
protected response = '' ;
38
39
39
- constructor ( private readonly router : Router ) { }
40
-
40
+ constructor ( private readonly router : Router , private readonly mcpService : McpServiceService ) { }
41
+
41
42
protected showList ( ) : void {
42
43
this . router . navigate ( [ '/doclist' ] ) ;
43
44
}
44
45
45
46
protected submitForm ( ) : void {
46
47
console . log ( this . query ) ;
48
+ this . mcpService . sendRequest ( { question : this . query } ) . subscribe ( {
49
+ next : ( response ) => {
50
+ this . query = '' ;
51
+ this . response = response . answer ;
52
+ }
53
+ } ) ;
47
54
}
48
55
49
56
protected logout ( ) : void {
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2023 Sven Loesekann
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ export interface McpRequest {
14
+ question : string ;
15
+ }
16
+
17
+ export interface ToolCall {
18
+ id : string ;
19
+ type : string ;
20
+ name : string ;
21
+ arguments : string [ ] ;
22
+ }
23
+
24
+ export interface McpResponse {
25
+ answer : string ;
26
+ toolCalls : ToolCall [ ] ;
27
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2023 Sven Loesekann
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import { TestBed } from '@angular/core/testing' ;
14
+
15
+ import { McpServiceService } from './mcp-service.service' ;
16
+ /*
17
+ describe('McpServiceService', () => {
18
+ let service: McpServiceService;
19
+
20
+ beforeEach(() => {
21
+ TestBed.configureTestingModule({});
22
+ service = TestBed.inject(McpServiceService);
23
+ });
24
+
25
+ it('should be created', () => {
26
+ expect(service).toBeTruthy();
27
+ });
28
+ });
29
+ */
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright 2023 Sven Loesekann
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ */
13
+ import { HttpClient } from '@angular/common/http' ;
14
+ import { Injectable } from '@angular/core' ;
15
+ import { McpRequest , McpResponse } from '../model/mcp' ;
16
+
17
+ @Injectable ( {
18
+ providedIn : 'root'
19
+ } )
20
+ export class McpServiceService {
21
+
22
+ constructor ( private httpClient : HttpClient ) { }
23
+
24
+ public sendRequest ( request : McpRequest ) {
25
+ return this . httpClient . post < McpResponse > ( '/rest/mcpclient/question' , request ) ;
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments