Merge pull request #4792 from continuedev/dallin/unified-listbox
Unified Listbox + Typescript version fix
This commit is contained in:
commit
dccb0442cb
41 changed files with 963 additions and 892 deletions
4
core/package-lock.json
generated
4
core/package-lock.json
generated
|
|
@ -100,7 +100,8 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1"
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.11.0"
|
||||
|
|
@ -15449,7 +15450,6 @@
|
|||
"version": "5.7.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz",
|
||||
"integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1"
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-bedrock-runtime": "^3.758.0",
|
||||
|
|
|
|||
5
extensions/vscode/package-lock.json
generated
5
extensions/vscode/package-lock.json
generated
|
|
@ -87,7 +87,7 @@
|
|||
"mocha": "^10.4.0",
|
||||
"ovsx": "^0.8.3",
|
||||
"rimraf": "^5.0.5",
|
||||
"typescript": "^5.3.3",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^4.3.9",
|
||||
"vsce": "^2.15.0",
|
||||
"vscode-extension-tester": "^8.10.0"
|
||||
|
|
@ -193,7 +193,8 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1"
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.11.0"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "1.1.14",
|
||||
"version": "1.1.16",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
@ -624,7 +624,7 @@
|
|||
"mocha": "^10.4.0",
|
||||
"ovsx": "^0.8.3",
|
||||
"rimraf": "^5.0.5",
|
||||
"typescript": "^5.3.3",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^4.3.9",
|
||||
"vsce": "^2.15.0",
|
||||
"vscode-extension-tester": "^8.10.0"
|
||||
|
|
|
|||
190
gui/package-lock.json
generated
190
gui/package-lock.json
generated
|
|
@ -8,7 +8,7 @@
|
|||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
"@tiptap/core": "^2.3.2",
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
"@tiptap/suggestion": "^2.1.13",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@types/vscode-webview": "^1.57.1",
|
||||
"clsx": "^2.1.1",
|
||||
"core": "file:../core",
|
||||
"dompurify": "^3.0.6",
|
||||
"downshift": "^7.6.0",
|
||||
|
|
@ -59,6 +60,7 @@
|
|||
"socket.io-client": "^4.7.2",
|
||||
"styled-components": "^5.3.6",
|
||||
"table": "^6.8.1",
|
||||
"tailwind-merge": "^3.0.2",
|
||||
"tippy.js": "^6.3.7",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"uuid": "^9.0.1",
|
||||
|
|
@ -91,7 +93,7 @@
|
|||
"jsdom": "^25.0.1",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"typescript": "^4.9.3",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-eslint": "^8.16.0",
|
||||
"vite": "^4.1.0",
|
||||
"vitest": "^2.1.3"
|
||||
|
|
@ -196,7 +198,8 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"ts-jest": "^29.1.1"
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.11.0"
|
||||
|
|
@ -1098,25 +1101,53 @@
|
|||
"@floating-ui/utils": "^0.2.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/react": {
|
||||
"version": "0.26.28",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/react/-/react-0.26.28.tgz",
|
||||
"integrity": "sha512-yORQuuAtVpiRjpMhdc0wJj06b9JFjrYF4qp96j++v2NBpbi6SEGF7donUJ3TMieerQ6qVkAv1tgr7L4r5roTqw==",
|
||||
"dependencies": {
|
||||
"@floating-ui/react-dom": "^2.1.2",
|
||||
"@floating-ui/utils": "^0.2.8",
|
||||
"tabbable": "^6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/react-dom": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.2.tgz",
|
||||
"integrity": "sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==",
|
||||
"dependencies": {
|
||||
"@floating-ui/dom": "^1.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": ">=16.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@floating-ui/utils": {
|
||||
"version": "0.2.8",
|
||||
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.8.tgz",
|
||||
"integrity": "sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig=="
|
||||
},
|
||||
"node_modules/@headlessui/react": {
|
||||
"version": "1.7.19",
|
||||
"resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.19.tgz",
|
||||
"integrity": "sha512-Ll+8q3OlMJfJbAKM/+/Y2q6PPYbryqNTXDbryx7SXLIDamkF6iQFbriYHga0dY44PvDhvvBWCx1Xj4U5+G4hOw==",
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@headlessui/react/-/react-2.2.0.tgz",
|
||||
"integrity": "sha512-RzCEg+LXsuI7mHiSomsu/gBJSjpupm6A1qIZ5sWjd7JhARNlMiSA4kKfJpCKwU9tE+zMRterhhrP74PvfJrpXQ==",
|
||||
"dependencies": {
|
||||
"@tanstack/react-virtual": "^3.0.0-beta.60",
|
||||
"client-only": "^0.0.1"
|
||||
"@floating-ui/react": "^0.26.16",
|
||||
"@react-aria/focus": "^3.17.1",
|
||||
"@react-aria/interactions": "^3.21.3",
|
||||
"@tanstack/react-virtual": "^3.8.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16 || ^17 || ^18",
|
||||
"react-dom": "^16 || ^17 || ^18"
|
||||
"react": "^18 || ^19 || ^19.0.0-rc",
|
||||
"react-dom": "^18 || ^19 || ^19.0.0-rc"
|
||||
}
|
||||
},
|
||||
"node_modules/@heroicons/react": {
|
||||
|
|
@ -1702,6 +1733,96 @@
|
|||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
},
|
||||
"node_modules/@react-aria/focus": {
|
||||
"version": "3.20.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-aria/focus/-/focus-3.20.1.tgz",
|
||||
"integrity": "sha512-lgYs+sQ1TtBrAXnAdRBQrBo0/7o5H6IrfDxec1j+VRpcXL0xyk0xPq+m3lZp8typzIghqDgpnKkJ5Jf4OrzPIw==",
|
||||
"dependencies": {
|
||||
"@react-aria/interactions": "^3.24.1",
|
||||
"@react-aria/utils": "^3.28.1",
|
||||
"@react-types/shared": "^3.28.0",
|
||||
"@swc/helpers": "^0.5.0",
|
||||
"clsx": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
||||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@react-aria/interactions": {
|
||||
"version": "3.24.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.24.1.tgz",
|
||||
"integrity": "sha512-OWEcIC6UQfWq4Td5Ptuh4PZQ4LHLJr/JL2jGYvuNL6EgL3bWvzPrRYIF/R64YbfVxIC7FeZpPSkS07sZ93/NoA==",
|
||||
"dependencies": {
|
||||
"@react-aria/ssr": "^3.9.7",
|
||||
"@react-aria/utils": "^3.28.1",
|
||||
"@react-stately/flags": "^3.1.0",
|
||||
"@react-types/shared": "^3.28.0",
|
||||
"@swc/helpers": "^0.5.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
||||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@react-aria/ssr": {
|
||||
"version": "3.9.7",
|
||||
"resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.9.7.tgz",
|
||||
"integrity": "sha512-GQygZaGlmYjmYM+tiNBA5C6acmiDWF52Nqd40bBp0Znk4M4hP+LTmI0lpI1BuKMw45T8RIhrAsICIfKwZvi2Gg==",
|
||||
"dependencies": {
|
||||
"@swc/helpers": "^0.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@react-aria/utils": {
|
||||
"version": "3.28.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-aria/utils/-/utils-3.28.1.tgz",
|
||||
"integrity": "sha512-mnHFF4YOVu9BRFQ1SZSKfPhg3z+lBRYoW5mLcYTQihbKhz48+I1sqRkP7ahMITr8ANH3nb34YaMME4XWmK2Mgg==",
|
||||
"dependencies": {
|
||||
"@react-aria/ssr": "^3.9.7",
|
||||
"@react-stately/flags": "^3.1.0",
|
||||
"@react-stately/utils": "^3.10.5",
|
||||
"@react-types/shared": "^3.28.0",
|
||||
"@swc/helpers": "^0.5.0",
|
||||
"clsx": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
||||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@react-stately/flags": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@react-stately/flags/-/flags-3.1.0.tgz",
|
||||
"integrity": "sha512-KSHOCxTFpBtxhIRcKwsD1YDTaNxFtCYuAUb0KEihc16QwqZViq4hasgPBs2gYm7fHRbw7WYzWKf6ZSo/+YsFlg==",
|
||||
"dependencies": {
|
||||
"@swc/helpers": "^0.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@react-stately/utils": {
|
||||
"version": "3.10.5",
|
||||
"resolved": "https://registry.npmjs.org/@react-stately/utils/-/utils-3.10.5.tgz",
|
||||
"integrity": "sha512-iMQSGcpaecghDIh3mZEpZfoFH3ExBwTtuBEcvZ2XnGzCgQjeYXcMdIUwAfVQLXFTdHUHGF6Gu6/dFrYsCzySBQ==",
|
||||
"dependencies": {
|
||||
"@swc/helpers": "^0.5.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@react-types/shared": {
|
||||
"version": "3.28.0",
|
||||
"resolved": "https://registry.npmjs.org/@react-types/shared/-/shared-3.28.0.tgz",
|
||||
"integrity": "sha512-9oMEYIDc3sk0G5rysnYvdNrkSg7B04yTKl50HHSZVbokeHpnU0yRmsDaWb9B/5RprcKj8XszEk5guBO8Sa/Q+Q==",
|
||||
"peerDependencies": {
|
||||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@reduxjs/toolkit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.3.0.tgz",
|
||||
|
|
@ -2201,6 +2322,14 @@
|
|||
"integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@swc/helpers": {
|
||||
"version": "0.5.15",
|
||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz",
|
||||
"integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==",
|
||||
"dependencies": {
|
||||
"tslib": "^2.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/types": {
|
||||
"version": "0.1.12",
|
||||
"resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.12.tgz",
|
||||
|
|
@ -4265,11 +4394,6 @@
|
|||
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",
|
||||
"integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow=="
|
||||
},
|
||||
"node_modules/client-only": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz",
|
||||
"integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="
|
||||
},
|
||||
"node_modules/clone-response": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz",
|
||||
|
|
@ -4282,6 +4406,14 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/clsx": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
|
|
@ -11398,6 +11530,11 @@
|
|||
"integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tabbable": {
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz",
|
||||
"integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew=="
|
||||
},
|
||||
"node_modules/table": {
|
||||
"version": "6.8.2",
|
||||
"resolved": "https://registry.npmjs.org/table/-/table-6.8.2.tgz",
|
||||
|
|
@ -11413,6 +11550,15 @@
|
|||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tailwind-merge": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.0.2.tgz",
|
||||
"integrity": "sha512-l7z+OYZ7mu3DTqrL88RiKrKIqO3NcpEO8V/Od04bNpvk0kiIFndGEoqfuzvj4yuhRkHKjRkII2z+KS2HfPcSxw==",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/dcastil"
|
||||
}
|
||||
},
|
||||
"node_modules/tailwindcss": {
|
||||
"version": "3.4.12",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.12.tgz",
|
||||
|
|
@ -11730,9 +11876,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
|
||||
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="
|
||||
},
|
||||
"node_modules/type-check": {
|
||||
"version": "0.4.0",
|
||||
|
|
@ -11833,16 +11979,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.9.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||
"version": "5.8.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz",
|
||||
"integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-eslint": {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.63",
|
||||
"@headlessui/react": "^1.7.17",
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@reduxjs/toolkit": "^2.3.0",
|
||||
"@tiptap/core": "^2.3.2",
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
"@tiptap/suggestion": "^2.1.13",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@types/vscode-webview": "^1.57.1",
|
||||
"clsx": "^2.1.1",
|
||||
"core": "file:../core",
|
||||
"dompurify": "^3.0.6",
|
||||
"downshift": "^7.6.0",
|
||||
|
|
@ -67,6 +68,7 @@
|
|||
"socket.io-client": "^4.7.2",
|
||||
"styled-components": "^5.3.6",
|
||||
"table": "^6.8.1",
|
||||
"tailwind-merge": "^3.0.2",
|
||||
"tippy.js": "^6.3.7",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"uuid": "^9.0.1",
|
||||
|
|
@ -99,7 +101,7 @@
|
|||
"jsdom": "^25.0.1",
|
||||
"postcss": "^8.4.21",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"typescript": "^4.9.3",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-eslint": "^8.16.0",
|
||||
"vite": "^4.1.0",
|
||||
"vitest": "^2.1.3"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { useContext, useRef } from "react";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { Listbox } from "@headlessui/react";
|
||||
import { addCodeToEdit } from "../../redux/slices/sessionSlice";
|
||||
import { useAppDispatch } from "../../redux/hooks";
|
||||
import { addCodeToEdit } from "../../redux/slices/sessionSlice";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
} from "../ui/Listbox";
|
||||
|
||||
export interface AddFileButtonProps {
|
||||
onClick: () => void;
|
||||
|
|
@ -29,9 +34,9 @@ export default function AddFileButton({ onClick }: AddFileButtonProps) {
|
|||
return (
|
||||
<Listbox onChange={handleAddAllOpenFiles}>
|
||||
<div className="relative">
|
||||
<Listbox.Button
|
||||
<ListboxButton
|
||||
ref={buttonRef}
|
||||
className="bg-vsc-editor-background border-lightgray/50 flex h-5 cursor-pointer items-center justify-between rounded-md border border-solid px-0 shadow-sm transition-colors"
|
||||
className="bg-vsc-editor-background m-0 rounded-md p-0"
|
||||
>
|
||||
<div
|
||||
className="flex h-5 w-14 items-center justify-center gap-1 hover:brightness-125"
|
||||
|
|
@ -50,16 +55,11 @@ export default function AddFileButton({ onClick }: AddFileButtonProps) {
|
|||
<div className="border-lightgray/50 h-4 w-[1px] border-y-0 border-l-0 border-r border-solid" />
|
||||
|
||||
<ChevronDownIcon className="text-vsc-foreground h-2.5 w-2.5 cursor-pointer px-1 brightness-75 hover:brightness-125" />
|
||||
</Listbox.Button>
|
||||
</ListboxButton>
|
||||
|
||||
<Listbox.Options className="bg-vsc-editor-background border-lightgray/50 absolute right-0 top-full z-50 mt-1 min-w-fit whitespace-nowrap rounded-md border border-solid px-1 py-0 shadow-lg">
|
||||
<Listbox.Option
|
||||
value="addAllFiles"
|
||||
className="text-vsc-foreground block w-full cursor-pointer px-2 py-1 text-left text-[10px] brightness-75 hover:brightness-125"
|
||||
>
|
||||
Add all open files
|
||||
</Listbox.Option>
|
||||
</Listbox.Options>
|
||||
<ListboxOptions className="bg-vsc-editor-background" anchor="top end">
|
||||
<ListboxOption value="addAllFiles">Add all open files</ListboxOption>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
import { Combobox } from "@headlessui/react";
|
||||
import { ContextSubmenuItemWithProvider } from "core";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxButton,
|
||||
ComboboxInput,
|
||||
ComboboxOption,
|
||||
ComboboxOptions,
|
||||
} from "../../components/ui/Combobox";
|
||||
import { useSubmenuContextProviders } from "../../context/SubmenuContextProviders";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import FileIcon from "../FileIcon";
|
||||
|
||||
export interface AddFileComboboxProps {
|
||||
onSelect: (filepaths: string[]) => void | Promise<void>;
|
||||
onEscape: () => void | Promise<void>;
|
||||
|
|
@ -54,8 +59,8 @@ export default function AddFileCombobox({
|
|||
>
|
||||
{({ open }) => (
|
||||
<div className="relative">
|
||||
<Combobox.Button className="hidden" ref={buttonRef} />
|
||||
<Combobox.Input
|
||||
<ComboboxButton className="hidden" ref={buttonRef} />
|
||||
<ComboboxInput
|
||||
ref={inputRef}
|
||||
onClick={() => {
|
||||
if (!open) {
|
||||
|
|
@ -65,7 +70,7 @@ export default function AddFileCombobox({
|
|||
onFocus={() => {
|
||||
buttonRef.current?.click();
|
||||
}}
|
||||
className="bg-vsc-background border-lightgray text-vsc-foreground box-border w-full rounded border border-solid py-0.5 pl-2 focus:outline-none"
|
||||
className="bg-vsc-background border-lightgray text-vsc-foreground box-border w-full rounded border border-solid py-0.5 pl-2 text-xs focus:outline-none"
|
||||
onChange={(event) => setQuery(event.target.value)}
|
||||
placeholder="Type to search files..."
|
||||
onKeyDown={(e) => {
|
||||
|
|
@ -75,10 +80,10 @@ export default function AddFileCombobox({
|
|||
}}
|
||||
/>
|
||||
|
||||
<Combobox.Options className="no-scrollbar bg-vsc-editor-background border-lightgray/50 absolute left-0 right-0 z-50 mt-1 max-h-60 overflow-y-auto overflow-x-hidden rounded-md border border-solid px-1 py-0 pl-0 pr-5 shadow-lg focus:outline-none">
|
||||
<ComboboxOptions className="no-scrollbar bg-vsc-editor-background border-lightgray/50 absolute left-0 right-0 z-50 mt-1 max-h-60 overflow-y-auto overflow-x-hidden rounded-md border border-solid px-1 py-0 pl-0 pr-5 shadow-lg focus:outline-none">
|
||||
{filteredFiles.length > 0 ? (
|
||||
filteredFiles.map((file) => (
|
||||
<Combobox.Option
|
||||
<ComboboxOption
|
||||
key={file.id}
|
||||
value={file}
|
||||
className={({ active }) =>
|
||||
|
|
@ -109,14 +114,14 @@ export default function AddFileCombobox({
|
|||
</span>
|
||||
</div>
|
||||
)}
|
||||
</Combobox.Option>
|
||||
</ComboboxOption>
|
||||
))
|
||||
) : (
|
||||
<div className="text-list-active-foreground px-2 py-1 text-xs">
|
||||
No results
|
||||
</div>
|
||||
)}
|
||||
</Combobox.Options>
|
||||
</ComboboxOptions>
|
||||
</div>
|
||||
)}
|
||||
</Combobox>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { Outlet, useLocation, useNavigate } from "react-router-dom";
|
|||
import styled from "styled-components";
|
||||
import { CustomScrollbarDiv, defaultBorderRadius } from ".";
|
||||
import { AuthProvider } from "../context/Auth";
|
||||
import { LocalStorageProvider } from "../context/LocalStorage";
|
||||
import { useWebviewListener } from "../hooks/useWebviewListener";
|
||||
import { useAppDispatch, useAppSelector } from "../redux/hooks";
|
||||
import { selectUseHub } from "../redux/selectors";
|
||||
|
|
@ -265,49 +266,51 @@ const Layout = () => {
|
|||
// }, [onboardingCard.show, useHub]);
|
||||
|
||||
return (
|
||||
<AuthProvider>
|
||||
<LayoutTopDiv>
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
<LocalStorageProvider>
|
||||
<AuthProvider>
|
||||
<LayoutTopDiv>
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
|
||||
<GridDiv className="">
|
||||
<PostHogPageView />
|
||||
<Outlet />
|
||||
<GridDiv className="">
|
||||
<PostHogPageView />
|
||||
<Outlet />
|
||||
|
||||
{hasFatalErrors && pathname !== ROUTES.CONFIG_ERROR && (
|
||||
<div
|
||||
className="z-50 cursor-pointer bg-red-600 p-4 text-center text-white"
|
||||
role="alert"
|
||||
onClick={() => navigate(ROUTES.CONFIG_ERROR)}
|
||||
>
|
||||
<strong className="font-bold">Error!</strong>{" "}
|
||||
<span className="block sm:inline">Could not load config</span>
|
||||
<div className="mt-2 underline">Learn More</div>
|
||||
</div>
|
||||
)}
|
||||
<Footer />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LayoutTopDiv>
|
||||
</AuthProvider>
|
||||
{hasFatalErrors && pathname !== ROUTES.CONFIG_ERROR && (
|
||||
<div
|
||||
className="z-50 cursor-pointer bg-red-600 p-4 text-center text-white"
|
||||
role="alert"
|
||||
onClick={() => navigate(ROUTES.CONFIG_ERROR)}
|
||||
>
|
||||
<strong className="font-bold">Error!</strong>{" "}
|
||||
<span className="block sm:inline">Could not load config</span>
|
||||
<div className="mt-2 underline">Learn More</div>
|
||||
</div>
|
||||
)}
|
||||
<Footer />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LayoutTopDiv>
|
||||
</AuthProvider>
|
||||
</LocalStorageProvider>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ import {
|
|||
ArrowPathIcon,
|
||||
ArrowTopRightOnSquareIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useState, useContext, useEffect } from "react";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { StyledActionButton } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { providers } from "../../../pages/AddNewModel/configs/providers";
|
||||
import { StyledActionButton } from "../..";
|
||||
import OllamaCompletedStep from "./OllamaCompletedStep";
|
||||
import { OllamaConnectionStatuses } from "../utils";
|
||||
import OllamaCompletedStep from "./OllamaCompletedStep";
|
||||
|
||||
interface OllamaStatusProps {
|
||||
isOllamaConnected: boolean;
|
||||
|
|
@ -38,7 +38,7 @@ export function OllamaStatus({ isOllamaConnected }: OllamaStatusProps) {
|
|||
case OllamaConnectionStatuses.WaitingToDownload:
|
||||
return (
|
||||
<StyledActionButton onClick={onClickDownload}>
|
||||
<p className="lines lines-1 mr-1 text-sm underline">{downloadUrl}</p>
|
||||
<p className="mr-1 line-clamp-1 text-sm underline">{downloadUrl}</p>
|
||||
<ArrowTopRightOnSquareIcon width={24} height={24} />
|
||||
</StyledActionButton>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ function AddDocsDialog() {
|
|||
|
||||
<label className="flex w-full flex-col gap-1">
|
||||
<div className="flex flex-row items-center gap-1">
|
||||
<span className="lines lines-1 whitespace-nowrap">
|
||||
<span className="line-clamp-1 whitespace-nowrap">
|
||||
Start URL
|
||||
</span>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
vscButtonBackground,
|
||||
vscButtonForeground,
|
||||
vscForeground,
|
||||
vscInputBackground,
|
||||
} from "..";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { selectUseActiveFile } from "../../redux/selectors";
|
||||
|
|
@ -21,34 +20,16 @@ import {
|
|||
import { exitEditMode } from "../../redux/thunks";
|
||||
import { loadLastSession } from "../../redux/thunks/session";
|
||||
import {
|
||||
fontSize,
|
||||
getAltKeyLabel,
|
||||
getFontSize,
|
||||
getMetaKeyLabel,
|
||||
isMetaEquivalentKeyPressed,
|
||||
} from "../../util";
|
||||
import { ToolTip } from "../gui/Tooltip";
|
||||
import ModelSelect from "../modelSelection/ModelSelect";
|
||||
import ModeSelect from "../modelSelection/ModeSelect";
|
||||
import { useFontSize } from "../ui/font";
|
||||
import HoverItem from "./InputToolbar/bottom/HoverItem";
|
||||
|
||||
const StyledDiv = styled.div<{ isHidden?: boolean }>`
|
||||
padding-top: 4px;
|
||||
justify-content: space-between;
|
||||
gap: 1px;
|
||||
background-color: ${vscInputBackground};
|
||||
align-items: center;
|
||||
font-size: ${getFontSize() - 2}px;
|
||||
cursor: ${(props) => (props.isHidden ? "default" : "text")};
|
||||
opacity: ${(props) => (props.isHidden ? 0 : 1)};
|
||||
pointer-events: ${(props) => (props.isHidden ? "none" : "auto")};
|
||||
user-select: none;
|
||||
|
||||
& > * {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
`;
|
||||
|
||||
const EnterButton = styled.button<{ isPrimary?: boolean }>`
|
||||
all: unset;
|
||||
padding: 2px 4px;
|
||||
|
|
@ -107,14 +88,19 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
defaultModel.capabilities,
|
||||
);
|
||||
|
||||
const smallFont = useFontSize(-2);
|
||||
const tinyFont = useFontSize(-3);
|
||||
|
||||
return (
|
||||
<>
|
||||
<StyledDiv
|
||||
isHidden={props.hidden}
|
||||
<div
|
||||
onClick={props.onClick}
|
||||
className="find-widget-skip flex"
|
||||
className={`find-widget-skip bg-vsc-input-background flex select-none flex-row items-center justify-between gap-1 pt-1 ${props.hidden ? "pointer-events-none cursor-default opacity-0" : "pointer-events-auto cursor-text opacity-100"}`}
|
||||
style={{
|
||||
fontSize: smallFont,
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center justify-start gap-2 whitespace-nowrap">
|
||||
<div className="xs:gap-1.5 flex flex-row items-center gap-1">
|
||||
<ModeSelect />
|
||||
<ModelSelect />
|
||||
<div className="xs:flex -mb-1 hidden items-center text-gray-400 transition-colors duration-200">
|
||||
|
|
@ -165,7 +151,7 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
<div
|
||||
className="flex items-center gap-2 whitespace-nowrap text-gray-400"
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
fontSize: tinyFont,
|
||||
}}
|
||||
>
|
||||
{!props.toolbarOptions?.hideUseCodebase && !isInEditMode && (
|
||||
|
|
@ -235,7 +221,7 @@ function InputToolbar(props: InputToolbarProps) {
|
|||
<span className="md:hidden">⏎</span>
|
||||
</EnterButton>
|
||||
</div>
|
||||
</StyledDiv>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
import { Transition } from "@headlessui/react";
|
||||
|
||||
export default function PopoverTransition({
|
||||
children,
|
||||
show,
|
||||
afterLeave,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
show?: boolean;
|
||||
afterLeave?: () => void;
|
||||
}) {
|
||||
return (
|
||||
<Transition
|
||||
show={show}
|
||||
enter="transition duration-100 ease-out"
|
||||
enterFrom="transform scale-95 opacity-0"
|
||||
enterTo="transform scale-100 opacity-100"
|
||||
leave="transition duration-75 ease-out"
|
||||
leaveFrom="transform scale-100 opacity-100"
|
||||
leaveTo="transform scale-95 opacity-0"
|
||||
afterLeave={afterLeave}
|
||||
>
|
||||
{children}
|
||||
</Transition>
|
||||
);
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ function ToolDropdownItem(props: ToolDropdownItemProps) {
|
|||
</ToolTip>
|
||||
</>
|
||||
) : null}
|
||||
<span className="lines lines-1 flex items-center gap-1">
|
||||
<span className="line-clamp-1 flex items-center gap-1">
|
||||
{props.tool.faviconUrl && (
|
||||
<img
|
||||
src={props.tool.faviconUrl}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,11 @@ export function Lump(props: LumpProps) {
|
|||
setSelectedSection={setSelectedSection}
|
||||
/>
|
||||
|
||||
<ContentDiv hasSection={!!selectedSection} isVisible={isVisible}>
|
||||
<ContentDiv
|
||||
className="thin-scrollbar pr-0.5"
|
||||
hasSection={!!selectedSection}
|
||||
isVisible={isVisible}
|
||||
>
|
||||
{!isStreaming && (
|
||||
<SelectedSection selectedSection={displayedSection} />
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ function DocsDetailsDialog({ startUrl }: DocsDetailsDialogProps) {
|
|||
data-tooltip-id={contentToolTipId}
|
||||
data-tooltip-delay-show={500}
|
||||
>
|
||||
<span className="lines lines-1">
|
||||
<span className="line-clamp-1">
|
||||
{chunk.content}
|
||||
</span>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ function DocsIndexingStatus({
|
|||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
className={`lines lines-1 m-0 p-0 text-left ${status?.url ? "cursor-pointer hover:underline" : ""}`}
|
||||
className={`m-0 line-clamp-1 p-0 text-left ${status?.url ? "cursor-pointer hover:underline" : ""}`}
|
||||
>
|
||||
{docConfig.title ?? docConfig.startUrl}
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
}, [editor, props.placeholder, historyLength]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isInEditMode) {
|
||||
setShouldHideToolbar(false);
|
||||
}
|
||||
if (props.isMainInput) {
|
||||
editor?.commands.clearContent(true);
|
||||
}
|
||||
|
|
@ -155,14 +158,19 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
|
||||
const handleBlur = (e: React.FocusEvent) => {
|
||||
// Check if the new focus target is within our InputBoxDiv
|
||||
const currentTarget = e.currentTarget;
|
||||
const relatedTarget = e.relatedTarget as Node | null;
|
||||
queueMicrotask(() => {
|
||||
if (isInEditMode) {
|
||||
return;
|
||||
}
|
||||
const currentTarget = e.currentTarget;
|
||||
const relatedTarget = e.relatedTarget as Node | null;
|
||||
|
||||
if (relatedTarget && currentTarget.contains(relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
if (relatedTarget && currentTarget.contains(relatedTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setShouldHideToolbar(true);
|
||||
setShouldHideToolbar(true);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// A dropdown menu for selecting between Chat, Edit, and Agent modes with keyboard shortcuts
|
||||
import { Listbox } from "@headlessui/react";
|
||||
import {
|
||||
ChatBubbleLeftIcon,
|
||||
CheckIcon,
|
||||
|
|
@ -11,7 +10,7 @@ import { MessageModes } from "core";
|
|||
import { modelSupportsTools } from "core/llm/autodetect";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import styled from "styled-components";
|
||||
import { defaultBorderRadius, lightGray, vscInputBackground } from "..";
|
||||
import { lightGray } from "..";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { selectDefaultModel } from "../../redux/slices/configSlice";
|
||||
import {
|
||||
|
|
@ -19,57 +18,18 @@ import {
|
|||
selectCurrentMode,
|
||||
setMode,
|
||||
} from "../../redux/slices/sessionSlice";
|
||||
import { exitEditMode } from "../../redux/thunks";
|
||||
import {
|
||||
fontSize,
|
||||
getFontSize,
|
||||
getMetaKeyLabel,
|
||||
isJetBrains,
|
||||
} from "../../util";
|
||||
import Shortcut from "../gui/Shortcut";
|
||||
|
||||
const StyledListboxButton = styled(Listbox.Button)`
|
||||
font-family: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: ${getFontSize() - 2}px;
|
||||
background: transparent;
|
||||
color: ${lightGray};
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledListboxOptions = styled(Listbox.Options)`
|
||||
margin-top: 4px;
|
||||
position: absolute;
|
||||
list-style: none;
|
||||
padding: 0px;
|
||||
min-width: 180px;
|
||||
cursor: default;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
border: 0.5px solid ${lightGray};
|
||||
background-color: ${vscInputBackground};
|
||||
`;
|
||||
|
||||
const StyledListboxOption = styled(Listbox.Option)`
|
||||
border-radius: ${defaultBorderRadius};
|
||||
padding: 6px 12px;
|
||||
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
opacity: ${(props) => (props.disabled ? 0.5 : 1)};
|
||||
|
||||
&:hover {
|
||||
background: ${(props) =>
|
||||
props.disabled ? "transparent" : `${lightGray}33`};
|
||||
}
|
||||
`;
|
||||
loadLastSession,
|
||||
saveCurrentSession,
|
||||
} from "../../redux/thunks/session";
|
||||
import { getFontSize, getMetaKeyLabel, isJetBrains } from "../../util";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
} from "../ui/Listbox";
|
||||
|
||||
const ShortcutText = styled.span`
|
||||
color: ${lightGray};
|
||||
|
|
@ -93,11 +53,11 @@ function ModeSelect() {
|
|||
const getModeIcon = (mode: MessageModes) => {
|
||||
switch (mode) {
|
||||
case "agent":
|
||||
return <SparklesIcon className="h-3 w-3" />;
|
||||
return <SparklesIcon className="xs:h-3 xs:w-3 h-3 w-3" />;
|
||||
case "chat":
|
||||
return <ChatBubbleLeftIcon className="h-3 w-3" />;
|
||||
return <ChatBubbleLeftIcon className="xs:h-3 xs:w-3 h-3 w-3" />;
|
||||
case "edit":
|
||||
return <PencilIcon className="h-3 w-3" />;
|
||||
return <PencilIcon className="xs:h-3 xs:w-3 h-3 w-3" />;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -123,67 +83,79 @@ function ModeSelect() {
|
|||
return (
|
||||
<Listbox
|
||||
value={mode}
|
||||
onChange={(newMode) => {
|
||||
onChange={async (newMode) => {
|
||||
if (newMode === mode) {
|
||||
return;
|
||||
}
|
||||
dispatch(setMode(newMode));
|
||||
if (newMode === "edit") {
|
||||
await dispatch(
|
||||
saveCurrentSession({
|
||||
generateTitle: false,
|
||||
openNewSession: true,
|
||||
}),
|
||||
);
|
||||
} else if (mode === "edit") {
|
||||
await dispatch(
|
||||
loadLastSession({
|
||||
saveCurrentSession: false,
|
||||
}),
|
||||
);
|
||||
dispatch(exitEditMode());
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="relative">
|
||||
<StyledListboxButton
|
||||
<ListboxButton
|
||||
data-testid="mode-select-button"
|
||||
className="h-[18px] overflow-hidden"
|
||||
style={{ padding: 0, fontSize: fontSize(-3) }}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: `${lightGray}33`,
|
||||
}}
|
||||
className="flex items-center gap-1 rounded-full px-2 py-0.5 text-gray-400 transition-colors duration-200"
|
||||
>
|
||||
{getModeIcon(mode)}
|
||||
<span className="hidden sm:block">
|
||||
{mode.charAt(0).toUpperCase() + mode.slice(1)}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
</StyledListboxButton>
|
||||
<StyledListboxOptions
|
||||
className="z-50"
|
||||
className="gap-1 rounded-full px-2 py-0.5 text-gray-400 transition-colors duration-200"
|
||||
style={{
|
||||
fontSize: fontSize(-3),
|
||||
backgroundColor: `${lightGray}33`,
|
||||
}}
|
||||
>
|
||||
<StyledListboxOption value="agent" disabled={!agentModeSupported}>
|
||||
<SparklesIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Agent</span>
|
||||
{/* <ShortcutText></ShortcutText> */}
|
||||
{getModeIcon(mode)}
|
||||
<span className="hidden sm:block">
|
||||
{mode.charAt(0).toUpperCase() + mode.slice(1)}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</ListboxButton>
|
||||
<ListboxOptions className="min-w-32 max-w-48">
|
||||
<ListboxOption value="agent" disabled={!agentModeSupported}>
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<SparklesIcon className="h-3 w-3" />
|
||||
<span className="">Agent</span>
|
||||
</div>
|
||||
{mode === "agent" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
{!agentModeSupported && <span>(Not supported)</span>}
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
|
||||
<StyledListboxOption value="chat">
|
||||
<ChatBubbleLeftIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Chat</span>
|
||||
<ShortcutText>{metaKeyLabel}L</ShortcutText>
|
||||
<ListboxOption value="chat">
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<ChatBubbleLeftIcon className="h-2.5 w-2.5" />
|
||||
<span className="">Chat</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}L</ShortcutText>
|
||||
</div>
|
||||
{mode === "chat" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
|
||||
{!jetbrains && (
|
||||
<StyledListboxOption value="edit">
|
||||
<PencilIcon className="h-3 w-3" />
|
||||
<span className="font-semibold">Edit</span>
|
||||
<ShortcutText>{metaKeyLabel}I</ShortcutText>
|
||||
<ListboxOption value="edit">
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<PencilIcon className="h-3 w-3" />
|
||||
<span className="">Edit</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}I</ShortcutText>
|
||||
</div>
|
||||
{mode === "edit" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
)}
|
||||
|
||||
<div className="text-lightgray px-2 py-1">
|
||||
<Shortcut>{metaKeyLabel}</Shortcut>
|
||||
<Shortcut>.</Shortcut> for next mode
|
||||
{metaKeyLabel}. for next mode
|
||||
</div>
|
||||
</StyledListboxOptions>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { Listbox } from "@headlessui/react";
|
||||
import {
|
||||
CheckIcon,
|
||||
ChevronDownIcon,
|
||||
|
|
@ -9,7 +8,7 @@ import {
|
|||
import { useContext, useEffect, useRef, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import styled from "styled-components";
|
||||
import { defaultBorderRadius, lightGray, vscInputBackground } from "..";
|
||||
import { defaultBorderRadius, lightGray } from "..";
|
||||
import { useAuth } from "../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import AddModelForm from "../../forms/AddModelForm";
|
||||
|
|
@ -19,9 +18,8 @@ import {
|
|||
setDefaultModel,
|
||||
} from "../../redux/slices/configSlice";
|
||||
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
|
||||
import { fontSize, isMetaEquivalentKeyPressed } from "../../util";
|
||||
import Shortcut from "../gui/Shortcut";
|
||||
import { Divider } from "./platform/shared";
|
||||
import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util";
|
||||
import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "../ui";
|
||||
|
||||
interface ModelOptionProps {
|
||||
option: Option;
|
||||
|
|
@ -36,68 +34,6 @@ interface Option {
|
|||
apiKey?: string;
|
||||
}
|
||||
|
||||
const MAX_HEIGHT_PX = 300;
|
||||
|
||||
const StyledListboxButton = styled(Listbox.Button)`
|
||||
font-family: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: ${fontSize(-3)};
|
||||
background: transparent;
|
||||
color: ${lightGray};
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledListboxOptions = styled(Listbox.Options)<{ $showabove: boolean }>`
|
||||
margin-top: 4px;
|
||||
position: absolute;
|
||||
list-style: none;
|
||||
padding: 0px;
|
||||
white-space: nowrap;
|
||||
cursor: default;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
font-size: ${fontSize(-3)};
|
||||
border-radius: ${defaultBorderRadius};
|
||||
border: 0.5px solid ${lightGray};
|
||||
background-color: ${vscInputBackground};
|
||||
|
||||
max-height: ${MAX_HEIGHT_PX}px;
|
||||
overflow-y: scroll;
|
||||
|
||||
scrollbar-width: none;
|
||||
|
||||
${(props) => (props.$showabove ? "bottom: 100%;" : "top: 100%;")}
|
||||
`;
|
||||
|
||||
const StyledListboxOption = styled(Listbox.Option)<{ isDisabled?: boolean }>`
|
||||
border-radius: ${defaultBorderRadius};
|
||||
padding: 4px 12px;
|
||||
|
||||
${({ isDisabled }) =>
|
||||
!isDisabled &&
|
||||
`
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: ${lightGray}33;
|
||||
}
|
||||
`}
|
||||
|
||||
${({ isDisabled }) =>
|
||||
isDisabled &&
|
||||
`
|
||||
opacity: 0.5;
|
||||
`}
|
||||
`;
|
||||
|
||||
const IconBase = styled.div<{ $hovered: boolean }>`
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
|
|
@ -113,8 +49,6 @@ const IconBase = styled.div<{ $hovered: boolean }>`
|
|||
}
|
||||
`;
|
||||
|
||||
const StyledCog6ToothIcon = styled(IconBase).attrs({ as: Cog6ToothIcon })``;
|
||||
|
||||
function modelSelectTitle(model: any): string {
|
||||
if (model?.title) return model?.title;
|
||||
if (model?.model !== undefined && model?.model.trim() !== "") {
|
||||
|
|
@ -151,19 +85,19 @@ function ModelOption({
|
|||
}
|
||||
|
||||
return (
|
||||
<StyledListboxOption
|
||||
<ListboxOption
|
||||
key={idx}
|
||||
disabled={showMissingApiKeyMsg}
|
||||
value={option.value}
|
||||
isDisabled={showMissingApiKeyMsg}
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
onClick={handleOptionClick}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-0.5">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex flex-grow items-center">
|
||||
<CubeIcon className="mr-2 h-3 w-3 flex-shrink-0" />
|
||||
<span className="flex-grow">
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<div className="flex flex-1 flex-row items-center justify-between gap-2">
|
||||
<div className="flex flex-1 flex-row items-center gap-2">
|
||||
<CubeIcon className="h-3 w-3 flex-shrink-0" />
|
||||
<span className="line-clamp-1 flex-1">
|
||||
{option.title}
|
||||
{showMissingApiKeyMsg && (
|
||||
<span className="ml-2 text-[10px] italic">
|
||||
|
|
@ -172,13 +106,18 @@ function ModelOption({
|
|||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="ml-5 flex items-center">
|
||||
<StyledCog6ToothIcon $hovered={hovered} onClick={onClickGear} />
|
||||
{isSelected && <CheckIcon className="ml-1 h-3 w-3" />}
|
||||
<div className="flex flex-shrink-0 flex-row items-center gap-1">
|
||||
{isSelected && <CheckIcon className="h-3 w-3 flex-shrink-0" />}
|
||||
{hovered && (
|
||||
<Cog6ToothIcon
|
||||
className="h-3 w-3 flex-shrink-0"
|
||||
onClick={onClickGear}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +125,6 @@ function ModelSelect() {
|
|||
const dispatch = useDispatch();
|
||||
const defaultModel = useAppSelector(selectDefaultModel);
|
||||
const allModels = useAppSelector((state) => state.config.config.models);
|
||||
const [showAbove, setShowAbove] = useState(false);
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
const [options, setOptions] = useState<Option[]>([]);
|
||||
const [sortedOptions, setSortedOptions] = useState<Option[]>([]);
|
||||
|
|
@ -216,12 +154,6 @@ function ModelSelect() {
|
|||
);
|
||||
}, [allModels]);
|
||||
|
||||
useEffect(() => {
|
||||
const handleResize = () => calculatePosition();
|
||||
window.addEventListener("resize", handleResize);
|
||||
return () => window.removeEventListener("resize", handleResize);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (event: KeyboardEvent) => {
|
||||
if (event.key === "'" && isMetaEquivalentKeyPressed(event as any)) {
|
||||
|
|
@ -242,18 +174,6 @@ function ModelSelect() {
|
|||
};
|
||||
}, [options, defaultModel]);
|
||||
|
||||
function calculatePosition() {
|
||||
if (!buttonRef.current) {
|
||||
return;
|
||||
}
|
||||
const rect = buttonRef.current.getBoundingClientRect();
|
||||
const spaceBelow = window.innerHeight - rect.bottom;
|
||||
const spaceAbove = rect.top;
|
||||
const dropdownHeight = MAX_HEIGHT_PX;
|
||||
|
||||
setShowAbove(spaceBelow < dropdownHeight && spaceAbove > spaceBelow);
|
||||
}
|
||||
|
||||
function onClickAddModel(e: MouseEvent) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
|
@ -275,37 +195,29 @@ function ModelSelect() {
|
|||
}
|
||||
|
||||
return (
|
||||
// <span className="line-clamp-1">Hiad sfasdfasdf asdfasdf</span>
|
||||
<Listbox
|
||||
onChange={async (val: string) => {
|
||||
if (val === defaultModel?.title) return;
|
||||
dispatch(setDefaultModel({ title: val }));
|
||||
}}
|
||||
>
|
||||
<div className="relative">
|
||||
<StyledListboxButton
|
||||
<div className="relative flex">
|
||||
<ListboxButton
|
||||
data-testid="model-select-button"
|
||||
ref={buttonRef}
|
||||
className="h-[18px] overflow-hidden"
|
||||
style={{ padding: 0 }}
|
||||
onClick={calculatePosition}
|
||||
className="h-[18px] gap-1 border-none text-gray-400"
|
||||
>
|
||||
<div className="flex max-w-[33vw] items-center gap-0.5 text-gray-400 transition-colors duration-200">
|
||||
<span className="truncate">
|
||||
{modelSelectTitle(defaultModel) || "Select model"}{" "}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-3 w-3 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
</StyledListboxButton>
|
||||
<StyledListboxOptions
|
||||
$showabove={showAbove}
|
||||
className="z-50 max-w-[90vw]"
|
||||
>
|
||||
<div
|
||||
className={`max-h-[${MAX_HEIGHT_PX}px] no-scrollbar overflow-y-scroll`}
|
||||
>
|
||||
<span className="line-clamp-1 hover:brightness-110">
|
||||
{modelSelectTitle(defaultModel) || "Select model"}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0 hover:brightness-110"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</ListboxButton>
|
||||
<ListboxOptions className={"min-w-[160px]"}>
|
||||
<div className={`no-scrollbar max-h-[300px] overflow-y-auto`}>
|
||||
{sortedOptions.map((option, idx) => (
|
||||
<ModelOption
|
||||
option={option}
|
||||
|
|
@ -317,12 +229,10 @@ function ModelSelect() {
|
|||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-auto">
|
||||
<Divider className="!my-0" />
|
||||
|
||||
<div className="">
|
||||
{selectedProfile?.profileType === "local" && (
|
||||
<>
|
||||
<StyledListboxOption
|
||||
<ListboxOption
|
||||
key={options.length}
|
||||
onClick={onClickAddModel}
|
||||
value={"addModel" as any}
|
||||
|
|
@ -331,17 +241,15 @@ function ModelSelect() {
|
|||
<PlusIcon className="mr-2 h-3 w-3" />
|
||||
Add Chat model
|
||||
</div>
|
||||
</StyledListboxOption>
|
||||
</ListboxOption>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Divider className="!my-0" />
|
||||
|
||||
<span className="block px-3 py-2" style={{ color: lightGray }}>
|
||||
<Shortcut>meta '</Shortcut> to toggle model
|
||||
<span className="block px-2 py-1" style={{ color: lightGray }}>
|
||||
{getMetaKeyLabel()}' to toggle model
|
||||
</span>
|
||||
</div>
|
||||
</StyledListboxOptions>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { Listbox, Transition } from "@headlessui/react";
|
||||
import {
|
||||
CheckIcon,
|
||||
ChevronUpDownIcon,
|
||||
|
|
@ -15,13 +14,19 @@ import {
|
|||
vscListActiveBackground,
|
||||
vscListActiveForeground,
|
||||
} from "..";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
Transition,
|
||||
} from "../../components/ui";
|
||||
import { DisplayInfo } from "../../pages/AddNewModel/configs/models";
|
||||
|
||||
export const StyledListbox = styled(Listbox)`
|
||||
background-color: ${vscBackground};
|
||||
`;
|
||||
|
||||
export const StyledListboxButton = styled(Listbox.Button)`
|
||||
export const StyledListboxButton = styled(ListboxButton)`
|
||||
cursor: pointer;
|
||||
background-color: ${vscBackground};
|
||||
text-align: left;
|
||||
|
|
@ -55,7 +60,7 @@ export const StyledListboxButton = styled(Listbox.Button)`
|
|||
}
|
||||
`;
|
||||
|
||||
export const StyledListboxOptions = styled(Listbox.Options)`
|
||||
export const StyledListboxOptions = styled(ListboxOptions)`
|
||||
background-color: ${vscInputBackground};
|
||||
padding: 0;
|
||||
|
||||
|
|
@ -78,7 +83,7 @@ export const StyledListboxOptions = styled(Listbox.Options)`
|
|||
}
|
||||
`;
|
||||
|
||||
export const StyledListboxOption = styled(Listbox.Option)<{
|
||||
export const StyledListboxOption = styled(ListboxOption)<{
|
||||
selected: boolean;
|
||||
}>`
|
||||
background-color: ${({ selected }) =>
|
||||
|
|
|
|||
|
|
@ -1,43 +1,167 @@
|
|||
import { Popover } from "@headlessui/react";
|
||||
import { ChevronDownIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { ProfileDescription } from "core/config/ConfigHandler";
|
||||
import { useContext, useEffect, useRef } from "react";
|
||||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
BuildingOfficeIcon,
|
||||
ChevronDownIcon,
|
||||
Cog6ToothIcon,
|
||||
ExclamationTriangleIcon,
|
||||
PlusIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useContext, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { cycleProfile } from "../../../redux";
|
||||
import { cycleProfile, selectProfileThunk } from "../../../redux";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import { fontSize, isMetaEquivalentKeyPressed } from "../../../util";
|
||||
import PopoverTransition from "../../mainInput/InputToolbar/bottom/PopoverTransition";
|
||||
import AssistantIcon from "./AssistantIcon";
|
||||
import { AssistantSelectOptions } from "./AssistantSelectOptions";
|
||||
import {
|
||||
fontSize,
|
||||
getMetaKeyLabel,
|
||||
isLocalProfile,
|
||||
isMetaEquivalentKeyPressed,
|
||||
} from "../../../util";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
Transition,
|
||||
} from "../../ui";
|
||||
|
||||
function AssistantSelectButton(props: { selectedProfile: ProfileDescription }) {
|
||||
const isLumpToolbarExpanded = useAppSelector(
|
||||
(state) => state.ui.isBlockSettingsToolbarExpanded,
|
||||
);
|
||||
return (
|
||||
<div className="flex max-w-[50vw] items-center gap-0.5">
|
||||
<div className="mr-1 h-3 w-3 flex-shrink-0 select-none">
|
||||
<AssistantIcon assistant={props.selectedProfile} />
|
||||
</div>
|
||||
<span
|
||||
className={`select-none truncate ${isLumpToolbarExpanded ? "xs:hidden sm:block" : ""}`}
|
||||
>
|
||||
{props.selectedProfile.title}
|
||||
</span>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0 select-none"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
import { ProfileDescription } from "core/config/ConfigHandler";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { vscCommandCenterInactiveBorder } from "../..";
|
||||
import { ROUTES } from "../../../util/navigation";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
import { useFontSize } from "../../ui/font";
|
||||
import AssistantIcon from "./AssistantIcon";
|
||||
|
||||
interface AssistantSelectOptionProps {
|
||||
profile: ProfileDescription;
|
||||
onClick: () => void;
|
||||
}
|
||||
const AssistantSelectOption = ({
|
||||
profile,
|
||||
onClick,
|
||||
}: AssistantSelectOptionProps) => {
|
||||
const navigate = useNavigate();
|
||||
const [hovered, setHovered] = useState(false);
|
||||
|
||||
const hasFatalErrors = useMemo(() => {
|
||||
return !!profile.errors?.find((error) => error.fatal);
|
||||
}, [profile.errors]);
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
function handleOptionClick() {
|
||||
dispatch(selectProfileThunk(profile.id));
|
||||
onClick();
|
||||
}
|
||||
|
||||
function handleConfigure() {
|
||||
ideMessenger.post("config/openProfile", { profileId: profile.id });
|
||||
onClick();
|
||||
}
|
||||
|
||||
function handleClickError() {
|
||||
if (profile.id === "local") {
|
||||
navigate(ROUTES.CONFIG_ERROR);
|
||||
} else {
|
||||
ideMessenger.post("config/openProfile", { profileId: profile.id });
|
||||
}
|
||||
onClick();
|
||||
}
|
||||
|
||||
return (
|
||||
<ListboxOption
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
value={profile.id}
|
||||
disabled={hasFatalErrors}
|
||||
onClick={!hasFatalErrors ? handleOptionClick : undefined}
|
||||
fontSizeModifier={-2}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-0.5">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex w-full items-center">
|
||||
<div className="mr-2 h-4 w-4 flex-shrink-0">
|
||||
<AssistantIcon assistant={profile} />
|
||||
</div>
|
||||
<span className="line-clamp-1 flex-1">{profile.title}</span>
|
||||
</div>
|
||||
<div className="ml-2 flex items-center">
|
||||
{!profile.errors?.length ? (
|
||||
isLocalProfile(profile) ? (
|
||||
<Cog6ToothIcon
|
||||
className="h-4 w-4 flex-shrink-0 cursor-pointer"
|
||||
style={{
|
||||
opacity: hovered ? 1 : 0,
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleConfigure();
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ArrowTopRightOnSquareIcon
|
||||
style={{
|
||||
opacity: hovered ? 1 : 0,
|
||||
}}
|
||||
className="h-4 w-4 flex-shrink-0 cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleConfigure();
|
||||
}}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
<ExclamationTriangleIcon
|
||||
data-tooltip-id={`${profile.id}-errors-tooltip`}
|
||||
className="h-4 w-4 flex-shrink-0 cursor-pointer text-red-500"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
handleClickError();
|
||||
}}
|
||||
/>
|
||||
<ToolTip id={`${profile.id}-errors-tooltip`}>
|
||||
<div className="font-semibold">Errors</div>
|
||||
{JSON.stringify(profile.errors, null, 2)}
|
||||
</ToolTip>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListboxOption>
|
||||
);
|
||||
};
|
||||
|
||||
export default function AssistantSelect() {
|
||||
const dispatch = useAppDispatch();
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
const { selectedProfile, selectedOrganization } = useAuth();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const isLumpToolbarExpanded = useAppSelector(
|
||||
(state) => state.ui.isBlockSettingsToolbarExpanded,
|
||||
);
|
||||
|
||||
const { profiles, session, login } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
||||
function close() {
|
||||
if (buttonRef.current) {
|
||||
buttonRef.current.click();
|
||||
}
|
||||
}
|
||||
function onNewAssistant() {
|
||||
ideMessenger.post("controlPlane/openUrl", {
|
||||
path: "new",
|
||||
orgSlug: selectedOrganization?.slug,
|
||||
});
|
||||
close();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let lastToggleTime = 0;
|
||||
|
|
@ -64,6 +188,9 @@ export default function AssistantSelect() {
|
|||
};
|
||||
}, []);
|
||||
|
||||
const tinyFont = useFontSize(-4);
|
||||
const smallFont = useFontSize(-3);
|
||||
|
||||
if (!selectedProfile) {
|
||||
return (
|
||||
<div
|
||||
|
|
@ -73,45 +200,116 @@ export default function AssistantSelect() {
|
|||
orgSlug: selectedOrganization?.slug,
|
||||
});
|
||||
}}
|
||||
className="flex cursor-pointer select-none items-center gap-1 whitespace-nowrap text-gray-400"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
className="flex cursor-pointer select-none items-center gap-1 text-gray-400"
|
||||
style={{ fontSize: smallFont }}
|
||||
>
|
||||
<PlusIcon className="h-3 w-3 select-none" /> Create your first assistant
|
||||
<PlusIcon className="h-3 w-3 flex-shrink-0 select-none" />
|
||||
<span
|
||||
className={`line-clamp-1 select-none ${isLumpToolbarExpanded ? "xs:hidden sm:line-clamp-1" : ""}`}
|
||||
>
|
||||
Create your first assistant
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Popover>
|
||||
<div className="relative">
|
||||
<Popover.Button
|
||||
<Listbox>
|
||||
<div className="sm:max-w-4/5 relative flex">
|
||||
<ListboxButton
|
||||
data-testid="assistant-select-button"
|
||||
ref={buttonRef}
|
||||
className="mt-0.5 cursor-pointer border-none bg-transparent text-gray-400 hover:brightness-125"
|
||||
className="border-none bg-transparent text-gray-400 hover:brightness-125"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
<AssistantSelectButton selectedProfile={selectedProfile} />
|
||||
</Popover.Button>
|
||||
<div className="flex flex-row items-center gap-1.5">
|
||||
<div className="h-3 w-3 flex-shrink-0 select-none">
|
||||
<AssistantIcon assistant={selectedProfile} />
|
||||
</div>
|
||||
<span
|
||||
className={`line-clamp-1 select-none ${isLumpToolbarExpanded ? "xs:hidden sm:line-clamp-1" : ""}`}
|
||||
>
|
||||
{selectedProfile.title}
|
||||
</span>
|
||||
</div>
|
||||
<ChevronDownIcon
|
||||
className="h-2 w-2 flex-shrink-0 select-none"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</ListboxButton>
|
||||
|
||||
<PopoverTransition>
|
||||
<Popover.Panel
|
||||
className="bg-vsc-input-background flex min-w-[200px] max-w-[90vw] cursor-default flex-row rounded-md border-[0.5px] border-solid border-zinc-600 p-0"
|
||||
style={{
|
||||
position: "absolute",
|
||||
right: 0,
|
||||
zIndex: 1000,
|
||||
}}
|
||||
>
|
||||
<AssistantSelectOptions
|
||||
onClose={() => {
|
||||
if (buttonRef.current) {
|
||||
buttonRef.current.click();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Popover.Panel>
|
||||
</PopoverTransition>
|
||||
<Transition>
|
||||
<ListboxOptions className="pb-0">
|
||||
<div
|
||||
className={`thin-scrollbar flex max-h-[300px] flex-col gap-1 overflow-y-auto py-1`}
|
||||
>
|
||||
{profiles?.map((profile, idx) => {
|
||||
return (
|
||||
<AssistantSelectOption
|
||||
key={idx}
|
||||
profile={profile}
|
||||
onClick={close}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col">
|
||||
<div
|
||||
className="my-0 h-[0.5px]"
|
||||
style={{
|
||||
backgroundColor: vscCommandCenterInactiveBorder,
|
||||
}}
|
||||
/>
|
||||
|
||||
<ListboxOption
|
||||
value={"new-assistant"}
|
||||
fontSizeModifier={-2}
|
||||
onClick={session ? onNewAssistant : () => login(false)}
|
||||
>
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<PlusIcon className="h-4 w-4 flex-shrink-0" />
|
||||
New Assistant
|
||||
</div>
|
||||
</ListboxOption>
|
||||
|
||||
<div
|
||||
className="my-0 h-[0.5px]"
|
||||
style={{
|
||||
backgroundColor: vscCommandCenterInactiveBorder,
|
||||
}}
|
||||
/>
|
||||
|
||||
<div
|
||||
className="text-lightgray flex items-center justify-between px-2 py-1"
|
||||
style={{
|
||||
fontSize: tinyFont,
|
||||
}}
|
||||
>
|
||||
<span className="block">
|
||||
<code>{getMetaKeyLabel()} ⇧ '</code> to toggle
|
||||
</span>
|
||||
<div
|
||||
className="flex items-center gap-1"
|
||||
onClick={() => navigate(ROUTES.CONFIG)}
|
||||
>
|
||||
{selectedOrganization?.iconUrl ? (
|
||||
<img
|
||||
src={selectedOrganization.iconUrl}
|
||||
className="h-4 w-4 rounded-full"
|
||||
/>
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-4 w-4" />
|
||||
)}
|
||||
<span className="hover:cursor-pointer hover:underline">
|
||||
{selectedOrganization?.name || "Personal"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ListboxOptions>
|
||||
</Transition>
|
||||
</div>
|
||||
</Popover>
|
||||
</Listbox>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,130 +0,0 @@
|
|||
import { BuildingOfficeIcon, PlusIcon } from "@heroicons/react/24/outline";
|
||||
import { ProfileDescription } from "core/config/ConfigHandler";
|
||||
import { useContext } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { lightGray } from "../..";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { selectProfileThunk } from "../../../redux";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { getFontSize, getMetaKeyLabel, isLocalProfile } from "../../../util";
|
||||
import { ROUTES } from "../../../util/navigation";
|
||||
import AssistantIcon from "./AssistantIcon";
|
||||
import { Divider, Option, OptionDiv } from "./shared";
|
||||
|
||||
interface AssistantSelectOptionsProps {
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export function AssistantSelectOptions({
|
||||
onClose,
|
||||
}: AssistantSelectOptionsProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { profiles, selectedProfile, selectedOrganization, session, login } =
|
||||
useAuth();
|
||||
const dispatch = useAppDispatch();
|
||||
const navigate = useNavigate();
|
||||
|
||||
function onNewAssistant() {
|
||||
ideMessenger.post("controlPlane/openUrl", {
|
||||
path: "new",
|
||||
orgSlug: selectedOrganization?.slug,
|
||||
});
|
||||
onClose();
|
||||
}
|
||||
|
||||
function handleConfigure(profile: ProfileDescription) {
|
||||
ideMessenger.post("config/openProfile", { profileId: profile.id });
|
||||
onClose();
|
||||
}
|
||||
|
||||
function handleClickError(profileId: string) {
|
||||
ideMessenger.post("config/openProfile", { profileId });
|
||||
onClose();
|
||||
}
|
||||
|
||||
if (!profiles) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="border-lightgray flex w-full flex-col overflow-x-hidden pt-0">
|
||||
<div className={`max-h-[300px] w-full`}>
|
||||
{profiles.map((profile, idx) => {
|
||||
return (
|
||||
<Option
|
||||
key={idx}
|
||||
idx={idx}
|
||||
disabled={!!profile.errors?.length}
|
||||
showConfigure={isLocalProfile(profile)}
|
||||
selected={profile.id === selectedProfile?.id}
|
||||
onOpenConfig={() => {
|
||||
handleConfigure(profile);
|
||||
}}
|
||||
errors={profile.errors}
|
||||
onClickError={() => handleClickError(profile.id)}
|
||||
onClick={() => {
|
||||
dispatch(selectProfileThunk(profile.id));
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<div className="flex w-full items-center">
|
||||
<div className="mr-2 h-4 w-4 flex-shrink-0">
|
||||
<AssistantIcon assistant={profile} />
|
||||
</div>
|
||||
<span
|
||||
className="flex-1 truncate"
|
||||
style={{ fontSize: getFontSize() - 2 }}
|
||||
>
|
||||
{profile.title}
|
||||
</span>
|
||||
</div>
|
||||
</Option>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="mt-auto w-full">
|
||||
<OptionDiv
|
||||
key={"new-assistant"}
|
||||
onClick={session ? onNewAssistant : () => login(false)}
|
||||
>
|
||||
<div
|
||||
className="flex items-center py-0.5"
|
||||
style={{ fontSize: getFontSize() - 2 }}
|
||||
>
|
||||
<PlusIcon className="mr-2 h-4 w-4 flex-shrink-0" />
|
||||
New Assistant
|
||||
</div>
|
||||
</OptionDiv>
|
||||
|
||||
<Divider className="!my-0" />
|
||||
|
||||
<div
|
||||
className="flex items-center justify-between p-2"
|
||||
style={{ color: lightGray, fontSize: getFontSize() - 4 }}
|
||||
>
|
||||
<span className="block">
|
||||
<code>{getMetaKeyLabel()} ⇧ '</code> to toggle
|
||||
</span>
|
||||
<div
|
||||
className="flex items-center gap-1"
|
||||
onClick={() => navigate(ROUTES.CONFIG)}
|
||||
>
|
||||
{selectedOrganization?.iconUrl ? (
|
||||
<img
|
||||
src={selectedOrganization.iconUrl}
|
||||
className="h-4 w-4 rounded-full"
|
||||
/>
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-4 w-4" />
|
||||
)}
|
||||
<span className="hover:cursor-pointer hover:underline">
|
||||
{selectedOrganization?.name || "Personal"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
import { ConfigValidationError } from "@continuedev/config-yaml";
|
||||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
Cog6ToothIcon,
|
||||
ExclamationTriangleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useState } from "react";
|
||||
import styled from "styled-components";
|
||||
import { defaultBorderRadius, lightGray } from "../..";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
|
||||
export const OptionDiv = styled.div<{
|
||||
isDisabled?: boolean;
|
||||
isSelected?: boolean;
|
||||
}>`
|
||||
padding: 6px 12px;
|
||||
|
||||
min-width: 0px;
|
||||
|
||||
${({ isDisabled, isSelected }) =>
|
||||
!isDisabled &&
|
||||
`
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: ${lightGray}33;
|
||||
}
|
||||
|
||||
${
|
||||
isSelected &&
|
||||
`
|
||||
background: ${lightGray}22;
|
||||
`
|
||||
}
|
||||
`}
|
||||
|
||||
${({ isDisabled }) =>
|
||||
isDisabled &&
|
||||
`
|
||||
opacity: 0.5;
|
||||
`}
|
||||
`;
|
||||
|
||||
export const MAX_HEIGHT_PX = 300;
|
||||
|
||||
export const Divider = styled.div`
|
||||
height: 0.5px;
|
||||
background-color: ${lightGray};
|
||||
`;
|
||||
|
||||
interface ModelOptionProps {
|
||||
children: React.ReactNode;
|
||||
idx: number;
|
||||
disabled: boolean;
|
||||
selected: boolean;
|
||||
showConfigure: boolean;
|
||||
onOpenConfig: () => void;
|
||||
onClick: () => void;
|
||||
errors?: ConfigValidationError[];
|
||||
onClickError?: (e: any) => void;
|
||||
}
|
||||
|
||||
const IconBase = styled.div<{ $hovered: boolean }>`
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
opacity: ${(props) => (props.$hovered ? 0.75 : 0)};
|
||||
visibility: ${(props) => (props.$hovered ? "visible" : "hidden")};
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
background-color: ${lightGray}33;
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledCog6ToothIcon = styled(IconBase).attrs({ as: Cog6ToothIcon })``;
|
||||
const StyledArrowTopRightOnSquareIcon = styled(IconBase).attrs({
|
||||
as: ArrowTopRightOnSquareIcon,
|
||||
})``;
|
||||
const StyledExclamationTriangleIcon = styled(IconBase).attrs({
|
||||
as: ExclamationTriangleIcon,
|
||||
})``;
|
||||
|
||||
export function Option({
|
||||
children,
|
||||
idx,
|
||||
disabled,
|
||||
onClick,
|
||||
showConfigure,
|
||||
selected,
|
||||
errors,
|
||||
onClickError,
|
||||
onOpenConfig,
|
||||
}: ModelOptionProps) {
|
||||
const [hovered, setHovered] = useState(false);
|
||||
|
||||
function handleOptionClick(e: any) {
|
||||
if (disabled) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
onClick();
|
||||
}
|
||||
|
||||
return (
|
||||
<OptionDiv
|
||||
key={idx}
|
||||
isDisabled={disabled}
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
isSelected={selected}
|
||||
onClick={!disabled ? handleOptionClick : undefined}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-0.5">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
{children}
|
||||
<div className="ml-2 flex items-center">
|
||||
{!errors?.length ? (
|
||||
showConfigure ? (
|
||||
<StyledCog6ToothIcon
|
||||
$hovered={hovered}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
onOpenConfig();
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<StyledArrowTopRightOnSquareIcon
|
||||
$hovered={hovered}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
onOpenConfig();
|
||||
}}
|
||||
/>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
<StyledExclamationTriangleIcon
|
||||
data-tooltip-id={`${idx}-errors-tooltip`}
|
||||
$hovered={hovered}
|
||||
className="cursor-pointer text-red-500"
|
||||
onClick={onClickError}
|
||||
/>
|
||||
<ToolTip id={`${idx}-errors-tooltip`}>
|
||||
<div className="font-semibold">Errors</div>
|
||||
{JSON.stringify(errors, null, 2)}
|
||||
</ToolTip>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</OptionDiv>
|
||||
);
|
||||
}
|
||||
15
gui/src/components/ui/Combobox.tsx
Normal file
15
gui/src/components/ui/Combobox.tsx
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import {
|
||||
Combobox,
|
||||
ComboboxButton,
|
||||
ComboboxInput,
|
||||
ComboboxOption,
|
||||
ComboboxOptions,
|
||||
} from "@headlessui/react";
|
||||
|
||||
export {
|
||||
Combobox,
|
||||
ComboboxButton,
|
||||
ComboboxInput,
|
||||
ComboboxOption,
|
||||
ComboboxOptions,
|
||||
};
|
||||
87
gui/src/components/ui/Listbox.tsx
Normal file
87
gui/src/components/ui/Listbox.tsx
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import {
|
||||
ListboxButton as HLButton,
|
||||
ListboxOption as HLOption,
|
||||
ListboxOptions as HLOptions,
|
||||
Listbox,
|
||||
} from "@headlessui/react";
|
||||
import * as React from "react";
|
||||
import { vscCommandCenterInactiveBorder } from "..";
|
||||
import { cn } from "../../util/cn";
|
||||
import { FontSizeModifier, useFontSize } from "./font";
|
||||
|
||||
type ListboxButtonProps = React.ComponentProps<typeof HLButton> & {
|
||||
fontSizeModifier?: FontSizeModifier;
|
||||
};
|
||||
|
||||
const ListboxButton = React.forwardRef<HTMLButtonElement, ListboxButtonProps>(
|
||||
({ fontSizeModifier = -3, ...props }, ref) => {
|
||||
const fontSize = useFontSize(fontSizeModifier);
|
||||
return (
|
||||
<HLButton
|
||||
ref={ref}
|
||||
{...props}
|
||||
className={cn(
|
||||
"border-vsc-input-border bg-vsc-input-background text-vsc-foreground m-0 flex flex-1 cursor-pointer flex-row items-center gap-1 rounded-sm border border-solid px-1 py-0.5 text-left transition-colors duration-200",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
fontSize,
|
||||
...props.style,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
type ListboxOptionsProps = React.ComponentProps<typeof HLOptions> & {
|
||||
fontSizeModifier?: FontSizeModifier;
|
||||
};
|
||||
const ListboxOptions = React.forwardRef<HTMLUListElement, ListboxOptionsProps>(
|
||||
({ fontSizeModifier = -3, ...props }, ref) => {
|
||||
const fontSize = useFontSize(fontSizeModifier);
|
||||
return (
|
||||
<HLOptions
|
||||
ref={ref}
|
||||
anchor={"bottom start"}
|
||||
{...props}
|
||||
className={cn(
|
||||
"bg-vsc-input-background flex flex-col overflow-auto rounded-sm px-0 shadow-md",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
border: `1px solid ${vscCommandCenterInactiveBorder}`,
|
||||
fontSize,
|
||||
...props.style,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
type ListboxOptionProps = React.ComponentProps<typeof HLOption> & {
|
||||
fontSizeModifier?: FontSizeModifier;
|
||||
};
|
||||
const ListboxOption = React.forwardRef<HTMLLIElement, ListboxOptionProps>(
|
||||
({ fontSizeModifier = -3, ...props }, ref) => {
|
||||
const fontSize = useFontSize(fontSizeModifier);
|
||||
return (
|
||||
<HLOption
|
||||
ref={ref}
|
||||
{...props}
|
||||
className={cn(
|
||||
"text-vsc-foreground flex select-none flex-row items-center justify-between px-2 py-1",
|
||||
props.disabled
|
||||
? "opacity-50"
|
||||
: "background-transparent hover:bg-list-active hover:text-list-active-foreground cursor-pointer opacity-100",
|
||||
props.className,
|
||||
)}
|
||||
style={{
|
||||
fontSize,
|
||||
...props.style,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
export { Listbox, ListboxButton, ListboxOption, ListboxOptions };
|
||||
3
gui/src/components/ui/Popover.tsx
Normal file
3
gui/src/components/ui/Popover.tsx
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react";
|
||||
|
||||
export { Popover, PopoverButton, PopoverPanel };
|
||||
20
gui/src/components/ui/Transition.tsx
Normal file
20
gui/src/components/ui/Transition.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Transition as HLTransition } from "@headlessui/react";
|
||||
import { cn } from "../../util/cn";
|
||||
|
||||
type TransitionProps = React.ComponentProps<typeof HLTransition>;
|
||||
function Transition(props: TransitionProps) {
|
||||
return (
|
||||
<HLTransition
|
||||
enter="transition duration-100 ease-out"
|
||||
enterFrom="transform scale-95 opacity-0"
|
||||
enterTo="transform scale-100 opacity-100"
|
||||
leave="transition duration-75 ease-out"
|
||||
leaveFrom="transform scale-100 opacity-100"
|
||||
leaveTo="transform scale-95 opacity-0"
|
||||
{...props}
|
||||
className={cn("flex flex-col", props.className)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export { Transition };
|
||||
15
gui/src/components/ui/font.ts
Normal file
15
gui/src/components/ui/font.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { useMemo } from "react";
|
||||
import { useLocalStorage } from "../../context/LocalStorage";
|
||||
|
||||
export type FontSizeModifier = number | ((fontSize: number) => number);
|
||||
|
||||
export const useFontSize = (modifier?: FontSizeModifier) => {
|
||||
const { fontSize } = useLocalStorage();
|
||||
return useMemo(() => {
|
||||
return !modifier
|
||||
? fontSize
|
||||
: typeof modifier === "number"
|
||||
? fontSize + modifier
|
||||
: modifier(fontSize);
|
||||
}, [fontSize]);
|
||||
};
|
||||
4
gui/src/components/ui/index.tsx
Normal file
4
gui/src/components/ui/index.tsx
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export * from "./Combobox";
|
||||
export * from "./Listbox";
|
||||
export * from "./Popover";
|
||||
export * from "./Transition";
|
||||
41
gui/src/context/LocalStorage.tsx
Normal file
41
gui/src/context/LocalStorage.tsx
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import React, { createContext, useContext, useEffect, useState } from "react";
|
||||
import { getLocalStorage } from "../util/localStorage";
|
||||
|
||||
interface LocalStorageType {
|
||||
fontSize: number;
|
||||
}
|
||||
|
||||
const DEFAULT_LOCAL_STORAGE: LocalStorageType = {
|
||||
fontSize: 14,
|
||||
};
|
||||
|
||||
const LocalStorageContext = createContext<LocalStorageType>(
|
||||
DEFAULT_LOCAL_STORAGE,
|
||||
);
|
||||
|
||||
export const LocalStorageProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||
children,
|
||||
}) => {
|
||||
const [values, setValues] = useState<LocalStorageType>(DEFAULT_LOCAL_STORAGE);
|
||||
|
||||
// TODO setvalue
|
||||
|
||||
useEffect(() => {
|
||||
const isJetbrains = getLocalStorage("ide") === "jetbrains";
|
||||
let fontSize = getLocalStorage("fontSize") ?? (isJetbrains ? 15 : 14);
|
||||
setValues({
|
||||
fontSize,
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<LocalStorageContext.Provider value={values}>
|
||||
{children}
|
||||
</LocalStorageContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export const useLocalStorage = () => {
|
||||
const context = useContext(LocalStorageContext);
|
||||
return context;
|
||||
};
|
||||
|
|
@ -81,26 +81,6 @@ body {
|
|||
scrollbar-width: none; /* Firefox */
|
||||
}
|
||||
|
||||
.lines {
|
||||
/* white-space: pre-wrap; */
|
||||
word-break: break-word;
|
||||
overflow: hidden;
|
||||
line-height: 1.375;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.lines-3 {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.lines-1 {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.truncate-start {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
import { Popover, Transition } from "@headlessui/react";
|
||||
import { UserCircleIcon } from "@heroicons/react/24/outline";
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { SecondaryButton } from "../../components";
|
||||
import {
|
||||
Popover,
|
||||
PopoverButton,
|
||||
PopoverPanel,
|
||||
Transition,
|
||||
} from "../../components/ui";
|
||||
import { useAuth } from "../../context/Auth";
|
||||
import { ScopeSelect } from "./ScopeSelect";
|
||||
|
||||
|
|
@ -17,20 +21,12 @@ export function AccountButton() {
|
|||
|
||||
return (
|
||||
<Popover className="relative">
|
||||
<Popover.Button className="bg-vsc-background hover:bg-vsc-input-background text-vsc-foreground flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none">
|
||||
<PopoverButton className="bg-vsc-background hover:bg-vsc-input-background text-vsc-foreground flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border-none">
|
||||
<UserCircleIcon className="h-6 w-6" />
|
||||
</Popover.Button>
|
||||
</PopoverButton>
|
||||
|
||||
<Transition
|
||||
as={Fragment}
|
||||
enter="transition ease-out duration-200"
|
||||
enterFrom="opacity-0 translate-y-1"
|
||||
enterTo="opacity-100 translate-y-0"
|
||||
leave="transition ease-in duration-150"
|
||||
leaveFrom="opacity-100 translate-y-0"
|
||||
leaveTo="opacity-0 translate-y-1"
|
||||
>
|
||||
<Popover.Panel className="bg-vsc-input-background absolute right-0 z-10 mt-2 w-[250px] rounded-md border border-zinc-700 p-4 shadow-lg">
|
||||
<Transition>
|
||||
<PopoverPanel className="bg-vsc-input-background xs:p-4 absolute right-0 mt-1 rounded-md border border-zinc-700 p-2 shadow-lg">
|
||||
<div className="flex flex-col gap-3">
|
||||
<div className="flex flex-col">
|
||||
<span className="font-medium">{session.account.label}</span>
|
||||
|
|
@ -46,11 +42,11 @@ export function AccountButton() {
|
|||
<ScopeSelect />
|
||||
</div>
|
||||
)}
|
||||
<SecondaryButton onClick={logout} className="w-full justify-center">
|
||||
<SecondaryButton onClick={logout} className="">
|
||||
Sign out
|
||||
</SecondaryButton>
|
||||
</div>
|
||||
</Popover.Panel>
|
||||
</PopoverPanel>
|
||||
</Transition>
|
||||
</Popover>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -11,9 +11,13 @@ interface ConfigItemSelectProps {
|
|||
onSelect: (id: string) => void;
|
||||
}
|
||||
|
||||
import { Popover } from "@headlessui/react";
|
||||
import { ChevronDownIcon } from "@heroicons/react/24/outline";
|
||||
import PopoverTransition from "../../components/mainInput/InputToolbar/bottom/PopoverTransition";
|
||||
import {
|
||||
Popover,
|
||||
PopoverButton,
|
||||
PopoverPanel,
|
||||
Transition,
|
||||
} from "../../components/ui";
|
||||
import { fontSize } from "../../util";
|
||||
|
||||
export function ConfigItemSelect({
|
||||
|
|
@ -45,7 +49,7 @@ export function ConfigItemSelect({
|
|||
const popoverContent = (
|
||||
<div className="mt-2 px-1.5 sm:hidden">
|
||||
<Popover className="relative">
|
||||
<Popover.Button
|
||||
<PopoverButton
|
||||
className="flex w-full items-center justify-between gap-2 rounded-md border border-zinc-700 px-3 py-2"
|
||||
style={{ fontSize: fontSize(-2) }}
|
||||
>
|
||||
|
|
@ -54,10 +58,10 @@ export function ConfigItemSelect({
|
|||
<span>{activeItem?.label}</span>
|
||||
</div>
|
||||
<ChevronDownIcon className="h-4 w-4" />
|
||||
</Popover.Button>
|
||||
</PopoverButton>
|
||||
|
||||
<PopoverTransition>
|
||||
<Popover.Panel className="bg-vsc-input-background absolute z-10 mt-1 w-full rounded-md border border-zinc-700 py-1">
|
||||
<Transition>
|
||||
<PopoverPanel className="bg-vsc-input-background absolute z-10 mt-1 w-full rounded-md border border-zinc-700 py-1">
|
||||
{items.map((item) => (
|
||||
<div
|
||||
key={item.id}
|
||||
|
|
@ -72,8 +76,8 @@ export function ConfigItemSelect({
|
|||
<span>{item.label}</span>
|
||||
</div>
|
||||
))}
|
||||
</Popover.Panel>
|
||||
</PopoverTransition>
|
||||
</PopoverPanel>
|
||||
</Transition>
|
||||
</Popover>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
import { Listbox, Transition } from "@headlessui/react";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline";
|
||||
import { type ModelDescription } from "core";
|
||||
import { Fragment } from "react";
|
||||
import { defaultBorderRadius } from "../../components";
|
||||
import { ToolTip } from "../../components/gui/Tooltip";
|
||||
import InfoHover from "../../components/InfoHover";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
Transition,
|
||||
} from "../../components/ui";
|
||||
import { fontSize } from "../../util";
|
||||
|
||||
interface ModelRoleSelectorProps {
|
||||
|
|
@ -42,67 +47,46 @@ const ModelRoleSelector = ({
|
|||
</ToolTip>
|
||||
</div>
|
||||
<Listbox value={selectedModel?.title ?? null} onChange={handleSelect}>
|
||||
{({ open }) => (
|
||||
<div className="relative">
|
||||
<Listbox.Button
|
||||
aria-disabled={models.length === 0}
|
||||
className={`border-vsc-input-border bg-vsc-background ${models.length > 0 ? "hover:bg-vsc-input-background cursor-pointer" : "cursor-not-allowed opacity-50"} text-vsc-foreground relative m-0 flex w-full items-center justify-between rounded-md border border-solid px-1.5 py-0.5 text-left text-sm`}
|
||||
>
|
||||
{models.length === 0 ? (
|
||||
<span
|
||||
className="text-lightgray lines lines-1 italic"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>{`No ${displayName} models${["Chat", "Apply", "Edit"].includes(displayName) ? ". Using chat model" : ""}`}</span>
|
||||
) : (
|
||||
<span
|
||||
className="lines lines-1"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{selectedModel?.title ?? `Select ${displayName} model`}
|
||||
</span>
|
||||
)}
|
||||
{models.length ? (
|
||||
<div className="pointer-events-none flex items-center">
|
||||
<ChevronUpDownIcon className="h-3 w-3" aria-hidden="true" />
|
||||
</div>
|
||||
) : null}
|
||||
</Listbox.Button>
|
||||
<div className="relative">
|
||||
<ListboxButton
|
||||
disabled={models.length === 0}
|
||||
className={`bg-vsc-editor-background hover:bg-list-active hover:text-list-active-foreground w-full justify-between`}
|
||||
>
|
||||
{models.length === 0 ? (
|
||||
<span className="text-lightgray line-clamp-1 italic">{`No ${displayName} models${["Chat", "Apply", "Edit"].includes(displayName) ? ". Using chat model" : ""}`}</span>
|
||||
) : (
|
||||
<span className="line-clamp-1">
|
||||
{selectedModel?.title ?? `Select ${displayName} model`}
|
||||
</span>
|
||||
)}
|
||||
{models.length ? (
|
||||
<div className="pointer-events-none flex items-center">
|
||||
<ChevronUpDownIcon className="h-3 w-3" aria-hidden="true" />
|
||||
</div>
|
||||
) : null}
|
||||
</ListboxButton>
|
||||
|
||||
<Transition
|
||||
as={Fragment}
|
||||
show={open}
|
||||
enter="transition ease-out duration-100"
|
||||
enterFrom="transform opacity-0 scale-95"
|
||||
enterTo="transform opacity-100 scale-100"
|
||||
leave="transition ease-in duration-75"
|
||||
leaveFrom="transform opacity-100 scale-100"
|
||||
leaveTo="transform opacity-0 scale-95"
|
||||
<Transition>
|
||||
<ListboxOptions
|
||||
style={{ borderRadius: defaultBorderRadius }}
|
||||
className="min-w-40"
|
||||
>
|
||||
<Listbox.Options
|
||||
style={{ borderRadius: defaultBorderRadius }}
|
||||
className="bg-vsc-input-background border-vsc-input-border fixed z-[800] mt-0.5 min-w-40 overflow-auto border border-solid p-0 shadow-lg"
|
||||
>
|
||||
{models.map((option, idx) => (
|
||||
<Listbox.Option
|
||||
key={idx}
|
||||
value={option.title}
|
||||
className={`text-vsc-foreground hover:bg-list-active hover:text-list-active-foreground flex cursor-pointer flex-row items-center justify-between px-1 py-0.5`}
|
||||
{models.map((option, idx) => (
|
||||
<ListboxOption key={idx} value={option.title} className={""}>
|
||||
<span
|
||||
className="line-clamp-1 flex h-4 items-center gap-2"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
<span
|
||||
className="lines lines-1 relative flex h-4 items-center gap-2"
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{option.title}
|
||||
</span>
|
||||
{option.title === selectedModel?.title && (
|
||||
<CheckIcon className="h-3 w-3" aria-hidden="true" />
|
||||
)}
|
||||
</Listbox.Option>
|
||||
))}
|
||||
</Listbox.Options>
|
||||
</Transition>
|
||||
</div>
|
||||
)}
|
||||
{option.title}
|
||||
</span>
|
||||
{option.title === selectedModel?.title && (
|
||||
<CheckIcon className="h-3 w-3" aria-hidden="true" />
|
||||
)}
|
||||
</ListboxOption>
|
||||
))}
|
||||
</ListboxOptions>
|
||||
</Transition>
|
||||
</div>
|
||||
</Listbox>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import { Listbox } from "@headlessui/react";
|
||||
import {
|
||||
BuildingOfficeIcon,
|
||||
ChevronUpDownIcon,
|
||||
UserCircleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
} from "../../components/ui/Listbox";
|
||||
import { useAuth } from "../../context/Auth";
|
||||
import { useWebviewListener } from "../../hooks/useWebviewListener";
|
||||
import { selectOrgThunk } from "../../redux";
|
||||
|
|
@ -36,59 +41,45 @@ export function ScopeSelect() {
|
|||
return (
|
||||
<Listbox value={selectedOrgId} onChange={handleChange}>
|
||||
<div className="relative">
|
||||
<Listbox.Button className="border-vsc-input-border hover:bg-vsc-input-background text-vsc-foreground bg-vsc-background flex w-full max-w-[400px] cursor-pointer items-center gap-0.5 rounded border border-solid p-2 hover:opacity-90">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
{selectedDisplay?.iconUrl ? (
|
||||
<img src={selectedDisplay.iconUrl} alt="" className="h-5 w-5" />
|
||||
) : (
|
||||
<CurScopeEntityFallBackIcon className="h-5 w-5" />
|
||||
)}
|
||||
<span className="truncate">
|
||||
{selectedDisplay?.name || "Select Organization"}
|
||||
</span>
|
||||
</div>
|
||||
<ChevronUpDownIcon className="h-5 w-5" aria-hidden="true" />
|
||||
<ListboxButton className="hover:bg-list-active hover:text-list-active-foreground min-w-[140px] justify-between px-4 py-2 sm:min-w-[200px]">
|
||||
<div className="flex items-center gap-2">
|
||||
{selectedDisplay?.iconUrl ? (
|
||||
<img src={selectedDisplay.iconUrl} alt="" className="h-5 w-5" />
|
||||
) : (
|
||||
<CurScopeEntityFallBackIcon className="h-5 w-5" />
|
||||
)}
|
||||
<span className="truncate">
|
||||
{selectedDisplay?.name || "Select Organization"}
|
||||
</span>
|
||||
</div>
|
||||
</Listbox.Button>
|
||||
<ChevronUpDownIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</ListboxButton>
|
||||
|
||||
<Listbox.Options className="bg-vsc-input-background absolute z-50 mt-1 w-full max-w-[400px] list-none overflow-auto rounded p-0 shadow-lg">
|
||||
{organizations.length > 0 && (
|
||||
<>
|
||||
<div className="text-vsc-foreground p-2 font-semibold">
|
||||
Organizations
|
||||
<ListboxOptions className="z-[1000] min-w-[140px] pt-0.5 sm:min-w-[200px]">
|
||||
{organizations.map((org) => (
|
||||
<ListboxOption key={org.id} value={org.id} className="py-2">
|
||||
<div className="flex items-center gap-2">
|
||||
{org.iconUrl ? (
|
||||
<img src={org.iconUrl} alt="" className="h-5 w-5" />
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-5 w-5" />
|
||||
)}
|
||||
<span>{org.name}</span>
|
||||
</div>
|
||||
{organizations.map((org) => (
|
||||
<Listbox.Option
|
||||
key={org.id}
|
||||
value={org.id}
|
||||
className="text-vsc-foreground hover:bg-list-active cursor-pointer rounded p-2 text-sm hover:opacity-90"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
{org.iconUrl ? (
|
||||
<img src={org.iconUrl} alt="" className="h-5 w-5" />
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-5 w-5" />
|
||||
)}
|
||||
<span>{org.name}</span>
|
||||
</div>
|
||||
</Listbox.Option>
|
||||
))}
|
||||
</ListboxOption>
|
||||
))}
|
||||
|
||||
<div className="bg-lightgray mx-1 my-1 h-px" />
|
||||
</>
|
||||
{!!organizations.length && (
|
||||
<div className="bg-lightgray mx-1 my-1 h-px" />
|
||||
)}
|
||||
|
||||
<Listbox.Option
|
||||
value={null}
|
||||
className="text-vsc-foreground hover:bg-list-active cursor-pointer rounded p-2 hover:opacity-90"
|
||||
>
|
||||
<ListboxOption value={null}>
|
||||
<div className="flex items-center gap-2">
|
||||
<UserCircleIcon className="h-5 w-5" />
|
||||
<span>Personal</span>
|
||||
</div>
|
||||
</Listbox.Option>
|
||||
</Listbox.Options>
|
||||
</ListboxOption>
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ export function UserSettingsForm() {
|
|||
<div className="divide-x-0 divide-y-2 divide-solid divide-zinc-700">
|
||||
{!controlServerBetaEnabled || hubEnabled ? (
|
||||
<div className="flex flex-col">
|
||||
<div className="flex max-w-[400px] flex-col">
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-col gap-4 py-6">
|
||||
<div>
|
||||
<h2 className="mb-2 mt-0">User settings</h2>
|
||||
|
|
@ -208,7 +208,7 @@ export function UserSettingsForm() {
|
|||
/> */}
|
||||
|
||||
<label className="flex items-center justify-between gap-3">
|
||||
<span className="lines lines-1 text-left">
|
||||
<span className="line-clamp-1 text-left">
|
||||
Multiline Autocompletions
|
||||
</span>
|
||||
<Select
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ export function ToolCallDisplay(props: ToolCallDisplayProps) {
|
|||
{args.map(([key, value]) => (
|
||||
<div key={key} className="flex gap-2 py-0.5">
|
||||
<span className="text-lightgray">{key}:</span>
|
||||
<code className="lines lines-1">{value}</code>
|
||||
<code className="line-clamp-1">{value}</code>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { Chat } from "./Chat";
|
|||
|
||||
export default function GUI() {
|
||||
return (
|
||||
<div className="flex overflow-hidden">
|
||||
<div className="flex w-screen flex-col overflow-hidden">
|
||||
<aside className="4xl:block border-vsc-input-border no-scrollbar hidden w-96 overflow-y-auto border-0 border-r border-solid">
|
||||
<History />
|
||||
</aside>
|
||||
|
|
|
|||
6
gui/src/util/cn.ts
Normal file
6
gui/src/util/cn.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import { clsx, type ClassValue } from "clsx";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
"tsc:watch:binary": "tsc --project binary/tsconfig.json --watch --noEmit --pretty"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.6.3",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"prettier": "^3.3.3",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue