diff --git a/sdkjs-plugins/content/ai/scripts/custom-annotations/assistant-hint.js b/sdkjs-plugins/content/ai/scripts/custom-annotations/assistant-hint.js index 0c5f2d62..a3f46142 100644 --- a/sdkjs-plugins/content/ai/scripts/custom-annotations/assistant-hint.js +++ b/sdkjs-plugins/content/ai/scripts/custom-annotations/assistant-hint.js @@ -165,7 +165,7 @@ AssistantHint.prototype._createPrompt = function(text) { Guidelines for each field: - "origin": EXACT UNCHANGED original text fragment. Do not fix anything in this field. - - "reason": Clear explanation of why this fragment matches the criteria. + - "reason": Clear explanation of why this fragment matches the criteria; IF the user's request contains words like "source", "reference", "link", "cite", "website", "URL", "Wikipedia", "proof", "evidence", "verify" - then you MUST include actual working links in your explanations in html format. - "paragraph": Paragraph number where the fragment is found (0-based index) - "occurrence": Which occurrence of this sentence if it appears multiple times (1 for first, 2 for second, etc.) - "confidence": Value between 0 and 1 indicating certainty (1.0 = completely certain, 0.5 = uncertain) @@ -198,9 +198,15 @@ AssistantHint.prototype._createPrompt = function(text) { AssistantHint.prototype.getInfoForPopup = function(paraId, rangeId) { let _s = this.getAnnotation(paraId, rangeId); + let reason = _s["reason"]; + try { + reason = reason.replace(//gi, ''); + } catch (e) { + console.error(e); + } return { original : _s["original"], - explanation : _s["reason"], + explanation : reason, type : this.type }; }; diff --git a/sdkjs-plugins/content/ai/scripts/custom-annotations/assistant-replace-hint.js b/sdkjs-plugins/content/ai/scripts/custom-annotations/assistant-replace-hint.js index f9f2c8c3..953d042b 100644 --- a/sdkjs-plugins/content/ai/scripts/custom-annotations/assistant-replace-hint.js +++ b/sdkjs-plugins/content/ai/scripts/custom-annotations/assistant-replace-hint.js @@ -173,7 +173,7 @@ AssistantReplaceHint.prototype._createPrompt = function(text) { - "suggestion": Your suggested replacement for the fragment. * Ensure it aligns with the user's criteria. * Maintain coherence with surrounding text. - - "reason": Clear explanation of why this fragment matches the criteria. + - "reason": Clear explanation of why this fragment matches the criteria; IF the user's request contains words like "source", "reference", "link", "cite", "website", "URL", "Wikipedia", "proof", "evidence", "verify" - then you MUST include actual working links in your explanations in html format. - "difference": The difference between origin and suggestion in html format: that is, you need to take the suggestion field and highlight the differences in it by wrapping them in the tag. - "paragraph": Paragraph number where the fragment is found (0-based index) - "occurrence": Which occurrence of this sentence if it appears multiple times (1 for first, 2 for second, etc.) @@ -207,10 +207,16 @@ AssistantReplaceHint.prototype._createPrompt = function(text) { AssistantReplaceHint.prototype.getInfoForPopup = function(paraId, rangeId) { let _s = this.getAnnotation(paraId, rangeId); + let reason = _s["reason"]; + try { + reason = reason.replace(//gi, ''); + } catch (e) { + console.error(e); + } return { original : _s["original"], suggested : _s["difference"], - explanation : _s["reason"], + explanation : reason, type : this.type }; }; diff --git a/sdkjs-plugins/content/ai/scripts/custom-annotations/custom-annotator.js b/sdkjs-plugins/content/ai/scripts/custom-annotations/custom-annotator.js index 6ce272d4..c1433db5 100644 --- a/sdkjs-plugins/content/ai/scripts/custom-annotations/custom-annotator.js +++ b/sdkjs-plugins/content/ai/scripts/custom-annotations/custom-annotator.js @@ -36,7 +36,7 @@ function CustomAnnotator(assistantData) { this.paragraphs = {}; - /** @type {Object.} */ + /** @type {Object.} */ this.waitParagraphs = {}; this.paraToCheck = new Set(); this.checked = new Set(); // was checked on the previous request @@ -46,7 +46,7 @@ function CustomAnnotator(assistantData) } /** * @param {string} paraId - * @param {string} recalcId + * @param {number} recalcId * @param {string} text * @param {string[]} ranges */