Merge pull request #2326 from ajshedivy/watsonx/update-api-configs
update add model UI to include required inputs
This commit is contained in:
commit
67d64d7a29
5 changed files with 214 additions and 31 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "0.9.211",
|
||||
"version": "0.9.213",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
183
gui/package-lock.json
generated
183
gui/package-lock.json
generated
|
|
@ -63,7 +63,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.3.14",
|
||||
"@swc/core": "^1.7.2",
|
||||
"@swc/core": "^1.7.26",
|
||||
"@types/lodash": "^4.17.6",
|
||||
"@types/node": "^20.5.6",
|
||||
"@types/node-fetch": "^2.6.4",
|
||||
|
|
@ -13959,7 +13959,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@swc/core": {
|
||||
"version": "1.7.2",
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.7.26.tgz",
|
||||
"integrity": "sha512-f5uYFf+TmMQyYIoxkn/evWhNGuUzC730dFwAKGwBVHHVoPyak1/GvJUm6i1SKl+2Hrj9oN0i3WSoWWZ4pgI8lw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
|
|
@ -13975,16 +13977,16 @@
|
|||
"url": "https://opencollective.com/swc"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@swc/core-darwin-arm64": "1.7.2",
|
||||
"@swc/core-darwin-x64": "1.7.2",
|
||||
"@swc/core-linux-arm-gnueabihf": "1.7.2",
|
||||
"@swc/core-linux-arm64-gnu": "1.7.2",
|
||||
"@swc/core-linux-arm64-musl": "1.7.2",
|
||||
"@swc/core-linux-x64-gnu": "1.7.2",
|
||||
"@swc/core-linux-x64-musl": "1.7.2",
|
||||
"@swc/core-win32-arm64-msvc": "1.7.2",
|
||||
"@swc/core-win32-ia32-msvc": "1.7.2",
|
||||
"@swc/core-win32-x64-msvc": "1.7.2"
|
||||
"@swc/core-darwin-arm64": "1.7.26",
|
||||
"@swc/core-darwin-x64": "1.7.26",
|
||||
"@swc/core-linux-arm-gnueabihf": "1.7.26",
|
||||
"@swc/core-linux-arm64-gnu": "1.7.26",
|
||||
"@swc/core-linux-arm64-musl": "1.7.26",
|
||||
"@swc/core-linux-x64-gnu": "1.7.26",
|
||||
"@swc/core-linux-x64-musl": "1.7.26",
|
||||
"@swc/core-win32-arm64-msvc": "1.7.26",
|
||||
"@swc/core-win32-ia32-msvc": "1.7.26",
|
||||
"@swc/core-win32-x64-msvc": "1.7.26"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/helpers": "*"
|
||||
|
|
@ -13995,8 +13997,27 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-arm64": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.7.26.tgz",
|
||||
"integrity": "sha512-FF3CRYTg6a7ZVW4yT9mesxoVVZTrcSWtmZhxKCYJX9brH4CS/7PRPjAKNk6kzWgWuRoglP7hkjQcd6EpMcZEAw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-darwin-x64": {
|
||||
"version": "1.7.2",
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.7.26.tgz",
|
||||
"integrity": "sha512-az3cibZdsay2HNKmc4bjf62QVukuiMRh5sfM5kHR/JMTrLyS6vSw7Ihs3UTkZjUxkLTT8ro54LI6sV6sUQUbLQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
|
|
@ -14010,6 +14031,142 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm-gnueabihf": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.7.26.tgz",
|
||||
"integrity": "sha512-VYPFVJDO5zT5U3RpCdHE5v1gz4mmR8BfHecUZTmD2v1JeFY6fv9KArJUpjrHEEsjK/ucXkQFmJ0jaiWXmpOV9Q==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-gnu": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.7.26.tgz",
|
||||
"integrity": "sha512-YKevOV7abpjcAzXrhsl+W48Z9mZvgoVs2eP5nY+uoMAdP2b3GxC0Df1Co0I90o2lkzO4jYBpTMcZlmUXLdXn+Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-arm64-musl": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.7.26.tgz",
|
||||
"integrity": "sha512-3w8iZICMkQQON0uIcvz7+Q1MPOW6hJ4O5ETjA0LSP/tuKqx30hIniCGOgPDnv3UTMruLUnQbtBwVCZTBKR3Rkg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-gnu": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.7.26.tgz",
|
||||
"integrity": "sha512-c+pp9Zkk2lqb06bNGkR2Looxrs7FtGDMA4/aHjZcCqATgp348hOKH5WPvNLBl+yPrISuWjbKDVn3NgAvfvpH4w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-linux-x64-musl": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.7.26.tgz",
|
||||
"integrity": "sha512-PgtyfHBF6xG87dUSSdTJHwZ3/8vWZfNIXQV2GlwEpslrOkGqy+WaiiyE7Of7z9AvDILfBBBcJvJ/r8u980wAfQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-arm64-msvc": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.7.26.tgz",
|
||||
"integrity": "sha512-9TNXPIJqFynlAOrRD6tUQjMq7KApSklK3R/tXgIxc7Qx+lWu8hlDQ/kVPLpU7PWvMMwC/3hKBW+p5f+Tms1hmA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-ia32-msvc": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.7.26.tgz",
|
||||
"integrity": "sha512-9YngxNcG3177GYdsTum4V98Re+TlCeJEP4kEwEg9EagT5s3YejYdKwVAkAsJszzkXuyRDdnHUpYbTrPG6FiXrQ==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/core-win32-x64-msvc": {
|
||||
"version": "1.7.26",
|
||||
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.7.26.tgz",
|
||||
"integrity": "sha512-VR+hzg9XqucgLjXxA13MtV5O3C0bK0ywtLIBw/+a+O+Oc6mxFWHtdUeXDbIi5AiPbn0fjgVJMqYnyjGyyX8u0w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "Apache-2.0 AND MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@swc/counter": {
|
||||
"version": "0.1.3",
|
||||
"dev": true,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.3.14",
|
||||
"@swc/core": "^1.7.2",
|
||||
"@swc/core": "^1.7.26",
|
||||
"@types/lodash": "^4.17.6",
|
||||
"@types/node": "^20.5.6",
|
||||
"@types/node-fetch": "^2.6.4",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
} from "../pages/AddNewModel/configs/providers";
|
||||
import { setDefaultModel } from "../redux/slices/stateSlice";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS, hasPassedFTL } from "../util/freeTrial";
|
||||
import { completionParamsInputs } from "../pages/AddNewModel/configs/completionParamsInputs";
|
||||
|
||||
interface QuickModelSetupProps {
|
||||
onDone: () => void;
|
||||
|
|
@ -49,8 +50,14 @@ function AddModelForm({
|
|||
return false;
|
||||
}
|
||||
|
||||
const apiKey = formMethods.watch("apiKey");
|
||||
return typeof apiKey === "undefined" || apiKey.length === 0;
|
||||
const required = selectedProvider.collectInputFor
|
||||
.filter((input) => input.required)
|
||||
.map((input) => {
|
||||
const value = formMethods.watch(input.key);
|
||||
return value;
|
||||
});
|
||||
|
||||
return !required.every((value) => value !== undefined && value.length > 0);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -60,10 +67,15 @@ function AddModelForm({
|
|||
function onSubmit() {
|
||||
const apiKey = formMethods.watch("apiKey");
|
||||
const hasValidApiKey = apiKey !== undefined && apiKey !== "";
|
||||
const reqInputFields = {};
|
||||
for (let input of selectedProvider.collectInputFor) {
|
||||
reqInputFields[input.key] = formMethods.watch(input.key);
|
||||
}
|
||||
|
||||
const model = {
|
||||
...selectedProvider.params,
|
||||
...selectedModel.params,
|
||||
...reqInputFields,
|
||||
provider: selectedProvider.provider,
|
||||
title: selectedModel.title,
|
||||
...(hasValidApiKey ? { apiKey } : {}),
|
||||
|
|
@ -199,6 +211,33 @@ function AddModelForm({
|
|||
</>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{selectedProvider.collectInputFor &&
|
||||
selectedProvider.collectInputFor
|
||||
.filter(
|
||||
(field) =>
|
||||
!Object.values(completionParamsInputs).some(
|
||||
(input) => input.key === field.key,
|
||||
) &&
|
||||
field.required &&
|
||||
field.key !== "apiKey",
|
||||
)
|
||||
.map((field) => (
|
||||
<div>
|
||||
<>
|
||||
<label className="block text-sm font-medium mb-1">
|
||||
{field.label}
|
||||
</label>
|
||||
<Input
|
||||
id={field.key}
|
||||
className="w-full"
|
||||
defaultValue={field.defaultValue}
|
||||
placeholder={`${field.placeholder}`}
|
||||
{...formMethods.register(field.key)}
|
||||
/>
|
||||
</>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="mt-4 w-full">
|
||||
|
|
|
|||
|
|
@ -512,6 +512,7 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo
|
|||
label: "watsonx API version",
|
||||
placeholder: "Enter the API Version",
|
||||
defaultValue: "2023-05-29",
|
||||
required: true
|
||||
},
|
||||
{
|
||||
inputType: "text",
|
||||
|
|
@ -521,20 +522,6 @@ To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepo
|
|||
"http://us-south.dataplatform.cloud.ibm.com/m1/v1/text/generation_stream?version=2023-05-29",
|
||||
required: false,
|
||||
},
|
||||
// {
|
||||
// inputType: "text",
|
||||
// key: "title",
|
||||
// label: "Model name",
|
||||
// placeholder: "Granite 13B Chat v2",
|
||||
// isWatsonxAttribute: true,
|
||||
// },
|
||||
// {
|
||||
// inputType: "text",
|
||||
// key: "model",
|
||||
// label: "Model Id",
|
||||
// placeholder: "ibm/granite-13b-chat-v2",
|
||||
// isWatsonxAttribute: true,
|
||||
// },
|
||||
{
|
||||
inputType: "text",
|
||||
key: "watsonxStopToken",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue