emanate-ai-chat-lib 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -711,7 +711,9 @@
711
711
  };
712
712
  AiAgentService.prototype.processInquiry = function (request) {
713
713
  var headers = new i1.HttpHeaders(Object.assign({ 'Content-Type': 'application/json' }, (this.config.appKey && { 'x-api-key': this.config.appKey })));
714
- return this.http.post(this.config.apiUrl + "/ProcessInquiry", request, { headers: headers })
714
+ // Clean the request object to remove undefined/null values and ensure conversationId is a string
715
+ var cleanedRequest = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (request.query && { query: request.query })), (request.conversationId && { conversationId: String(request.conversationId) })), (request.userId && { userId: request.userId })), (request.userName && { userName: request.userName })), (request.appSource && { appSource: request.appSource }));
716
+ return this.http.post(this.config.apiUrl + "/ProcessInquiry", cleanedRequest, { headers: headers })
715
717
  .pipe(operators.timeout(this.config.timeout || 30000), operators.catchError(function (error) {
716
718
  console.log('ProcessInquiry API not available, returning demo response:', error);
717
719
  // Return a mock response for demo purposes
@@ -1050,13 +1052,7 @@
1050
1052
  this.authorName = '';
1051
1053
  this.intent = '';
1052
1054
  this.isLoading = true;
1053
- var request = {
1054
- query: inquiry,
1055
- conversationId: this.conversationId,
1056
- userId: this.userId,
1057
- userName: this.userName,
1058
- appSource: this.appSource
1059
- };
1055
+ var request = Object.assign(Object.assign(Object.assign(Object.assign({ query: inquiry }, (this.conversationId && { conversationId: String(this.conversationId) })), (this.userId && { userId: this.userId })), (this.userName && { userName: this.userName })), (this.appSource && { appSource: this.appSource }));
1060
1056
  this.aiAgentService.processInquiry(request)
1061
1057
  .pipe(operators.takeUntil(this.destroy$))
1062
1058
  .subscribe({