diff options
Diffstat (limited to 'src/client/views/collections')
| -rw-r--r-- | src/client/views/collections/CollectionCardDeckView.tsx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx index 43464e50c..a3ec3884b 100644 --- a/src/client/views/collections/CollectionCardDeckView.tsx +++ b/src/client/views/collections/CollectionCardDeckView.tsx @@ -12,7 +12,7 @@ import { List } from '../../../fields/List'; import { ScriptField } from '../../../fields/ScriptField'; import { BoolCast, DocCast, NumCast, RTFCast, ScriptCast, StrCast } from '../../../fields/Types'; import { URLField } from '../../../fields/URLField'; -import { gptImageLabel } from '../../apis/gpt/GPT'; +import { gptImageLabel, GPTTypeStyle } from '../../apis/gpt/GPT'; import { DocumentType } from '../../documents/DocumentTypes'; import { Docs } from '../../documents/Documents'; import { DragManager } from '../../util/DragManager'; @@ -80,7 +80,7 @@ export class CollectionCardView extends CollectionSubView() { childPairStringListAndUpdateSortDesc = () => this.childPairStringList().then(sortDesc => { GPTPopup.Instance.setSortDesc(sortDesc.join()); - GPTPopup.Instance.onSortComplete = this.processGptOutput; + GPTPopup.Instance.onGptResponse = this.processGptResponse; GPTPopup.Instance.onQuizRandom = this.quizMode; }); @@ -113,7 +113,7 @@ export class CollectionCardView extends CollectionSubView() { onGptHide = () => Doc.setDocFilter(this.Document, 'tags', '#chat', 'remove'); componentWillUnmount() { GPTPopup.Instance.setSortDesc(''); - GPTPopup.Instance.onSortComplete = undefined; + GPTPopup.Instance.onGptResponse = undefined; GPTPopup.Instance.onQuizRandom = undefined; GPTPopup.Instance.setRegenerateCallback(undefined, null); Object.keys(this._disposers).forEach(key => this._disposers[key]?.()); @@ -443,18 +443,18 @@ export class CollectionCardView extends CollectionSubView() { * @param questionType * @param tag */ - processGptOutput = (gptOutput: string, questionType: string, tag?: string) => + processGptResponse = (gptOutput: string, questionType: GPTTypeStyle, tag?: string) => undoable(() => { // Split the string into individual list items const listItems = gptOutput.split('======').filter(item => item.trim() !== ''); - if (questionType === '2' || questionType === '4') { + if (questionType === GPTTypeStyle.Filter || questionType === GPTTypeStyle.ChooseDoc) { this.childDocs.forEach(d => { TagItem.removeTagFromDoc(d, '#chat'); }); } - if (questionType === '6') { + if (questionType === GPTTypeStyle.SortDocs) { this.Document[this._props.fieldKey + '_sort'] = docSortings.Chat; } @@ -464,18 +464,18 @@ export class CollectionCardView extends CollectionSubView() { const doc = this._textToDoc.get(normalizedItem); if (doc) { switch (questionType) { - case '6': + case GPTTypeStyle.SortDocs: doc.chatIndex = index; break; - case '1': + case GPTTypeStyle.AssignTags: if (tag) { const hashTag = tag.startsWith('#') ? tag : '#' + tag[0].toLowerCase() + tag.slice(1); const filterTag = Doc.MyFilterHotKeys.map(key => StrCast(key.toolType)).find(key => key.includes(tag)) ?? hashTag; TagItem.addTagToDoc(doc, filterTag); } break; - case '2': - case '4': + case GPTTypeStyle.Filter: + case GPTTypeStyle.ChooseDoc: TagItem.addTagToDoc(doc, '#chat'); Doc.setDocFilter(this.Document, 'tags', '#chat', 'check'); break; |
