aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-01-29 10:06:38 -0500
committerbobzel <zzzman@gmail.com>2025-01-29 10:06:38 -0500
commitf47b7b61749e519d694cff841b4e961fd211c0dd (patch)
tree37985c8ca28eb7eb0f78a879defd09cf5ec4838d /src
parenta496c583f375fe5e118f786b1244c42bc8a34fec (diff)
fixed chat based sorting and tagging of docs
Diffstat (limited to 'src')
-rw-r--r--src/client/apis/gpt/GPT.ts45
-rw-r--r--src/client/views/collections/CollectionCardDeckView.tsx11
2 files changed, 38 insertions, 18 deletions
diff --git a/src/client/apis/gpt/GPT.ts b/src/client/apis/gpt/GPT.ts
index d96972784..269a4284a 100644
--- a/src/client/apis/gpt/GPT.ts
+++ b/src/client/apis/gpt/GPT.ts
@@ -84,18 +84,6 @@ const callTypeMap: { [type: string]: GPTCallOpts } = {
temp: 0.1, //0.3
prompt: "BRIEFLY (<50 words) describe any differences between the rubric and the user's answer answer in second person. If there are no differences, say correct",
},
- type: {
- model: 'gpt-4-turbo',
- maxTokens: 512,
- temp: 0.5,
- prompt: '',
- },
- info: {
- model: 'gpt-4-turbo',
- maxTokens: 512,
- temp: 0.5,
- prompt: '',
- },
template: {
model: 'gpt-4-turbo',
maxTokens: 512,
@@ -133,6 +121,39 @@ const callTypeMap: { [type: string]: GPTCallOpts } = {
temp: 0.5,
prompt: 'You will be coloring drawings. You will be given what the drawing is, then a list of descriptions for parts of the drawing. Based on each description, respond with the stroke and fill color that it should be. Follow the rules: 1. Avoid using black for stroke color 2. Make the stroke color 1-3 shades darker than the fill color 3. Use the same colors when possible. Format as {#abcdef #abcdef}, making sure theres a color for each description, and do not include any additional text.',
},
+ type: {
+ model: 'gpt-4-turbo',
+ maxTokens: 1024,
+ temp: 0,
+ prompt: `I'm going to provide you with a question.
+ Based on the question, is the user asking you to
+ 1. Assigns docs with tags(like star / heart etc)/labels,
+ 2. Filter docs,
+ 3. Provide information about a specific doc
+ 4. Provide a specific doc based on a question/information
+ 5. Provide general information
+ 6. Put cards in a specific order.
+ Answer with only the number for 2-6. For number one, provide the number (1) and the appropriate tag`,
+ },
+ subset: {
+ model: 'gpt-4-turbo',
+ maxTokens: 1024,
+ temp: 0,
+ prompt: "I'm going to give you a list of descriptions. Each one is separated by `======` on either side. Descriptions will vary in length, so make sure to only separate when you see `======`. Based on the question the user asks, provide a subset of the given descriptions that best matches the user's specifications. Make sure each description is only in the list once. Each item should be separated by `======`. Immediately afterward, surrounded by `------` on BOTH SIDES, provide some insight into your reasoning in the 2nd person (and mention nothing about the formatting details given in this description). It is VERY important that you format it exactly as described, ensuring the proper number of `=` and `-` (6 of each) and no commas",
+ },
+
+ info: {
+ model: 'gpt-4-turbo',
+ maxTokens: 1024,
+ temp: 0,
+ prompt: "Answer the user's question with a short (<100 word) response. If a particular document is selected I will provide that information (which may help with your response)",
+ },
+ rubric: {
+ model: 'gpt-4-turbo',
+ maxTokens: 1024,
+ temp: 0,
+ prompt: "BRIEFLY (<25 words) provide a definition for the following term. It will be used as a rubric to evaluate the user's understanding of the topic",
+ },
};
let lastCall = '';
let lastResp = '';
diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx
index aaf33c3a1..366d0f448 100644
--- a/src/client/views/collections/CollectionCardDeckView.tsx
+++ b/src/client/views/collections/CollectionCardDeckView.tsx
@@ -27,7 +27,7 @@ import { DocumentView, DocumentViewProps } from '../nodes/DocumentView';
import { FocusViewOptions } from '../nodes/FocusViewOptions';
import { GPTPopup } from '../pdf/GPTPopup/GPTPopup';
import './CollectionCardDeckView.scss';
-import { CollectionSubView, SubCollectionViewProps } from './CollectionSubView';
+import { CollectionSubView, docSortings, SubCollectionViewProps } from './CollectionSubView';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { SettingsManager } from '../../util/SettingsManager';
@@ -243,7 +243,7 @@ export class CollectionCardView extends CollectionSubView() {
const sorted = this.childDocs;
const originalIndex = sorted.findIndex(doc => doc === draggedDoc);
- this.Document.card_sort = '';
+ this.Document[this._props.fieldKey + '_sort'] = '';
originalIndex !== -1 && sorted.splice(originalIndex, 1);
sorted.splice(dragIndex, 0, draggedDoc);
if (de.complete.docDragData.removeDocument?.(draggedDoc)) {
@@ -450,7 +450,7 @@ export class CollectionCardView extends CollectionSubView() {
}
if (questionType === '6') {
- this.Document.card_sort = 'chat';
+ this.Document[this._props.fieldKey + '_sort'] = docSortings.Chat;
}
listItems.forEach((item, index) => {
@@ -467,16 +467,15 @@ export class CollectionCardView extends CollectionSubView() {
let myTag = '';
if (tag) {
for (let i = 0; i < allHotKeys.length; i++) {
- // bcz: CHECK THIS CODE OUT -- SOMETHING CHANGED
const keyTag = StrCast(allHotKeys[i].toolType);
- if (tag.includes(keyTag)) {
+ if (keyTag.includes(tag)) {
myTag = keyTag;
break;
}
}
if (myTag) {
- doc[myTag] = true;
+ TagItem.addTagToDoc(doc, myTag);
}
}
break;