Skip to content

Commit 9e49285

Browse files
committed
Merge branch 'feature/search-history'
2 parents e21a436 + d19c040 commit 9e49285

File tree

9 files changed

+100
-9
lines changed

9 files changed

+100
-9
lines changed

package-lock.json

Lines changed: 30 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"ngx-sonner": "^3.0.0",
3737
"rxjs": "~7.8.0",
3838
"tslib": "^2.3.0",
39+
"uuid": "^11.1.0",
3940
"xml2js": "^0.6.2",
4041
"zone.js": "0.15.0"
4142
},

src/app/landing-page/landing-page.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { AgenticService } from '../services/agentic.service';
3030
import { qs } from '../interfaces/IcontentResponse';
3131
import { ChatCompletion } from '../interfaces/IChatCompletionResponse';
3232
import { AgenticAnswerComponent } from './agentic-answer/agentic-answer.component';
33+
import { NifiService } from '../services/nifi.service';
3334

3435
@Component({
3536
selector: 'app-landing-page',
@@ -54,6 +55,7 @@ export class LandingPageComponent {
5455
private readonly changeDetector = inject(ChangeDetectorRef);
5556
private readonly store = inject(Store);
5657
private readonly llm = inject(LlmService);
58+
private readonly nifiservice = inject(NifiService);
5759
private readonly agentic_service = inject(AgenticService)
5860
readonly showVectorResults$ = this.store.select(selectShowVectorSearchResults);
5961
readonly showIdolResults$ = this.store.select(selectShowIdolSearchResults);
@@ -195,6 +197,10 @@ export class LandingPageComponent {
195197
this.loading = true;
196198
this.answers = [];
197199
this.question = valueEmitted;
200+
let username: string = localStorage.getItem('username')?.toString() || '';
201+
this.nifiservice.postAudit(username, this.question).subscribe(data => {
202+
console.log('Audit data sent successfully:', data);
203+
});
198204
this.fetchAnswer(this.question);
199205
if (this.question === 'What are the most common topics covered in this set of documents?'){
200206
// don't propogate the search term to the results

src/app/services/nifi.service.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { TestBed } from '@angular/core/testing';
2+
3+
import { NifiService } from './nifi.service';
4+
5+
describe('NifiService', () => {
6+
let service: NifiService;
7+
8+
beforeEach(() => {
9+
TestBed.configureTestingModule({});
10+
service = TestBed.inject(NifiService);
11+
});
12+
13+
it('should be created', () => {
14+
expect(service).toBeTruthy();
15+
});
16+
});

src/app/services/nifi.service.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Injectable } from '@angular/core';
2+
import { HttpClient, HttpHeaders } from '@angular/common/http';
3+
import { environment } from '../../environments/environment'; // adjust if using a libs structure
4+
import { v4 as uuidv4 } from 'uuid';
5+
6+
@Injectable({
7+
providedIn: 'root'
8+
})
9+
export class NifiService {
10+
11+
constructor(private http: HttpClient) { }
12+
postAudit(username:string, searchinput:string) {
13+
const url = `${environment.nifiAuditUrl}`; // Adjust the URL as necessary
14+
const headers = new HttpHeaders({
15+
'Content-Type': 'application/json',
16+
'Accept': 'application/json'
17+
});
18+
19+
const data = {
20+
username: username,
21+
searchinput: searchinput,
22+
ref: uuidv4(),
23+
time: new Date().toISOString()
24+
};
25+
26+
return this.http.post(url,data, { headers });
27+
}
28+
}

src/app/services/settings.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class SettingsService {
1818

1919
setVectorSearchEnabled(enabled: boolean) {
2020
this.vectorSearchEnabledSubject.next(enabled);
21+
console.log('Vector search enabled:', enabled);
2122
}
2223

2324
getPreviewEnabled() {

src/environments/environment.prod.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export const environment = {
88
community_api: 'api/community',
99
answerbank_api: 'api/answerbank',
1010
mistral_api: 'https://llms.idoldemos.net/mistral/v1/completions',
11+
nifiAuditUrl: 'api/nifi/audit/search'
1112
};

src/environments/environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ export const environment = {
88
community_api: 'api/community',
99
answerbank_api: 'api/answerbank',
1010
mistral_api: 'https://llms.idoldemos.net/mistral/v1/completions',
11+
nifiAuditUrl: 'api/nifi/audit/search'
1112
};

src/proxy.conf.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ module.exports = {
1212
pathRewrite: { "^/api/qms": "" },
1313
changeOrigin: true,
1414
logLevel: "debug"
15+
},
16+
"/api/nifi/audit/search": {
17+
target: "https://webui.idoldemos.net/api/nifi/audit/search",
18+
secure: false,
19+
pathRewrite: { "^/api/nifi/audit/search": "" },
20+
changeOrigin: true,
21+
logLevel: "debug",
22+
// Optional: Add debugging only to this route
23+
onProxyReq: (proxyReq, req, res) => {
24+
console.log(`[ProxyReq] ${req.method} ${req.url}`);
25+
},
26+
onProxyRes: (proxyRes, req, res) => {
27+
console.log(`[ProxyRes] ${req.method} ${req.url} -> ${proxyRes.statusCode}`);
28+
}
29+
30+
1531
},
1632
"/api/view": {
1733
target: "https://view.idoldemos.net:9080",

0 commit comments

Comments
 (0)