diff options
-rw-r--r-- | package-lock.json | 56 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/client/util/History.ts | 21 | ||||
-rw-r--r-- | src/client/views/nodes/chatbot/types/types.ts | 6 |
4 files changed, 37 insertions, 48 deletions
diff --git a/package-lock.json b/package-lock.json index c935fef59..68611f50a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -201,7 +201,7 @@ "prosemirror-view": "^1.32.5", "pug": "^3.0.2", "puppeteer": "^24.1.1", - "query-string": "^7.1.3", + "query-string": "^9.1.1", "querystring-es3": "^0.2.1", "raw-loader": "^4.0.2", "rc-switch": "^4.1.0", @@ -19675,12 +19675,12 @@ } }, "node_modules/decode-uri-component": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", - "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.4.1.tgz", + "integrity": "sha512-+8VxcR21HhTy8nOt6jf20w0c9CADrw1O8d+VZ/YzzCt4bJ3uBjw+D1q2osAB8RnpwwaeYBxy0HyKQxD5JBMuuQ==", "license": "MIT", "engines": { - "node": ">=0.10" + "node": ">=14.16" } }, "node_modules/decompress-response": { @@ -21778,12 +21778,15 @@ } }, "node_modules/filter-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz", - "integrity": "sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-5.1.0.tgz", + "integrity": "sha512-qWeTREPoT7I0bifpPUXtxkZJ1XJzxWtfoWWkdVGqa+eCr3SHW/Ocp89o8vLvbUuQnadybJpjOKu4V+RwO6sGng==", "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/finalhandler": { @@ -32943,18 +32946,17 @@ } }, "node_modules/query-string": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", - "integrity": "sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-9.1.1.tgz", + "integrity": "sha512-MWkCOVIcJP9QSKU52Ngow6bsAWAPlPK2MludXvcrS2bGZSl+T1qX9MZvRIkqUIkGLJquMJHWfsT6eRqUpp4aWg==", "license": "MIT", "dependencies": { - "decode-uri-component": "^0.2.2", - "filter-obj": "^1.1.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" + "decode-uri-component": "^0.4.1", + "filter-obj": "^5.1.0", + "split-on-first": "^3.0.0" }, "engines": { - "node": ">=6" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -36165,12 +36167,15 @@ "license": "BDS-3-Clause" }, "node_modules/split-on-first": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", - "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-3.0.0.tgz", + "integrity": "sha512-qxQJTx2ryR0Dw0ITYyekNQWpz6f8dGd7vffGNflQQ3Iqj9NJ6qiZ7ELpZsJ/QBhIVAiDfXdag3+Gp8RvWa62AA==", "license": "MIT", "engines": { - "node": ">=6" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/split-skip": { @@ -36381,15 +36386,6 @@ "bare-events": "^2.2.0" } }, - "node_modules/strict-uri-encode": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", - "integrity": "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", diff --git a/package.json b/package.json index a2e87f67f..a090ab9b2 100644 --- a/package.json +++ b/package.json @@ -285,7 +285,7 @@ "prosemirror-view": "^1.32.5", "pug": "^3.0.2", "puppeteer": "^24.1.1", - "query-string": "^7.1.3", + "query-string": "^9.1.1", "querystring-es3": "^0.2.1", "raw-loader": "^4.0.2", "rc-switch": "^4.1.0", diff --git a/src/client/util/History.ts b/src/client/util/History.ts index 0d0c056a4..cf156014d 100644 --- a/src/client/util/History.ts +++ b/src/client/util/History.ts @@ -1,10 +1,7 @@ /* eslint-disable no-use-before-define */ /* eslint-disable no-empty */ -/* eslint-disable no-continue */ -/* eslint-disable guard-for-in */ -/* eslint-disable no-restricted-syntax */ /* eslint-disable no-param-reassign */ -import * as qs from 'query-string'; +import queryString from 'query-string'; import { Doc } from '../../fields/Doc'; import { OmitKeys, ClientUtils } from '../../ClientUtils'; import { DocServer } from '../DocServer'; @@ -82,7 +79,7 @@ export namespace HistoryUtil { // } // } - const parsers: { [type: string]: (pathname: string[], opts: qs.ParsedQuery) => ParsedUrl | undefined } = {}; + const parsers: { [type: string]: (pathname: string[], opts: queryString.ParsedQuery) => ParsedUrl | undefined } = {}; const stringifiers: { [type: string]: (state: ParsedUrl) => string } = {}; type ParserValue = true | 'none' | 'json' | ((value: string) => string | null | (string | null)[]); @@ -91,8 +88,8 @@ export namespace HistoryUtil { [key: string]: ParserValue; }; - function addParser(type: string, requiredFields: Parser, optionalFields: Parser, customParser?: (pathname: string[], opts: qs.ParsedQuery, current: ParsedUrl) => ParsedUrl | null | undefined) { - function parse(parser: ParserValue, value: string | (string | null)[] | null | undefined) { + function addParser(type: string, requiredFields: Parser, optionalFields: Parser, customParser?: (pathname: string[], opts: queryString.ParsedQuery, current: ParsedUrl) => ParsedUrl | null | undefined) { + function parseValue(parser: ParserValue, value: string | (string | null)[] | null | undefined) { if (value === undefined || value === null) { return value; } @@ -112,7 +109,7 @@ export namespace HistoryUtil { return undefined; } const parser = requiredFields[required]; - const value = parse(parser, opts[required]); + const value = parseValue(parser, opts[required]); if (value !== null && value !== undefined) { current[required] = value; } @@ -122,7 +119,7 @@ export namespace HistoryUtil { continue; } const parser = optionalFields[opt]; - const value = parse(parser, opts[opt]); + const value = parseValue(parser, opts[opt]); if (value !== undefined) { current[opt] = value; } @@ -152,8 +149,8 @@ export namespace HistoryUtil { Object.keys(queryObj).forEach(key => { query[key] = queryObj[key] === null ? null : JSON.stringify(queryObj[key]); }); - const queryString = qs.stringify(query); - return path + (queryString ? `?${queryString}` : ''); + const qstr = queryString.stringify(query); + return path + (queryString ? `?${qstr}` : ''); }; } @@ -170,7 +167,7 @@ export namespace HistoryUtil { export function parseUrl(location: Location | URL): ParsedUrl | undefined { const pathname = location.pathname.substring(1); const { search } = location; - const opts = search.length ? qs.parse(search, { sort: false }) : {}; + const opts = search.length ? queryString.parse(search, { sort: false }) : {}; const pathnameSplit = pathname.split('/'); const type = pathnameSplit[0]; diff --git a/src/client/views/nodes/chatbot/types/types.ts b/src/client/views/nodes/chatbot/types/types.ts index 995ac531d..882e74ebb 100644 --- a/src/client/views/nodes/chatbot/types/types.ts +++ b/src/client/views/nodes/chatbot/types/types.ts @@ -1,6 +1,3 @@ -import { indexes } from 'd3'; -import { AnyLayer } from 'react-map-gl'; - export enum ASSISTANT_ROLE { USER = 'user', ASSISTANT = 'assistant', @@ -122,9 +119,8 @@ export interface AI_Document { type: string; } +export type Observation = { type: 'text'; text: string } | { type: 'image_url'; image_url: { url: string } }; export interface AgentMessage { role: 'system' | 'user' | 'assistant'; content: string | Observation[]; } - -export type Observation = { type: 'text'; text: string } | { type: 'image_url'; image_url: { url: string } }; |