aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/apis/gpt/GPT.ts2
-rw-r--r--src/client/views/pdf/GPTPopup/GPTPopup.tsx15
2 files changed, 6 insertions, 11 deletions
diff --git a/src/client/apis/gpt/GPT.ts b/src/client/apis/gpt/GPT.ts
index af9cdd2d1..6258a82dc 100644
--- a/src/client/apis/gpt/GPT.ts
+++ b/src/client/apis/gpt/GPT.ts
@@ -213,7 +213,7 @@ const callTypeMap: { [type in GPTCallType]: GPTCallOpts } = {
Each one is separated by '${DescriptionSeperator}' on either side.
Descriptions will vary in length, so make sure to only separate when you see '${DescriptionSeperator}'.
Based on the question/command the user asks, provide a tag label of the given descriptions that best matches the user's specifications.
- Format your response precisely as a single string that prints each description followed by '${DataSeperator}' followed by the label followed by '${DescriptionSeperator}'.
+ Format your response precisely as a single string that prints each description without including any '${DescriptionSeperator}', followed by '${DataSeperator}', followed by the tag label, followed by '${DescriptionSeperator}'.
Do not use any additional formatting marks or punctuation'.
Immediately afterward, surrounded by '${DocSeperator}' on BOTH SIDES, provide some insight into your reasoning for the way you sorted (and mention nothing about the formatting details given in this description).
`,
diff --git a/src/client/views/pdf/GPTPopup/GPTPopup.tsx b/src/client/views/pdf/GPTPopup/GPTPopup.tsx
index ec269cc6c..9c37428ee 100644
--- a/src/client/views/pdf/GPTPopup/GPTPopup.tsx
+++ b/src/client/views/pdf/GPTPopup/GPTPopup.tsx
@@ -90,7 +90,7 @@ export class GPTPopup extends ObservableReactComponent<object> {
if (hasChildDocs) {
this._textToDocMap.clear();
this.setCollectionContext(selDoc.Document);
- this.onGptResponse = (sortResult: string, questionType: GPTDocCommand, args?: string) => this.processGptResponse(selDoc, this._textToDocMap, sortResult, questionType, args);
+ this.onGptResponse = (sortResult: string, questionType: GPTDocCommand) => this.processGptResponse(selDoc, this._textToDocMap, sortResult, questionType);
this.onQuizRandom = () => this.randomlyChooseDoc(selDoc.Document, hasChildDocs());
this._documentDescriptions = Promise.all(hasChildDocs().map(doc =>
Doc.getDescription(doc).then(text => this._textToDocMap.set(text.replace(/\n/g, ' ').trim(), doc) && `${DescriptionSeperator}${text}${DescriptionSeperator}`)
@@ -134,7 +134,7 @@ export class GPTPopup extends ObservableReactComponent<object> {
* @param questionType
* @param tag
*/
- processGptResponse = (docView: DocumentView, textToDocMap: Map<string, Doc>, gptOutput: string, questionType: GPTDocCommand, args?: string) =>
+ processGptResponse = (docView: DocumentView, textToDocMap: Map<string, Doc>, gptOutput: string, questionType: GPTDocCommand) =>
undoable(() => {
switch (questionType) { // reset collection based on question typefc
case GPTDocCommand.Sort:
@@ -155,12 +155,7 @@ export class GPTPopup extends ObservableReactComponent<object> {
doc[ChatSortField] = index;
break;
case GPTDocCommand.AssignTags:
- TagItem.addTagToDoc(doc, data.startsWith('#') ? data : '#'+data);
- // if (args) {
- // const hashTag = args.startsWith('#') ? args : '#' + args[0].toLowerCase() + args.slice(1);
- // const filterTag = Doc.MyFilterHotKeys.map(key => StrCast(key.toolType)).find(key => key.includes(args)) ?? hashTag;
- // TagItem.addTagToDoc(doc, filterTag);
- // }
+ data && TagItem.addTagToDoc(doc, data.startsWith('#') ? data : '#'+data[0].toLowerCase()+data.slice(1) );
break;
case GPTDocCommand.Filter:
TagItem.addTagToDoc(doc, GPTPopup.ChatTag);
@@ -240,7 +235,7 @@ export class GPTPopup extends ObservableReactComponent<object> {
* @param userPrompt the user's input that chat will respond to
*/
generateUserPromptResponse = (userPrompt: string) =>
- gptAPICall(userPrompt, GPTCallType.COMMANDTYPE, undefined, true).then((commandType, args = commandType.split(' ').slice(1).join(' ')) =>
+ gptAPICall(userPrompt, GPTCallType.COMMANDTYPE, undefined, true).then(commandType =>
(async () => {
switch (this.NumberToCommandType(commandType)) {
case GPTDocCommand.AssignTags:return this._documentDescriptions?.then(descs => gptAPICall(userPrompt, GPTCallType.TAGDOCS, descs)) ?? "";
@@ -251,7 +246,7 @@ export class GPTPopup extends ObservableReactComponent<object> {
})().then(
action(res => {
// Trigger the callback with the result
- this.onGptResponse?.(res || 'Something went wrong :(', this.NumberToCommandType(commandType), args);
+ this.onGptResponse?.(res || 'Something went wrong :(', this.NumberToCommandType(commandType));
this._conversationArray.push(
this.NumberToCommandType(commandType) === GPTDocCommand.GetInfo ? res:
// Extract explanation surrounded by the DocSeperator string (defined in GPT.ts) at the top or both at the top and bottom