diff options
author | bobzel <zzzman@gmail.com> | 2024-03-17 13:50:45 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-03-17 13:50:45 -0400 |
commit | 625c3a67fbcbfc93f1f1b35aed10b9fe7f33dfa9 (patch) | |
tree | ff2f8cd772542920f68159687f5a50bbeac36895 | |
parent | 606088e419f0e146715244d00840349b587c80ba (diff) |
fixed displaying of chat gpt query to use (( )) notation. allow '"'s in chat gpt calls by escaping with "`" intead.
-rw-r--r-- | src/client/views/nodes/KeyValueBox.tsx | 6 | ||||
-rw-r--r-- | src/fields/Doc.ts | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/nodes/KeyValueBox.tsx b/src/client/views/nodes/KeyValueBox.tsx index 2257e6455..2bcad806f 100644 --- a/src/client/views/nodes/KeyValueBox.tsx +++ b/src/client/views/nodes/KeyValueBox.tsx @@ -6,11 +6,11 @@ import { Doc, Field, FieldResult } from '../../../fields/Doc'; import { List } from '../../../fields/List'; import { RichTextField } from '../../../fields/RichTextField'; import { ComputedField, ScriptField } from '../../../fields/ScriptField'; -import { DocCast, StrCast } from '../../../fields/Types'; +import { DocCast } from '../../../fields/Types'; import { ImageField } from '../../../fields/URLField'; import { Docs } from '../../documents/Documents'; import { SetupDrag } from '../../util/DragManager'; -import { CompileScript, CompiledScript, ScriptOptions } from '../../util/Scripting'; +import { CompiledScript } from '../../util/Scripting'; import { undoBatch } from '../../util/UndoManager'; import { ContextMenu } from '../ContextMenu'; import { ContextMenuProps } from '../ContextMenuItem'; @@ -84,7 +84,7 @@ export class KeyValueBox extends ObservableReactComponent<FieldViewProps> { rawvalue = onDelegate ? rawvalue.substring(1) : rawvalue; const type: 'computed' | 'script' | false = rawvalue.startsWith(':=') ? 'computed' : rawvalue.startsWith('$=') ? 'script' : false; rawvalue = type ? rawvalue.substring(2) : rawvalue; - rawvalue = rawvalue.replace(/.*\(\((.*)\)\)/, 'dashCallChat(_setCacheResult_, this, "$1")'); + rawvalue = rawvalue.replace(/.*\(\((.*)\)\)/, 'dashCallChat(_setCacheResult_, this, `$1`)'); const value = ["'", '"', '`'].includes(rawvalue.length ? rawvalue[0] : '') || !isNaN(rawvalue as any) ? rawvalue : '`' + rawvalue + '`'; var script = ScriptField.CompileScript(rawvalue, {}, true, undefined, DocumentIconContainer.getTransformer()); diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 30f5f716c..daae32e9f 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -53,7 +53,7 @@ export namespace Field { (field instanceof ComputedField && showComputedValue ? field._lastComputedResult : field instanceof ComputedField - ? `:=${field.script.originalScript}` + ? `:=${field.script.originalScript.replace(/dashCallChat\(_setCacheResult_, this, `(.*)`\)/, '(($1))')}` : field instanceof ScriptField ? `$=${field.script.originalScript}` : Field.toScriptString(field)); |