Merge pull request #3597 from continuedev/dallin/gui-strict-null-checks
GUI strict null checks
This commit is contained in:
commit
a0d0bdaacb
52 changed files with 424 additions and 645 deletions
|
|
@ -421,7 +421,6 @@ export class Core {
|
|||
|
||||
const chunk = next.value;
|
||||
|
||||
// @ts-ignore
|
||||
yield { content: chunk };
|
||||
next = await gen.next();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,26 @@ import type {
|
|||
} from "../";
|
||||
import { ConfigResult } from "../config/load";
|
||||
|
||||
export type ProtocolGeneratorType<T> = AsyncGenerator<{
|
||||
export type ProtocolGeneratorYield<T> = {
|
||||
done?: boolean;
|
||||
content: T;
|
||||
}>;
|
||||
};
|
||||
export type ProtocolGeneratorType<Y> = AsyncGenerator<
|
||||
ProtocolGeneratorYield<Y>
|
||||
>;
|
||||
|
||||
export type AsyncGeneratorYieldType<T> =
|
||||
T extends AsyncGenerator<infer Y, any, any>
|
||||
? Y extends ProtocolGeneratorYield<infer PR>
|
||||
? PR
|
||||
: never
|
||||
: never;
|
||||
// export type AsyncGeneratorReturnType<T> =
|
||||
// T extends AsyncGenerator<any, infer R, any>
|
||||
// ? R extends ProtocolGeneratorYield<infer PR>
|
||||
// ? PR
|
||||
// : never
|
||||
// : never;
|
||||
|
||||
export type OnboardingModes =
|
||||
| "Local"
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
|
|||
vscMediaUrl: string;
|
||||
},
|
||||
];
|
||||
"jetbrains/getColors": [undefined, void];
|
||||
"jetbrains/getColors": [undefined, Record<string, string>];
|
||||
"vscode/openMoveRightMarkdown": [undefined, void];
|
||||
setGitHubAuthToken: [{ token: string }, void];
|
||||
acceptDiff: [{ filepath: string; streamId?: string }, void];
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.248",
|
||||
"version": "0.9.250",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.248",
|
||||
"version": "0.9.250",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/fetch": "^1.0.3",
|
||||
|
|
|
|||
|
|
@ -1,23 +1,16 @@
|
|||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"strict-null-checks",
|
||||
"eslint-plugin-react"
|
||||
],
|
||||
"plugins": ["@typescript-eslint", "eslint-plugin-react"],
|
||||
"parserOptions": {
|
||||
"project": "gui/tsconfig.strictNullChecks.json"
|
||||
},
|
||||
// "extends": [
|
||||
// "eslint:recommended",
|
||||
// "plugin:@typescript-eslint/recommended",
|
||||
// "plugin:@typescript-eslint/recommended-requiring-type-checking"
|
||||
// "plugin:react/recommended"
|
||||
// ],
|
||||
"rules": {
|
||||
"strict-null-checks/all": "warn"
|
||||
"project": "gui/tsconfig.json"
|
||||
},
|
||||
"extends": [
|
||||
// "eslint:recommended",
|
||||
// "plugin:@typescript-eslint/recommended",
|
||||
// "plugin:@typescript-eslint/recommended-requiring-type-checking"
|
||||
// "plugin:react/recommended"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["src/**/*.{js,ts,jsx,tsx}"]
|
||||
|
|
|
|||
372
gui/package-lock.json
generated
372
gui/package-lock.json
generated
|
|
@ -24,6 +24,7 @@
|
|||
"@tiptap/react": "^2.1.13",
|
||||
"@tiptap/starter-kit": "^2.1.13",
|
||||
"@tiptap/suggestion": "^2.1.13",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@types/vscode-webview": "^1.57.1",
|
||||
"core": "file:../core",
|
||||
"dompurify": "^3.0.6",
|
||||
|
|
@ -70,6 +71,7 @@
|
|||
"@testing-library/jest-dom": "^6.5.0",
|
||||
"@testing-library/react": "^16.0.1",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@types/dompurify": "^3.2.0",
|
||||
"@types/lodash": "^4.17.6",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/node": "^20.5.6",
|
||||
|
|
@ -85,7 +87,6 @@
|
|||
"autoprefixer": "^10.4.13",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-react": "^7.37.2",
|
||||
"eslint-plugin-strict-null-checks": "^0.1.3",
|
||||
"jsdom": "^25.0.1",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
|
|
@ -2894,6 +2895,16 @@
|
|||
"@types/ms": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/dompurify": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.2.0.tgz",
|
||||
"integrity": "sha512-Fgg31wv9QbLDA0SpTOXO3MaxySc4DKGLi8sna4/Utjo4r3ZRPdCt4UQee8BWr+Q5z21yifghREPJGYaEOEIACg==",
|
||||
"deprecated": "This is a stub types definition. dompurify provides its own type definitions, so you do not need this installed.",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"dompurify": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
|
||||
|
|
@ -2936,12 +2947,6 @@
|
|||
"integrity": "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
|
||||
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/katex": {
|
||||
"version": "0.16.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.7.tgz",
|
||||
|
|
@ -3062,12 +3067,6 @@
|
|||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz",
|
||||
"integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/styled-components": {
|
||||
"version": "5.1.34",
|
||||
"resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.34.tgz",
|
||||
|
|
@ -3089,6 +3088,11 @@
|
|||
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
|
||||
"integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg=="
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "10.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz",
|
||||
"integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ=="
|
||||
},
|
||||
"node_modules/@types/vscode-webview": {
|
||||
"version": "1.57.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode-webview/-/vscode-webview-1.57.5.tgz",
|
||||
|
|
@ -3602,15 +3606,6 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/array-union": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
|
||||
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/array.prototype.findlast": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz",
|
||||
|
|
@ -4671,18 +4666,6 @@
|
|||
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/dir-glob": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
|
||||
"integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"path-type": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/direction": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/direction/-/direction-1.0.4.tgz",
|
||||
|
|
@ -5151,262 +5134,6 @@
|
|||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-strict-null-checks/-/eslint-plugin-strict-null-checks-0.1.3.tgz",
|
||||
"integrity": "sha512-c0bByePJytPXxZF9jBH17UQO41aCK08zThIXcAO3EnkdLhqUqIr+LVMfPstrN/9dLNzh4YKIbkbRPhRXRnNfNQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
||||
"@typescript-eslint/experimental-utils": "^5.13.0",
|
||||
"@typescript-eslint/parser": "^5.13.0",
|
||||
"requireindex": "^1.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": ">=3.9.4"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz",
|
||||
"integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.4.0",
|
||||
"@typescript-eslint/scope-manager": "5.62.0",
|
||||
"@typescript-eslint/type-utils": "5.62.0",
|
||||
"@typescript-eslint/utils": "5.62.0",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.0",
|
||||
"natural-compare-lite": "^1.4.0",
|
||||
"semver": "^7.3.7",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/parser": "^5.0.0",
|
||||
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/experimental-utils": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.62.0.tgz",
|
||||
"integrity": "sha512-RTXpeB3eMkpoclG3ZHft6vG/Z30azNHuqY6wKPBHlVMZFuEvrtlEDe8gMqDb+SO+9hjC/pLekeSCryf9vMZlCw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/utils": "5.62.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/parser": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz",
|
||||
"integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "5.62.0",
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"@typescript-eslint/typescript-estree": "5.62.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz",
|
||||
"integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"@typescript-eslint/visitor-keys": "5.62.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz",
|
||||
"integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "5.62.0",
|
||||
"@typescript-eslint/utils": "5.62.0",
|
||||
"debug": "^4.3.4",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/types": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz",
|
||||
"integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz",
|
||||
"integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"@typescript-eslint/visitor-keys": "5.62.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
"semver": "^7.3.7",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/utils": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz",
|
||||
"integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@types/json-schema": "^7.0.9",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@typescript-eslint/scope-manager": "5.62.0",
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"@typescript-eslint/typescript-estree": "5.62.0",
|
||||
"eslint-scope": "^5.1.1",
|
||||
"semver": "^7.3.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz",
|
||||
"integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"eslint-visitor-keys": "^3.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/eslint-scope": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esrecurse": "^4.3.0",
|
||||
"estraverse": "^4.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/eslint-scope/node_modules/estraverse": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
|
||||
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-strict-null-checks/node_modules/eslint-visitor-keys": {
|
||||
"version": "3.4.3",
|
||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
|
||||
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-scope": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
|
||||
|
|
@ -6303,26 +6030,6 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/globby": {
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
|
||||
"integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"array-union": "^2.1.0",
|
||||
"dir-glob": "^3.0.1",
|
||||
"fast-glob": "^3.2.9",
|
||||
"ignore": "^5.2.0",
|
||||
"merge2": "^1.4.1",
|
||||
"slash": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
||||
|
|
@ -8916,12 +8623,6 @@
|
|||
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/natural-compare-lite": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz",
|
||||
"integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.18",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",
|
||||
|
|
@ -9331,15 +9032,6 @@
|
|||
"integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/path-type": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
|
||||
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/pathe": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
|
||||
|
|
@ -10875,15 +10567,6 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/requireindex": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.2.0.tgz",
|
||||
"integrity": "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.5"
|
||||
}
|
||||
},
|
||||
"node_modules/reselect": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
|
||||
|
|
@ -12094,27 +11777,6 @@
|
|||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
|
||||
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="
|
||||
},
|
||||
"node_modules/tsutils": {
|
||||
"version": "3.21.0",
|
||||
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz",
|
||||
"integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"tslib": "^1.8.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta"
|
||||
}
|
||||
},
|
||||
"node_modules/tsutils/node_modules/tslib": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/type-check": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
"@tiptap/react": "^2.1.13",
|
||||
"@tiptap/starter-kit": "^2.1.13",
|
||||
"@tiptap/suggestion": "^2.1.13",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@types/vscode-webview": "^1.57.1",
|
||||
"core": "file:../core",
|
||||
"dompurify": "^3.0.6",
|
||||
|
|
@ -78,6 +79,7 @@
|
|||
"@testing-library/jest-dom": "^6.5.0",
|
||||
"@testing-library/react": "^16.0.1",
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@types/dompurify": "^3.2.0",
|
||||
"@types/lodash": "^4.17.6",
|
||||
"@types/mustache": "^4.2.5",
|
||||
"@types/node": "^20.5.6",
|
||||
|
|
@ -93,7 +95,6 @@
|
|||
"autoprefixer": "^10.4.13",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-react": "^7.37.2",
|
||||
"eslint-plugin-strict-null-checks": "^0.1.3",
|
||||
"jsdom": "^25.0.1",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { useState } from "react";
|
||||
import styled from "styled-components";
|
||||
import { defaultBorderRadius, vscBackground, vscForeground } from ".";
|
||||
import { CheckIcon } from "@heroicons/react/24/outline";
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import FileIcon from "../FileIcon";
|
|||
import { useAppSelector } from "../../redux/hooks";
|
||||
|
||||
export interface AddFileComboboxProps {
|
||||
onSelect: (filepaths: string[]) => void;
|
||||
onEscape: () => void;
|
||||
onSelect: (filepaths: string[]) => void | Promise<void>;
|
||||
onEscape: () => void | Promise<void>;
|
||||
}
|
||||
|
||||
export default function AddFileCombobox({
|
||||
|
|
@ -50,7 +50,7 @@ export default function AddFileCombobox({
|
|||
value={selectedFiles}
|
||||
onChange={(files) => {
|
||||
setSelectedFiles(files);
|
||||
onSelect(files.map((file) => file.id));
|
||||
void onSelect(files.map((file) => file.id));
|
||||
buttonRef.current?.click();
|
||||
}}
|
||||
>
|
||||
|
|
@ -72,7 +72,7 @@ export default function AddFileCombobox({
|
|||
placeholder="Type to search files..."
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Escape" && !open) {
|
||||
onEscape();
|
||||
void onEscape();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { useContext, useState } from "react";
|
|||
import { useDispatch } from "react-redux";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import CodeToEditListItem from "./CodeToEditListItem";
|
||||
import type { CodeToEdit, RangeInFileWithContents } from "core";
|
||||
import type { CodeToEdit } from "core";
|
||||
import AddFileButton from "./AddFileButton";
|
||||
import AddFileCombobox from "./AddFileCombobox";
|
||||
import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline";
|
||||
|
|
@ -25,19 +25,19 @@ export default function CodeToEditCard() {
|
|||
? "Code to edit (1 item)"
|
||||
: `Code to edit (${codeToEdit.length} items)`;
|
||||
|
||||
function onDelete(rif: RangeInFileWithContents) {
|
||||
function onDelete(rif: CodeToEdit) {
|
||||
dispatch(removeCodeToEdit(rif));
|
||||
}
|
||||
|
||||
function onClickFilename(code: CodeToEdit) {
|
||||
async function onClickFilename(code: CodeToEdit) {
|
||||
if ("range" in code) {
|
||||
ideMessenger.ide.showLines(
|
||||
await ideMessenger.ide.showLines(
|
||||
code.filepath,
|
||||
code.range.start.line,
|
||||
code.range.end.line,
|
||||
);
|
||||
} else {
|
||||
ideMessenger.ide.openFile(code.filepath);
|
||||
await ideMessenger.ide.openFile(code.filepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -93,10 +93,10 @@ export default function CodeToEditCard() {
|
|||
/>
|
||||
</div>
|
||||
<XMarkIcon
|
||||
onClick={(e) => {
|
||||
onClick={() => {
|
||||
setShowAddFileCombobox(false);
|
||||
}}
|
||||
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground mb-2 h-3.5 w-3.5 cursor-pointer rounded-md rounded-sm p-0.5 hover:bg-opacity-20"
|
||||
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground mb-2 h-3.5 w-3.5 cursor-pointer rounded-sm p-0.5 hover:bg-opacity-20"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import {
|
|||
|
||||
export interface CodeToEditListItemProps {
|
||||
code: CodeToEdit;
|
||||
onDelete: (codeToEdit: CodeToEdit) => void;
|
||||
onClickFilename: (codeToEdit: CodeToEdit) => void;
|
||||
onDelete: (codeToEdit: CodeToEdit) => void | Promise<void>;
|
||||
onClickFilename: (codeToEdit: CodeToEdit) => void | Promise<void>;
|
||||
}
|
||||
|
||||
const NoPaddingWrapper = styled.div`
|
||||
|
|
@ -87,7 +87,7 @@ export default function CodeToEditListItem({
|
|||
className="flex-shrink-0 text-xs hover:underline"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onClickFilename(code);
|
||||
void onClickFilename(code);
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
|
|
@ -122,7 +122,7 @@ export default function CodeToEditListItem({
|
|||
<XMarkIcon
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onDelete(code);
|
||||
void onDelete(code);
|
||||
}}
|
||||
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-sm p-0.5 hover:bg-opacity-20"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
// @ts-ignore
|
||||
import DOMPurify from "dompurify";
|
||||
import { useMemo } from "react";
|
||||
import { themeIcons } from "seti-file-icons";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { CubeIcon } from "@heroicons/react/24/outline";
|
||||
import { DEFAULT_CHAT_MODEL_CONFIG } from "core/config/default";
|
||||
import { useContext, useState } from "react";
|
||||
import { FormEventHandler, useContext, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { Button, Input, InputSubtext, lightGray } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
|
|
@ -33,7 +33,7 @@ function BestExperienceConfigForm({
|
|||
const [autocompleteApiKey, setAutocompleteApiKey] = useState("");
|
||||
const [chatApiKey, setChatApiKey] = useState("");
|
||||
|
||||
async function handleSubmit(e) {
|
||||
const handleSubmit: FormEventHandler<HTMLFormElement> = async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const chatModelConfig = {
|
||||
|
|
@ -74,7 +74,7 @@ function BestExperienceConfigForm({
|
|||
}
|
||||
|
||||
onComplete();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit}>
|
||||
|
|
@ -83,7 +83,7 @@ function BestExperienceConfigForm({
|
|||
<div className="mb-1 flex flex-row justify-between gap-4 text-lg font-bold">
|
||||
<label className="text-lg font-bold">Chat model</label>
|
||||
<div
|
||||
className="flex hidden items-center justify-end text-xs font-semibold sm:flex"
|
||||
className="hidden items-center justify-end text-xs font-semibold sm:flex"
|
||||
style={{ color: lightGray }}
|
||||
>
|
||||
<CubeIcon className="mr-1 h-4 w-4 flex-shrink-0" />
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export default function EditActions({ index, item }: EditActionsProps) {
|
|||
// const isCurCheckpoint = Math.floor(index / 2) === curCheckpointIndex;
|
||||
const hasPendingApplies = pendingApplyStates.length > 0;
|
||||
|
||||
if (isStreaming) return;
|
||||
if (isStreaming) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@ export default function UndoAndRedoButtons() {
|
|||
const dispatch = useDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
const checkpoints = useAppSelector(
|
||||
(store) => store.session.history.at(-1).checkpoint,
|
||||
);
|
||||
const history = useAppSelector((store) => store.session.history);
|
||||
|
||||
const curCheckpointIndex = useAppSelector(
|
||||
(store) => store.session.curCheckpointIndex,
|
||||
|
|
@ -28,10 +26,13 @@ export default function UndoAndRedoButtons() {
|
|||
type === "undo" ? curCheckpointIndex - 1 : curCheckpointIndex + 1,
|
||||
);
|
||||
|
||||
const checkpoint = checkpoints[checkpointIndex];
|
||||
const checkpoint = history[checkpointIndex]?.checkpoint ?? {};
|
||||
|
||||
for (const [filepath, prevFileContent] of Object.entries(checkpoint)) {
|
||||
ideMessenger.post("overwriteFile", { filepath, prevFileContent });
|
||||
for (const [filepath, cachedFileContent] of Object.entries(checkpoint)) {
|
||||
ideMessenger.post("overwriteFile", {
|
||||
filepath,
|
||||
prevFileContent: cachedFileContent,
|
||||
});
|
||||
}
|
||||
|
||||
dispatch(setCurCheckpointIndex(checkpointIndex));
|
||||
|
|
|
|||
20
gui/src/components/mainInput/FillerExtension.tsx
Normal file
20
gui/src/components/mainInput/FillerExtension.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Node } from "@tiptap/core";
|
||||
|
||||
export const MockExtension = Node.create({
|
||||
name: "mockExtension",
|
||||
|
||||
addOptions() {
|
||||
return {
|
||||
enabled: false,
|
||||
};
|
||||
},
|
||||
addCommands() {
|
||||
return {};
|
||||
},
|
||||
addKeyboardShortcuts() {
|
||||
return {};
|
||||
},
|
||||
addProseMirrorPlugins() {
|
||||
return [];
|
||||
},
|
||||
});
|
||||
|
|
@ -6,10 +6,8 @@ import {
|
|||
import { WrenchScrewdriverIcon as WrenchScrewdriverIconSolid } from "@heroicons/react/24/solid";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import styled from "styled-components";
|
||||
import { defaultBorderRadius, lightGray, vscForeground } from "../..";
|
||||
import { lightGray, vscForeground } from "../..";
|
||||
import { toggleUseTools } from "../../../redux/slices/uiSlice";
|
||||
import { getFontSize } from "../../../util";
|
||||
import InfoHover from "../../InfoHover";
|
||||
import HoverItem from "./HoverItem";
|
||||
import ToolDropdownItem from "./ToolDropdownItem";
|
||||
|
|
|
|||
|
|
@ -66,11 +66,12 @@ const ICONS_FOR_DROPDOWN: { [key: string]: any } = {
|
|||
"/cmd": CommandLineIcon,
|
||||
};
|
||||
|
||||
export function getIconFromDropdownItem(id: string, type: ComboBoxItemType) {
|
||||
return (
|
||||
ICONS_FOR_DROPDOWN[id] ??
|
||||
(type === "contextProvider" ? AtSymbolIcon : BoltIcon)
|
||||
);
|
||||
export function getIconFromDropdownItem(
|
||||
id: string | undefined,
|
||||
type: ComboBoxItemType,
|
||||
) {
|
||||
const typeIcon = type === "contextProvider" ? AtSymbolIcon : BoltIcon;
|
||||
return id ? (ICONS_FOR_DROPDOWN[id] ?? typeIcon) : typeIcon;
|
||||
}
|
||||
|
||||
function DropdownIcon(props: { className?: string; item: ComboBoxItem }) {
|
||||
|
|
@ -238,7 +239,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
}
|
||||
}, [querySubmenuItem]);
|
||||
|
||||
const selectItem = (index) => {
|
||||
const selectItem = (index: number) => {
|
||||
const item = allItems[index];
|
||||
|
||||
if (item.type === "action" && item.action) {
|
||||
|
|
@ -251,7 +252,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
item.contextProvider?.type === "submenu"
|
||||
) {
|
||||
setSubMenuTitle(item.description);
|
||||
props.enterSubmenu(props.editor, item.id);
|
||||
if (item.id) {
|
||||
props.enterSubmenu?.(props.editor, item.id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +311,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
useEffect(() => setSelectedIndex(0), [allItems]);
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
onKeyDown: ({ event }) => {
|
||||
onKeyDown: ({ event }: { event: KeyboardEvent }) => {
|
||||
if (event.key === "ArrowUp") {
|
||||
upHandler();
|
||||
return true;
|
||||
|
|
@ -359,6 +362,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
ref={queryInputRef}
|
||||
placeholder={querySubmenuItem.description}
|
||||
onKeyDown={(e) => {
|
||||
if (!queryInputRef.current) {
|
||||
return;
|
||||
}
|
||||
if (e.key === "Enter") {
|
||||
if (e.shiftKey) {
|
||||
queryInputRef.current.innerText += "\n";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,13 @@ import Paragraph from "@tiptap/extension-paragraph";
|
|||
import Placeholder from "@tiptap/extension-placeholder";
|
||||
import Text from "@tiptap/extension-text";
|
||||
import { Plugin } from "@tiptap/pm/state";
|
||||
import { Editor, EditorContent, JSONContent, useEditor } from "@tiptap/react";
|
||||
import {
|
||||
AnyExtension,
|
||||
Editor,
|
||||
EditorContent,
|
||||
JSONContent,
|
||||
useEditor,
|
||||
} from "@tiptap/react";
|
||||
import { ContextProviderDescription, InputModifiers } from "core";
|
||||
import { rifWithContentsToContextItem } from "core/commands/util";
|
||||
import { modelSupportsImages } from "core/llm/autodetect";
|
||||
|
|
@ -71,6 +77,7 @@ import {
|
|||
handleVSCMetaKeyIssues,
|
||||
} from "./handleMetaKeyIssues";
|
||||
import { ComboBoxItem } from "./types";
|
||||
import { MockExtension } from "./FillerExtension";
|
||||
|
||||
const InputBoxDiv = styled.div<{ border?: string }>`
|
||||
resize: none;
|
||||
|
|
@ -301,7 +308,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
|
||||
const { prevRef, nextRef, addRef } = useInputHistory(props.historyKey);
|
||||
|
||||
const editor: Editor = useEditor({
|
||||
const editor: Editor | null = useEditor({
|
||||
extensions: [
|
||||
Document,
|
||||
History,
|
||||
|
|
@ -392,6 +399,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
if (isStreamingRef.current) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
"Shift-Enter": () =>
|
||||
this.editor.commands.first(({ commands }) => [
|
||||
|
|
@ -417,6 +425,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
}, 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
Escape: () => {
|
||||
if (inDropdownRef.current || !isInEditModeRef.current) {
|
||||
|
|
@ -449,6 +458,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
}, 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
@ -530,7 +540,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
return props.node.attrs.label;
|
||||
},
|
||||
})
|
||||
: undefined,
|
||||
: MockExtension,
|
||||
CodeBlockExtension,
|
||||
],
|
||||
editorProps: {
|
||||
|
|
@ -562,6 +572,9 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
const placeholder = getPlaceholderText(
|
||||
props.placeholder,
|
||||
historyLengthRef.current,
|
||||
|
|
@ -576,9 +589,9 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
|
||||
useEffect(() => {
|
||||
if (props.isMainInput) {
|
||||
editor.commands.clearContent(true);
|
||||
editor?.commands.clearContent(true);
|
||||
}
|
||||
}, [isInEditMode, props.isMainInput]);
|
||||
}, [editor, isInEditMode, props.isMainInput]);
|
||||
|
||||
useEffect(() => {
|
||||
if (editor) {
|
||||
|
|
@ -615,6 +628,10 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
* with those key actions.
|
||||
*/
|
||||
const handleKeyDown = async (e: KeyboardEvent<HTMLDivElement>) => {
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
|
||||
setActiveKey(e.key);
|
||||
|
||||
if (!editorFocusedRef?.current || !isMetaEquivalentKeyPressed(e)) return;
|
||||
|
|
@ -632,6 +649,9 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
|
||||
const onEnterRef = useUpdatingRef(
|
||||
(modifiers: InputModifiers) => {
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
if (isStreaming || isEditModeAndNoCodeToEdit) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -659,7 +679,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
* commands are redundant, especially the ones inside
|
||||
* useTimeout.
|
||||
*/
|
||||
editor.commands.focus();
|
||||
editor?.commands.focus();
|
||||
}
|
||||
}, [props.isMainInput, editor]);
|
||||
|
||||
|
|
@ -679,7 +699,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
return;
|
||||
}
|
||||
queueMicrotask(() => {
|
||||
editor.commands.setContent(mainInputContentTrigger);
|
||||
editor?.commands.setContent(mainInputContentTrigger);
|
||||
});
|
||||
dispatch(setMainEditorContentTrigger(undefined));
|
||||
}, [editor, props.isMainInput, mainInputContentTrigger]);
|
||||
|
|
@ -852,7 +872,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
useWebviewListener(
|
||||
"isContinueInputFocused",
|
||||
async () => {
|
||||
return props.isMainInput && editorFocusedRef.current;
|
||||
return props.isMainInput && !!editorFocusedRef.current;
|
||||
},
|
||||
[editorFocusedRef, props.isMainInput],
|
||||
!props.isMainInput,
|
||||
|
|
@ -902,6 +922,9 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
|
||||
const insertCharacterWithWhitespace = useCallback(
|
||||
(char: string) => {
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
const text = editor.getText();
|
||||
if (!text.endsWith(char)) {
|
||||
if (text.length > 0 && !text.endsWith(" ")) {
|
||||
|
|
@ -921,7 +944,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
onKeyUp={handleKeyUp}
|
||||
className="cursor-text"
|
||||
onClick={() => {
|
||||
editor && editor.commands.focus();
|
||||
editor?.commands.focus();
|
||||
}}
|
||||
onDragOver={(event) => {
|
||||
event.preventDefault();
|
||||
|
|
@ -941,6 +964,7 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
}}
|
||||
onDrop={(event) => {
|
||||
if (
|
||||
!defaultModel ||
|
||||
!modelSupportsImages(
|
||||
defaultModel.provider,
|
||||
defaultModel.model,
|
||||
|
|
@ -952,11 +976,17 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
}
|
||||
setShowDragOverMsg(false);
|
||||
let file = event.dataTransfer.files[0];
|
||||
handleImageFile(file).then(([img, dataUrl]) => {
|
||||
const { schema } = editor.state;
|
||||
const node = schema.nodes.image.create({ src: dataUrl });
|
||||
const tr = editor.state.tr.insert(0, node);
|
||||
editor.view.dispatch(tr);
|
||||
handleImageFile(file).then((result) => {
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
if (result) {
|
||||
const [_, dataUrl] = result;
|
||||
const { schema } = editor.state;
|
||||
const node = schema.nodes.image.create({ src: dataUrl });
|
||||
const tr = editor.state.tr.insert(0, node);
|
||||
editor.view.dispatch(tr);
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
}}
|
||||
|
|
@ -977,13 +1007,19 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
onAddSlashCommand={() => insertCharacterWithWhitespace("/")}
|
||||
onEnter={onEnterRef.current}
|
||||
onImageFileSelected={(file) => {
|
||||
handleImageFile(file).then(([img, dataUrl]) => {
|
||||
const { schema } = editor.state;
|
||||
const node = schema.nodes.image.create({ src: dataUrl });
|
||||
editor.commands.command(({ tr }) => {
|
||||
tr.insert(0, node);
|
||||
return true;
|
||||
});
|
||||
handleImageFile(file).then((result) => {
|
||||
if (!editor) {
|
||||
return;
|
||||
}
|
||||
if (result) {
|
||||
const [_, dataUrl] = result;
|
||||
const { schema } = editor.state;
|
||||
const node = schema.nodes.image.create({ src: dataUrl });
|
||||
editor.commands.command(({ tr }) => {
|
||||
tr.insert(0, node);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
});
|
||||
}}
|
||||
disabled={isStreaming}
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ async function resolveEditorContent({
|
|||
let contextItems: ContextItemWithId[] = [];
|
||||
for (const item of contextItemAttrs) {
|
||||
const result = await ideMessenger.request("context/getContextItems", {
|
||||
name: item.itemType === "contextProvider" ? item.id : item.itemType,
|
||||
query: item.query,
|
||||
name: item.itemType === "contextProvider" ? item.id : item.itemType!,
|
||||
query: item.query ?? "",
|
||||
fullInput: stripImages(parts),
|
||||
selectedCode,
|
||||
selectedModelTitle,
|
||||
|
|
@ -211,22 +211,22 @@ function resolveParagraph(
|
|||
p: JSONContent,
|
||||
): [string, MentionAttrs[], string | undefined] {
|
||||
let text = "";
|
||||
const contextItems = [];
|
||||
const contextItems: MentionAttrs[] = [];
|
||||
let slashCommand: string | undefined = undefined;
|
||||
for (const child of p.content || []) {
|
||||
if (child.type === "text") {
|
||||
text += text === "" ? child.text.trimStart() : child.text;
|
||||
text += text === "" ? child.text?.trimStart() : child.text;
|
||||
} else if (child.type === "mention") {
|
||||
text +=
|
||||
typeof child.attrs.renderInlineAs === "string"
|
||||
typeof child.attrs?.renderInlineAs === "string"
|
||||
? child.attrs.renderInlineAs
|
||||
: child.attrs.label;
|
||||
contextItems.push(child.attrs);
|
||||
: child.attrs?.label;
|
||||
contextItems.push(child.attrs as MentionAttrs);
|
||||
} else if (child.type === "slashcommand") {
|
||||
if (typeof slashCommand === "undefined") {
|
||||
slashCommand = child.attrs.id;
|
||||
slashCommand = child.attrs?.id;
|
||||
} else {
|
||||
text += child.attrs.label;
|
||||
text += child.attrs?.label;
|
||||
}
|
||||
} else {
|
||||
console.warn("Unexpected child type", child.type);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ const InnerHoverDiv = styled.div<{ isBottomToolbarPosition: boolean }>`
|
|||
`;
|
||||
|
||||
interface StepContainerPreActionButtonsProps {
|
||||
language: string;
|
||||
language: string | null;
|
||||
codeBlockContent: string;
|
||||
codeBlockIndex: number;
|
||||
children: any;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ const ToolbarDiv = styled.div<{ isExpanded: boolean }>`
|
|||
|
||||
export interface StepContainerPreToolbarProps {
|
||||
codeBlockContent: string;
|
||||
language: string;
|
||||
language: string | null;
|
||||
relativeFilepath: string;
|
||||
isGeneratingCodeBlock: boolean;
|
||||
codeBlockIndex: number; // To track which codeblock we are applying
|
||||
|
|
@ -98,7 +98,6 @@ export default function StepContainerPreToolbar(
|
|||
props.relativeFilepath,
|
||||
ideMessenger.ide,
|
||||
);
|
||||
console.log("HERE", props.relativeFilepath, fileUri);
|
||||
|
||||
ideMessenger.post("applyToFile", {
|
||||
streamId: streamIdRef.current,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useMemo } from "react";
|
||||
import { ReactNode, useMemo } from "react";
|
||||
import { Tooltip } from "react-tooltip";
|
||||
import { lightGray, vscForeground } from "../..";
|
||||
import styled from "styled-components";
|
||||
|
|
@ -19,11 +19,18 @@ export const ToolbarButton = styled.button`
|
|||
filter: brightness(1.25);
|
||||
}
|
||||
`;
|
||||
|
||||
interface ToolbarButtonWithTooltipProps {
|
||||
onClick: () => void;
|
||||
children: ReactNode;
|
||||
tooltipContent: string;
|
||||
}
|
||||
|
||||
export function ToolbarButtonWithTooltip({
|
||||
onClick,
|
||||
children,
|
||||
tooltipContent,
|
||||
}) {
|
||||
}: ToolbarButtonWithTooltipProps) {
|
||||
const tooltipId = useMemo(
|
||||
() => `tooltip-${Math.random().toString(36).slice(2, 11)}`,
|
||||
[],
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
|
|||
],
|
||||
rehypeReactOptions: {
|
||||
components: {
|
||||
a: ({ node, ...aProps }) => {
|
||||
a: ({ ...aProps }) => {
|
||||
const tooltipId = uuidv4();
|
||||
|
||||
return (
|
||||
|
|
@ -247,7 +247,7 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
|
|||
</>
|
||||
);
|
||||
},
|
||||
pre: ({ node, ...preProps }) => {
|
||||
pre: ({ ...preProps }) => {
|
||||
const codeBlockIndex = preProps["data-codeblockindex"];
|
||||
|
||||
const preChildProps = preProps?.children?.[0]?.props ?? {};
|
||||
|
|
@ -293,7 +293,7 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
|
|||
</StepContainerPreToolbar>
|
||||
);
|
||||
},
|
||||
code: ({ node, ...codeProps }) => {
|
||||
code: ({ ...codeProps }) => {
|
||||
const content = getCodeChildrenContent(codeProps.children);
|
||||
|
||||
if (content && previousFileContextItemsRef.current) {
|
||||
|
|
|
|||
|
|
@ -26,18 +26,18 @@ export function getTerminalCommand(text: string): string {
|
|||
}
|
||||
|
||||
export function isTerminalCodeBlock(
|
||||
language: string | undefined,
|
||||
language: string | undefined | null,
|
||||
text: string,
|
||||
) {
|
||||
return (
|
||||
terminalLanguages.includes(language) ||
|
||||
(language && terminalLanguages.includes(language)) ||
|
||||
((!language || language?.length === 0) &&
|
||||
(text.trim().split("\n").length === 1 ||
|
||||
commonTerminalCommands.some((c) => text.trim().startsWith(c))))
|
||||
);
|
||||
}
|
||||
|
||||
function childToText(child: any) {
|
||||
function childToText(child: any): string {
|
||||
if (typeof child === "string") {
|
||||
return child;
|
||||
} else if (child?.props) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
PlusIcon,
|
||||
TrashIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useContext, useEffect, useRef, useState } from "react";
|
||||
import { MouseEvent, useContext, useEffect, useRef, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
|
|
@ -144,7 +144,7 @@ function ModelOption({
|
|||
const dispatch = useDispatch();
|
||||
const [hovered, setHovered] = useState(false);
|
||||
|
||||
function onClickDelete(e) {
|
||||
function onClickDelete(e: MouseEvent) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ function ModelOption({
|
|||
);
|
||||
}
|
||||
|
||||
function onClickGear(e) {
|
||||
function onClickGear(e: MouseEvent) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ function ModelOption({
|
|||
});
|
||||
}
|
||||
|
||||
function handleOptionClick(e) {
|
||||
function handleOptionClick(e: MouseEvent) {
|
||||
if (showMissingApiKeyMsg) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
|
@ -287,7 +287,7 @@ function ModelSelect() {
|
|||
setShowAbove(spaceBelow < dropdownHeight && spaceAbove > spaceBelow);
|
||||
}
|
||||
|
||||
function onClickAddModel(e) {
|
||||
function onClickAddModel(e: MouseEvent) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,11 @@ import {
|
|||
vscListActiveBackground,
|
||||
vscListActiveForeground,
|
||||
} from "..";
|
||||
import { providers } from "../../pages/AddNewModel/configs/providers";
|
||||
import {
|
||||
DisplayInfo,
|
||||
ModelPackage,
|
||||
} from "../../pages/AddNewModel/configs/models";
|
||||
import { ProviderInfo } from "../../pages/AddNewModel/configs/providers";
|
||||
|
||||
export const StyledListbox = styled(Listbox)`
|
||||
background-color: ${vscBackground};
|
||||
|
|
@ -98,14 +102,9 @@ export const StyledListboxOption = styled(Listbox.Option)<{
|
|||
}
|
||||
`;
|
||||
|
||||
interface DisplayInfo {
|
||||
title: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
interface ModelSelectionListboxProps {
|
||||
selectedProvider: DisplayInfo;
|
||||
setSelectedProvider: Dispatch<SetStateAction<DisplayInfo>>;
|
||||
setSelectedProvider: (val: DisplayInfo) => void;
|
||||
topOptions?: DisplayInfo[];
|
||||
otherOptions?: DisplayInfo[];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ import { createContext } from "react";
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import "vscode-webview";
|
||||
import { isJetBrains } from "../util";
|
||||
import {
|
||||
AsyncGeneratorYieldType,
|
||||
ProtocolGeneratorYield,
|
||||
} from "core/protocol/core";
|
||||
|
||||
interface vscode {
|
||||
postMessage(message: any): vscode;
|
||||
|
|
@ -164,24 +168,28 @@ export class IdeMessenger implements IIdeMessenger {
|
|||
messageType: T,
|
||||
data: FromWebviewProtocol[T][0],
|
||||
cancelToken?: AbortSignal,
|
||||
): AsyncGenerator<unknown[]> {
|
||||
// ): FromWebviewProtocol[T][1] {
|
||||
): AsyncGenerator<AsyncGeneratorYieldType<FromWebviewProtocol[T][1]>[], any> {
|
||||
type GenYield = AsyncGeneratorYieldType<FromWebviewProtocol[T][1]>;
|
||||
// type GenReturn = AsyncGeneratorReturnType<FromWebviewProtocol[T][1]>;
|
||||
|
||||
const messageId = uuidv4();
|
||||
|
||||
this.post(messageType, data, messageId);
|
||||
|
||||
const buffer: any[] = [];
|
||||
const buffer: GenYield[] = [];
|
||||
let index = 0;
|
||||
let done = false;
|
||||
let returnVal = undefined;
|
||||
|
||||
const handler = (event: { data: Message }) => {
|
||||
const handler = (event: {
|
||||
data: Message<ProtocolGeneratorYield<GenYield>>;
|
||||
}) => {
|
||||
if (event.data.messageId === messageId) {
|
||||
const responseData = event.data.data;
|
||||
if (responseData.done) {
|
||||
window.removeEventListener("message", handler);
|
||||
done = true;
|
||||
returnVal = responseData;
|
||||
returnVal = responseData.content;
|
||||
} else {
|
||||
buffer.push(responseData.content);
|
||||
}
|
||||
|
|
@ -239,8 +247,8 @@ export class IdeMessenger implements IIdeMessenger {
|
|||
next = await gen.next();
|
||||
}
|
||||
|
||||
if (next.value.error) {
|
||||
throw new Error(next.value.error);
|
||||
if (!next.done) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ export const SubmenuContextProvidersProvider = ({
|
|||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [autoLoadTriggered, setAutoLoadTriggered] = useState(false);
|
||||
|
||||
const config = useAppSelector((store) => store.config.config);
|
||||
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
const getOpenFilesItems = useCallback(async () => {
|
||||
|
|
@ -102,7 +100,7 @@ export const SubmenuContextProvidersProvider = ({
|
|||
}));
|
||||
}, [ideMessenger]);
|
||||
|
||||
useWebviewListener("refreshSubmenuItems", async (data) => {
|
||||
useWebviewListener("refreshSubmenuItems", async () => {
|
||||
if (!isLoading) {
|
||||
setInitialLoadComplete(false);
|
||||
setAutoLoadTriggered((prev) => !prev); // Toggle to trigger effect
|
||||
|
|
@ -146,7 +144,9 @@ export const SubmenuContextProvidersProvider = ({
|
|||
[minisearches],
|
||||
);
|
||||
|
||||
const lastOpenFilesRef = useRef([]);
|
||||
const lastOpenFilesRef = useRef<
|
||||
Awaited<ReturnType<typeof getOpenFilesItems>>
|
||||
>([]);
|
||||
useEffect(() => {
|
||||
let isMounted = true;
|
||||
const refreshOpenFiles = async () => {
|
||||
|
|
@ -216,12 +216,14 @@ export const SubmenuContextProvidersProvider = ({
|
|||
try {
|
||||
const results = getSubmenuSearchResults(providerTitle, query);
|
||||
if (results.length === 0) {
|
||||
const fallbackItems = (fallbackResults[providerTitle] ?? [])
|
||||
const fallbackItems = (
|
||||
providerTitle ? (fallbackResults[providerTitle] ?? []) : []
|
||||
)
|
||||
.slice(0, limit)
|
||||
.map((result) => {
|
||||
return {
|
||||
...result,
|
||||
providerTitle,
|
||||
providerTitle: providerTitle || "unknown",
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ function constructTheme(
|
|||
): Record<string, string> {
|
||||
const rules = tmTheme?.["rules"] || [];
|
||||
|
||||
const tokenToForeground = {};
|
||||
const tokenToForeground: Record<string, string> = {};
|
||||
rules.forEach(({ token, foreground }) => {
|
||||
if (!foreground || !token) {
|
||||
return;
|
||||
|
|
@ -66,7 +66,7 @@ function constructTheme(
|
|||
tokenToForeground[token] = foreground;
|
||||
});
|
||||
|
||||
const theme = {};
|
||||
const theme: Record<string, string> = {};
|
||||
Object.keys(hljsToTextMate).forEach((className) => {
|
||||
const tokens = hljsToTextMate[className];
|
||||
for (const scope of tokens) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import {
|
|||
import { FREE_TRIAL_LIMIT_REQUESTS, hasPassedFTL } from "../util/freeTrial";
|
||||
import { completionParamsInputs } from "../pages/AddNewModel/configs/completionParamsInputs";
|
||||
import { setDefaultModel } from "../redux/slices/configSlice";
|
||||
import { DisplayInfo } from "../pages/AddNewModel/configs/models";
|
||||
|
||||
interface QuickModelSetupProps {
|
||||
onDone: () => void;
|
||||
|
|
@ -52,7 +53,9 @@ function AddModelForm({
|
|||
|
||||
const allProviders = Object.entries(providers)
|
||||
.filter(([key]) => !["freetrial", "openai-aiohttp"].includes(key))
|
||||
.map(([, provider]) => provider);
|
||||
.map(([, provider]) => provider)
|
||||
.filter((provider) => !!provider)
|
||||
.map((provider) => provider!); // for type checking
|
||||
|
||||
const popularProviders = allProviders
|
||||
.filter((provider) => popularProviderTitles.includes(provider.title))
|
||||
|
|
@ -77,13 +80,13 @@ function AddModelForm({
|
|||
}
|
||||
|
||||
const required = selectedProvider.collectInputFor
|
||||
.filter((input) => input.required)
|
||||
?.filter((input) => input.required)
|
||||
.map((input) => {
|
||||
const value = formMethods.watch(input.key);
|
||||
return value;
|
||||
});
|
||||
|
||||
return !required.every((value) => value !== undefined && value.length > 0);
|
||||
return !required?.every((value) => value !== undefined && value.length > 0);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -93,8 +96,8 @@ function AddModelForm({
|
|||
function onSubmit() {
|
||||
const apiKey = formMethods.watch("apiKey");
|
||||
const hasValidApiKey = apiKey !== undefined && apiKey !== "";
|
||||
const reqInputFields = {};
|
||||
for (let input of selectedProvider.collectInputFor) {
|
||||
const reqInputFields: Record<string, any> = {};
|
||||
for (let input of selectedProvider.collectInputFor ?? []) {
|
||||
reqInputFields[input.key] = formMethods.watch(input.key);
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +150,14 @@ function AddModelForm({
|
|||
<label className="block text-sm font-medium">Provider</label>
|
||||
<ModelSelectionListbox
|
||||
selectedProvider={selectedProvider}
|
||||
setSelectedProvider={setSelectedProvider}
|
||||
setSelectedProvider={(val: DisplayInfo) => {
|
||||
const match = [...popularProviders, ...otherProviders].find(
|
||||
(provider) => provider.title === val.title,
|
||||
);
|
||||
if (match) {
|
||||
setSelectedProvider(match);
|
||||
}
|
||||
}}
|
||||
topOptions={popularProviders}
|
||||
otherOptions={otherProviders}
|
||||
/>
|
||||
|
|
@ -184,11 +194,24 @@ function AddModelForm({
|
|||
<label className="block text-sm font-medium">Model</label>
|
||||
<ModelSelectionListbox
|
||||
selectedProvider={selectedModel}
|
||||
setSelectedProvider={setSelectedModel}
|
||||
setSelectedProvider={(val: DisplayInfo) => {
|
||||
const options =
|
||||
Object.entries(providers).find(
|
||||
([, provider]) =>
|
||||
provider?.title === selectedProvider.title,
|
||||
)?.[1]?.packages ?? [];
|
||||
const match = options.find(
|
||||
(option) => option.title === val.title,
|
||||
);
|
||||
if (match) {
|
||||
setSelectedModel(match);
|
||||
}
|
||||
}}
|
||||
otherOptions={
|
||||
Object.entries(providers).find(
|
||||
([, provider]) => provider.title === selectedProvider.title,
|
||||
)?.[1].packages
|
||||
([, provider]) =>
|
||||
provider?.title === selectedProvider.title,
|
||||
)?.[1]?.packages
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -220,9 +243,14 @@ function AddModelForm({
|
|||
<InputSubtext className="mb-0">
|
||||
<a
|
||||
className="cursor-pointer text-inherit underline hover:text-inherit"
|
||||
onClick={() =>
|
||||
ideMessenger.post("openUrl", selectedProviderApiKeyUrl)
|
||||
}
|
||||
onClick={() => {
|
||||
if (selectedProviderApiKeyUrl) {
|
||||
ideMessenger.post(
|
||||
"openUrl",
|
||||
selectedProviderApiKeyUrl,
|
||||
);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Click here
|
||||
</a>{" "}
|
||||
|
|
|
|||
|
|
@ -119,10 +119,12 @@ function useSetup() {
|
|||
if (isJetBrains()) {
|
||||
// Save theme colors to local storage for immediate loading in JetBrains
|
||||
ideMessenger.request("jetbrains/getColors", undefined).then((result) => {
|
||||
Object.keys(result).forEach((key) => {
|
||||
document.body.style.setProperty(key, result[key]);
|
||||
document.documentElement.style.setProperty(key, result[key]);
|
||||
});
|
||||
if (result.status === "success") {
|
||||
Object.entries(result.content).forEach(([key, value]) => {
|
||||
document.body.style.setProperty(key, value);
|
||||
document.documentElement.style.setProperty(key, value);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Tell JetBrains the webview is ready
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ export function useWebviewListener<T extends keyof ToWebviewProtocol>(
|
|||
|
||||
useEffect(
|
||||
() => {
|
||||
let listener;
|
||||
let listener: (event: { data: Message<ToWebviewProtocol[T][0]>}) => Promise<void>;
|
||||
|
||||
if (!skip) {
|
||||
listener = async (event: { data: Message }) => {
|
||||
listener = async (event) => {
|
||||
if (event.data.messageType === messageType) {
|
||||
const result = await handler(event.data.data);
|
||||
ideMessenger.respond(messageType, result, event.data.messageId);
|
||||
|
|
|
|||
|
|
@ -122,22 +122,24 @@ function AddNewModel() {
|
|||
</div>
|
||||
|
||||
<GridDiv>
|
||||
{Object.entries(providers).map(([providerName, modelInfo], i) => (
|
||||
<ModelCard
|
||||
key={`${providerName}-${i}`}
|
||||
title={modelInfo.title}
|
||||
description={modelInfo.description}
|
||||
tags={modelInfo.tags}
|
||||
icon={modelInfo.icon}
|
||||
refUrl={`https://docs.continue.dev/reference/Model%20Providers/${
|
||||
modelInfo.refPage || modelInfo.provider.toLowerCase()
|
||||
}`}
|
||||
onClick={(e) => {
|
||||
console.log(`/addModel/provider/${providerName}`);
|
||||
navigate(`/addModel/provider/${providerName}`);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
{Object.entries(providers).map(([providerName, modelInfo], i) =>
|
||||
modelInfo ? (
|
||||
<ModelCard
|
||||
key={`${providerName}-${i}`}
|
||||
title={modelInfo.title}
|
||||
description={modelInfo.description}
|
||||
tags={modelInfo.tags}
|
||||
icon={modelInfo.icon}
|
||||
refUrl={`https://docs.continue.dev/reference/Model%20Providers/${
|
||||
modelInfo.refPage || modelInfo.provider.toLowerCase()
|
||||
}`}
|
||||
onClick={(e) => {
|
||||
console.log(`/addModel/provider/${providerName}`);
|
||||
navigate(`/addModel/provider/${providerName}`);
|
||||
}}
|
||||
/>
|
||||
) : null,
|
||||
)}
|
||||
</GridDiv>
|
||||
</>
|
||||
) : (
|
||||
|
|
@ -176,6 +178,9 @@ function AddNewModel() {
|
|||
dimensions={config.dimensions}
|
||||
providerOptions={config.providerOptions}
|
||||
onClick={(e, dimensionChoices, selectedProvider) => {
|
||||
if (!selectedProvider) {
|
||||
return;
|
||||
}
|
||||
const model = {
|
||||
...config.params,
|
||||
..._.merge(
|
||||
|
|
@ -187,7 +192,7 @@ function AddNewModel() {
|
|||
};
|
||||
}) || []),
|
||||
),
|
||||
provider: providers[selectedProvider].provider,
|
||||
provider: providers[selectedProvider]?.provider,
|
||||
};
|
||||
ideMessenger.post("config/addModel", { model });
|
||||
dispatch(
|
||||
|
|
|
|||
|
|
@ -9,6 +9,12 @@ export interface PackageDimension {
|
|||
description: string;
|
||||
options: { [key: string]: { [key: string]: any } };
|
||||
}
|
||||
|
||||
export interface DisplayInfo {
|
||||
title: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
export interface ModelPackage {
|
||||
title: string;
|
||||
icon?: string;
|
||||
|
|
@ -124,7 +130,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
"sambanova",
|
||||
"cerebras",
|
||||
"nebius",
|
||||
"scaleway"
|
||||
"scaleway",
|
||||
],
|
||||
isOpenSource: true,
|
||||
},
|
||||
|
|
@ -1139,8 +1145,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
},
|
||||
asksagegpt35gov: {
|
||||
title: "GPT-3.5-Turbo gov",
|
||||
description:
|
||||
"U.S. Government. Inexpensive and good ROI.",
|
||||
description: "U.S. Government. Inexpensive and good ROI.",
|
||||
params: {
|
||||
model: "gpt-gov",
|
||||
contextLength: 8096,
|
||||
|
|
@ -1176,7 +1181,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
contextLength: 8_192,
|
||||
title: "GPT-4",
|
||||
},
|
||||
providerOptions: ["openai",],
|
||||
providerOptions: ["openai"],
|
||||
icon: "openai.png",
|
||||
isOpenSource: false,
|
||||
},
|
||||
|
|
@ -1189,7 +1194,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
contextLength: 32_768,
|
||||
title: "GPT-4-32k",
|
||||
},
|
||||
providerOptions: ["openai",],
|
||||
providerOptions: ["openai"],
|
||||
icon: "openai.png",
|
||||
isOpenSource: false,
|
||||
},
|
||||
|
|
@ -1202,7 +1207,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
contextLength: 128_000,
|
||||
title: "GPT-o1",
|
||||
systemMessage:
|
||||
"You are an expert software developer. You give helpful and concise responses.",
|
||||
"You are an expert software developer. You give helpful and concise responses.",
|
||||
},
|
||||
providerOptions: ["askSage"],
|
||||
icon: "openai.png",
|
||||
|
|
@ -1217,7 +1222,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
contextLength: 128_000,
|
||||
title: "GPT-o1-mini",
|
||||
systemMessage:
|
||||
"You are an expert software developer. You give helpful and concise responses.",
|
||||
"You are an expert software developer. You give helpful and concise responses.",
|
||||
},
|
||||
providerOptions: ["askSage"],
|
||||
icon: "openai.png",
|
||||
|
|
@ -1232,7 +1237,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
contextLength: 200_000,
|
||||
title: "Claude 3.5 Sonnet gov",
|
||||
systemMessage:
|
||||
"You are an expert software developer. You give helpful and concise responses.",
|
||||
"You are an expert software developer. You give helpful and concise responses.",
|
||||
},
|
||||
providerOptions: ["askSage"],
|
||||
icon: "anthropic.png",
|
||||
|
|
@ -1240,8 +1245,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
},
|
||||
asksagegroqllama33: {
|
||||
title: "Llama 3.3",
|
||||
description:
|
||||
"Llama-3.3 is a large language model customized by Groq.",
|
||||
description: "Llama-3.3 is a large language model customized by Groq.",
|
||||
params: {
|
||||
title: "Llama 3.3",
|
||||
model: "groq-llama33",
|
||||
|
|
@ -1252,8 +1256,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
},
|
||||
asksagegroq70b: {
|
||||
title: "Groq-70B",
|
||||
description:
|
||||
"A large language model customized by Groq.",
|
||||
description: "A large language model customized by Groq.",
|
||||
params: {
|
||||
title: "Groq-70B",
|
||||
model: "groq-70b",
|
||||
|
|
@ -1298,7 +1301,7 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
},
|
||||
icon: "qwen.png",
|
||||
providerOptions: ["scaleway"],
|
||||
isOpenSource: true,
|
||||
isOpenSource: true,
|
||||
},
|
||||
grokBeta: {
|
||||
title: "Grok Beta",
|
||||
|
|
|
|||
|
|
@ -165,7 +165,8 @@ export const providers: Partial<Record<string, ProviderInfo>> = {
|
|||
title: "Scaleway",
|
||||
provider: "scaleway",
|
||||
refPage: "scaleway",
|
||||
description: "Use the Scaleway Generative APIs to instantly access leading open models",
|
||||
description:
|
||||
"Use the Scaleway Generative APIs to instantly access leading open models",
|
||||
longDescription: `Hosted in European data centers, ideal for developers requiring low latency, full data privacy, and compliance with EU AI Act. You can generate your API key in [Scaleway's console](https://console.scaleway.com/generative-api/models). Get started:\n1. Create an API key [here](https://console.scaleway.com/iam/api-keys/)\n2. Paste below\n3. Select a model preset`,
|
||||
params: {
|
||||
apiKey: "",
|
||||
|
|
|
|||
|
|
@ -407,9 +407,8 @@ export function Chat() {
|
|||
return (
|
||||
<div key={i}>
|
||||
<ToolCallDiv
|
||||
reactKey={toolCall.id}
|
||||
toolCallState={item.toolCallState}
|
||||
toolCall={toolCall as any}
|
||||
toolCallState={item.toolCallState!}
|
||||
toolCall={toolCall}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -44,15 +44,18 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
|
|||
let statusCode: undefined | number = undefined;
|
||||
|
||||
// Attempt to get error message and status code from error
|
||||
if (error && (error instanceof Error || typeof error === "object")) {
|
||||
if (error["message"]) {
|
||||
message = error["message"];
|
||||
const status = message?.split(" ")[0];
|
||||
if (status) {
|
||||
const code = Number(status);
|
||||
if (!Number.isNaN(statusCode)) {
|
||||
statusCode = code;
|
||||
}
|
||||
if (
|
||||
error &&
|
||||
(error instanceof Error || typeof error === "object") &&
|
||||
"message" in error &&
|
||||
typeof error["message"] === "string"
|
||||
) {
|
||||
message = error["message"];
|
||||
const status = message?.split(" ")[0];
|
||||
if (status) {
|
||||
const code = Number(status);
|
||||
if (!Number.isNaN(statusCode)) {
|
||||
statusCode = code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ToolCall, ToolCallState } from "core";
|
||||
import { ToolCall, ToolCallDelta, ToolCallState } from "core";
|
||||
import { CreateFile } from "./CreateFile";
|
||||
import { RunTerminalCommand } from "./RunTerminalCommand";
|
||||
|
||||
|
|
@ -6,12 +6,12 @@ function FunctionSpecificToolCallDiv({
|
|||
toolCall,
|
||||
toolCallState,
|
||||
}: {
|
||||
toolCall: ToolCall;
|
||||
toolCall: ToolCallDelta;
|
||||
toolCallState: ToolCallState;
|
||||
}) {
|
||||
const args = toolCallState.parsedArgs;
|
||||
|
||||
switch (toolCall.function.name) {
|
||||
switch (toolCall.function?.name) {
|
||||
case "builtin_create_new_file":
|
||||
return (
|
||||
<CreateFile
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Tool, ToolCall, ToolCallState } from "core";
|
||||
import { Tool, ToolCallDelta, ToolCallState } from "core";
|
||||
import Mustache from "mustache";
|
||||
import styled from "styled-components";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
|
|
@ -6,9 +6,8 @@ import { useAppSelector } from "../../../redux/hooks";
|
|||
interface ThreadDivProps {
|
||||
children: React.ReactNode;
|
||||
icon: React.ReactNode;
|
||||
toolCall: ToolCall;
|
||||
toolCall: ToolCallDelta;
|
||||
toolCallState: ToolCallState;
|
||||
reactKey: string;
|
||||
}
|
||||
|
||||
const Container = styled.div`
|
||||
|
|
@ -48,7 +47,7 @@ export function ThreadDiv(props: ThreadDivProps) {
|
|||
}
|
||||
|
||||
return (
|
||||
<Container key={props.reactKey}>
|
||||
<Container>
|
||||
<HeaderDiv>
|
||||
<div
|
||||
style={{
|
||||
|
|
@ -64,7 +63,7 @@ export function ThreadDiv(props: ThreadDivProps) {
|
|||
Continue wants to{" "}
|
||||
{renderWouldLikeToMessage(
|
||||
availableTools.find(
|
||||
(tool) => props.toolCall.function.name === tool.function.name,
|
||||
(tool) => props.toolCall.function?.name === tool.function.name,
|
||||
),
|
||||
props.toolCallState,
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -3,16 +3,15 @@ import {
|
|||
CheckIcon,
|
||||
XMarkIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { ToolCall, ToolCallState, ToolStatus } from "core";
|
||||
import { ToolCall, ToolCallDelta, ToolCallState, ToolStatus } from "core";
|
||||
import { vscButtonBackground } from "../../../components";
|
||||
import Spinner from "../../../components/gui/Spinner";
|
||||
import FunctionSpecificToolCallDiv from "./FunctionSpecificToolCallDiv";
|
||||
import { ThreadDiv } from "./ThreadDiv";
|
||||
|
||||
interface ToolCallDivProps {
|
||||
toolCall: ToolCall;
|
||||
toolCall: ToolCallDelta;
|
||||
toolCallState: ToolCallState;
|
||||
reactKey: string;
|
||||
}
|
||||
|
||||
export function ToolCallDiv(props: ToolCallDivProps) {
|
||||
|
|
@ -32,7 +31,6 @@ export function ToolCallDiv(props: ToolCallDivProps) {
|
|||
|
||||
return (
|
||||
<ThreadDiv
|
||||
reactKey={props.reactKey}
|
||||
icon={getIcon(props.toolCallState.status)}
|
||||
toolCall={props.toolCall}
|
||||
toolCallState={props.toolCallState}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ export const selectLastToolCall = createSelector(
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!lastToolCallHistoryItem) return null;
|
||||
return lastToolCallHistoryItem.toolCallState;
|
||||
return lastToolCallHistoryItem?.toolCallState ?? null;
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,10 @@ export const sessionSlice = createSlice({
|
|||
state.isStreaming = true;
|
||||
},
|
||||
setIsGatheringContext: (state, { payload }: PayloadAction<boolean>) => {
|
||||
state.history.at(-1).isGatheringContext = payload;
|
||||
const curMessage = state.history.at(-1);
|
||||
if (curMessage) {
|
||||
curMessage.isGatheringContext = payload;
|
||||
}
|
||||
},
|
||||
clearLastEmptyResponse: (state) => {
|
||||
if (state.history.length < 2) {
|
||||
|
|
@ -278,14 +281,14 @@ export const sessionSlice = createSlice({
|
|||
},
|
||||
streamUpdate: (state, action: PayloadAction<ChatMessage[]>) => {
|
||||
if (state.history.length) {
|
||||
const lastItem = state.history[state.history.length - 1];
|
||||
const lastMessage = lastItem.message;
|
||||
for (const message of action.payload) {
|
||||
const lastMessage = state.history[state.history.length - 1];
|
||||
|
||||
if (
|
||||
message.role &&
|
||||
(lastMessage.message.role !== message.role ||
|
||||
(lastMessage.role !== message.role ||
|
||||
// This is when a tool call comes after assistant text
|
||||
(lastMessage.message.content !== "" &&
|
||||
(lastMessage.content !== "" &&
|
||||
message.role === "assistant" &&
|
||||
message.toolCalls?.length))
|
||||
) {
|
||||
|
|
@ -297,51 +300,60 @@ export const sessionSlice = createSlice({
|
|||
},
|
||||
contextItems: [],
|
||||
};
|
||||
|
||||
if (message.role === "assistant" && message.toolCalls) {
|
||||
const [_, parsedArgs] = incrementalParseJson(
|
||||
message.toolCalls[0].function.arguments,
|
||||
);
|
||||
historyItem.toolCallState = {
|
||||
status: "generating",
|
||||
toolCall: message.toolCalls[0] as ToolCall,
|
||||
toolCallId: message.toolCalls[0].id,
|
||||
parsedArgs,
|
||||
};
|
||||
if (message.role === "assistant" && message.toolCalls?.[0]) {
|
||||
const toolCalls = message.toolCalls?.[0];
|
||||
if (toolCalls) {
|
||||
const [_, parsedArgs] = incrementalParseJson(
|
||||
message.toolCalls[0].function?.arguments ?? "{}",
|
||||
);
|
||||
historyItem.toolCallState = {
|
||||
status: "generating",
|
||||
toolCall: message.toolCalls[0] as ToolCall,
|
||||
toolCallId: message.toolCalls[0].id as ToolCall["id"],
|
||||
parsedArgs,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
state.history.push(historyItem);
|
||||
} else {
|
||||
// Add to the existing message
|
||||
const msg = state.history[state.history.length - 1].message;
|
||||
if (message.content) {
|
||||
msg.content += renderChatMessage(message);
|
||||
lastMessage.content += renderChatMessage(message);
|
||||
} else if (
|
||||
message.role === "assistant" &&
|
||||
message.toolCalls &&
|
||||
msg.role === "assistant"
|
||||
lastMessage.role === "assistant"
|
||||
) {
|
||||
if (!msg.toolCalls) {
|
||||
msg.toolCalls = [];
|
||||
if (!lastMessage.toolCalls) {
|
||||
lastMessage.toolCalls = [];
|
||||
}
|
||||
message.toolCalls.forEach((toolCall, i) => {
|
||||
if (msg.toolCalls.length <= i) {
|
||||
msg.toolCalls.push(toolCall);
|
||||
if (lastMessage.toolCalls!.length <= i) {
|
||||
lastMessage.toolCalls!.push(toolCall);
|
||||
} else {
|
||||
msg.toolCalls[i].function.arguments +=
|
||||
toolCall.function.arguments;
|
||||
if (
|
||||
toolCall?.function?.arguments &&
|
||||
lastMessage?.toolCalls?.[i]?.function?.arguments &&
|
||||
lastItem.toolCallState
|
||||
) {
|
||||
lastMessage.toolCalls[i].function!.arguments +=
|
||||
toolCall.function.arguments;
|
||||
|
||||
const [_, parsedArgs] = incrementalParseJson(
|
||||
msg.toolCalls[i].function.arguments,
|
||||
);
|
||||
const [_, parsedArgs] = incrementalParseJson(
|
||||
lastMessage.toolCalls[i].function!.arguments!,
|
||||
);
|
||||
|
||||
state.history[
|
||||
state.history.length - 1
|
||||
].toolCallState.parsedArgs = parsedArgs;
|
||||
state.history[
|
||||
state.history.length - 1
|
||||
].toolCallState.toolCall.function.arguments +=
|
||||
toolCall.function.arguments;
|
||||
lastItem.toolCallState.parsedArgs = parsedArgs;
|
||||
lastItem.toolCallState.toolCall.function.arguments +=
|
||||
toolCall.function.arguments;
|
||||
} else {
|
||||
console.error(
|
||||
"Unexpected tool call format received - this message added during gui strict null checks",
|
||||
message,
|
||||
lastMessage,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -472,8 +484,10 @@ export const sessionSlice = createSlice({
|
|||
state,
|
||||
{ payload }: PayloadAction<{ filepath: string; content: string }>,
|
||||
) => {
|
||||
state.history[state.curCheckpointIndex].checkpoint[payload.filepath] =
|
||||
payload.content;
|
||||
const checkpoint = state.history[state.curCheckpointIndex].checkpoint;
|
||||
if (checkpoint) {
|
||||
checkpoint[payload.filepath] = payload.content;
|
||||
}
|
||||
},
|
||||
updateApplyState: (state, { payload }: PayloadAction<ApplyState>) => {
|
||||
const applyState = state.codeBlockApplyStates.states.find(
|
||||
|
|
|
|||
|
|
@ -63,7 +63,10 @@ const persistConfig = {
|
|||
migrate: createMigrate(migrations, { debug: false }),
|
||||
};
|
||||
|
||||
const persistedReducer = persistReducer(persistConfig, rootReducer);
|
||||
const persistedReducer = persistReducer<ReturnType<typeof rootReducer>>(
|
||||
persistConfig,
|
||||
rootReducer,
|
||||
);
|
||||
|
||||
export function setupStore() {
|
||||
return configureStore({
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ export const callTool = createAsyncThunk<void, undefined, ThunkApiType>(
|
|||
const state = getState();
|
||||
const toolCallState = selectCurrentToolCall(state);
|
||||
|
||||
console.log("calling tool", toolCallState.toolCall);
|
||||
if (!toolCallState) {
|
||||
return;
|
||||
}
|
||||
console.log("calling tool", toolCallState.toolCall);
|
||||
|
||||
if (toolCallState.status !== "generated") {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,10 @@ export const gatherContext = createAsyncThunk<
|
|||
state.config.config.experimental?.defaultContext ?? [];
|
||||
|
||||
if (!state.config.defaultModelTitle) {
|
||||
console.error("Failed to gather context, no model selected");
|
||||
return;
|
||||
console.error(
|
||||
"gatherContext thunk: Cannot gather context, no model selected",
|
||||
);
|
||||
throw new Error("No chat model selected");
|
||||
}
|
||||
|
||||
// Resolve context providers and construct new history
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ export const saveCurrentSession = createAsyncThunk<
|
|||
}
|
||||
// Fallbacks if above doesn't work out or getChatTitles = false
|
||||
if (title === NEW_SESSION_TITLE) {
|
||||
title = getChatTitleFromMessage(history[0].message);
|
||||
title = getChatTitleFromMessage(state.session.history[0].message);
|
||||
}
|
||||
}
|
||||
// More fallbacks in case of no title
|
||||
|
|
|
|||
|
|
@ -32,18 +32,19 @@ export const streamNormalInput = createAsyncThunk<
|
|||
defaultModel.title,
|
||||
streamAborter.signal,
|
||||
messages,
|
||||
{
|
||||
tools: useTools
|
||||
? Object.keys(toolSettings)
|
||||
useTools
|
||||
? {
|
||||
tools: Object.keys(toolSettings)
|
||||
.filter((tool) => toolSettings[tool] !== "disabled")
|
||||
.map((toolName) =>
|
||||
state.config.config.tools.find(
|
||||
(tool) => tool.function.name === toolName,
|
||||
),
|
||||
)
|
||||
.filter(Boolean)
|
||||
: undefined,
|
||||
},
|
||||
.filter((tool) => !!tool)
|
||||
.map((tool) => tool!), // for type safety
|
||||
}
|
||||
: {},
|
||||
);
|
||||
|
||||
// Stream response
|
||||
|
|
@ -54,15 +55,14 @@ export const streamNormalInput = createAsyncThunk<
|
|||
break;
|
||||
}
|
||||
|
||||
const updates = next.value as ChatMessage[];
|
||||
const updates = next.value;
|
||||
dispatch(streamUpdate(updates));
|
||||
next = await gen.next();
|
||||
}
|
||||
|
||||
// Attach prompt log
|
||||
let returnVal = next.value as PromptLog;
|
||||
if (returnVal) {
|
||||
dispatch(addPromptCompletionPair([returnVal]));
|
||||
if (next.done) {
|
||||
dispatch(addPromptCompletionPair([next.value]));
|
||||
}
|
||||
|
||||
// If it's a tool call that is automatically accepted, we should call it
|
||||
|
|
|
|||
|
|
@ -66,6 +66,10 @@ export const streamResponseThunk = createAsyncThunk<
|
|||
const slashCommands = state.config.config.slashCommands || [];
|
||||
const inputIndex = index ?? state.session.history.length;
|
||||
|
||||
if (!defaultModel) {
|
||||
throw new Error("No chat model selected");
|
||||
}
|
||||
|
||||
dispatch(submitEditorAndInitAtIndex({ index, editorState }));
|
||||
resetStateForNewMessage();
|
||||
|
||||
|
|
@ -115,7 +119,6 @@ export const streamResponseThunk = createAsyncThunk<
|
|||
unwrapResult(await dispatch(streamNormalInput(messages)));
|
||||
} else {
|
||||
const [slashCommand, commandInput] = commandAndInput;
|
||||
let updatedContextItems = [];
|
||||
posthog.capture("step run", {
|
||||
step_name: slashCommand.name,
|
||||
params: {},
|
||||
|
|
@ -132,7 +135,7 @@ export const streamResponseThunk = createAsyncThunk<
|
|||
input: commandInput,
|
||||
historyIndex: inputIndex,
|
||||
selectedCode,
|
||||
contextItems: updatedContextItems,
|
||||
contextItems: [],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ export const streamResponseAfterToolCall = createAsyncThunk<
|
|||
const initialHistory = state.session.history;
|
||||
const defaultModel = selectDefaultModel(state);
|
||||
|
||||
if (!defaultModel) {
|
||||
console.error("No default model found");
|
||||
return;
|
||||
}
|
||||
|
||||
resetStateForNewMessage();
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"skipLibCheck": true,
|
||||
"esModuleInterop": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": false,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
"noEmitOnError": false,
|
||||
"types": ["vitest/globals"]
|
||||
// Disabled for now since it's causing too many errors
|
||||
// "strictNullChecks": true
|
||||
},
|
||||
"include": ["src", "../src/util/messenger.ts"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"strictNullChecks": true,
|
||||
|
||||
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"noEmitOnError": false,
|
||||
"types": ["vitest/globals"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"],
|
||||
"exclude": ["dist", "node_modules"],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue