diff --git a/files/client/custom/modules/knowledge-base/src/views/kb/index.js b/files/client/custom/modules/knowledge-base/src/views/kb/index.js index 1e87adc..f5e15f0 100644 --- a/files/client/custom/modules/knowledge-base/src/views/kb/index.js +++ b/files/client/custom/modules/knowledge-base/src/views/kb/index.js @@ -103,17 +103,68 @@ define('modules/knowledge-base/views/kb/index', ['view'], function (Dep) { runAsk: function (message) { this.setLoading(true); + this.startAskProgress(); + // Ask goes through the full agent loop (search + rerank + LLM), + // which routinely takes 30-90s. The default jQuery Ajax timeout + // is too short; override it here so the browser doesn't give up + // before shira-hermes responds. Espo.Ajax.postRequest('KnowledgeBase/action/ask', { message: message, - }).then(res => { + }, {timeout: 240000}).then(res => { + this.stopAskProgress(); this.setLoading(false); this.renderAskAnswer(res.text || ''); }).catch(err => { + this.stopAskProgress(); this.setLoading(false); this.showError(err); }); }, + startAskProgress: function () { + // Show a live elapsed-time indicator so users know the request + // is still running rather than stuck. Typical answers arrive in + // 30-90s; we warn after 2 minutes. + if (this.mode !== 'ask') return; + const $results = this.$el.find('.kb-results'); + $results.html( + '