Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7158453

Browse files
author
FalkWolsky
committed
Improvements for OpenAI Data Source
1 parent c446853 commit 7158453

File tree

1 file changed

+16
-5
lines changed
  • server/node-service/src/plugins/openAi

1 file changed

+16
-5
lines changed

‎server/node-service/src/plugins/openAi/index.ts‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,23 @@ const spec_1_2_0 = readYaml(path.join(__dirname, "./openAI_v1.2.0.yaml"));
1010
const spec_2_3_0 = readYaml(path.join(__dirname, "./openAI_v2.3.0.yaml"));
1111

1212
const specs = {
13-
"v1.2.0": spec_1_2_0,
14-
"v2.3.0": spec_2_3_0,
13+
"v1.0": spec_1_2_0,
14+
"v2.3": spec_2_3_0,
1515
}
1616

1717
const dataSourceConfig = {
1818
type: "dataSource",
1919
params: [
2020
{
21-
key: "ApiKey.value",
21+
key: "serverURL",
22+
type: "textInput",
23+
label: "Service URL",
24+
rules: [{ required: true }],
25+
placeholder: "https://<your-cloud-instance>",
26+
tooltip: "Input the Service url of your OpenAI or compatible instance. For OpenAI, it is https://api.openai.com/v1",
27+
},
28+
{
29+
key: "apiKey",
2230
type: "password",
2331
label: "API Key",
2432
rules: [{ required: true }],
@@ -64,10 +72,13 @@ const openAiPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
6472
};
6573
},
6674
run: function (actionData, dataSourceConfig): Promise<any> {
75+
const { serverURL, apiKey } = dataSourceConfig;
6776
const runApiDsConfig = {
6877
url: "",
69-
serverURL: "",
70-
dynamicParamsConfig: dataSourceConfig,
78+
serverURL: serverURL,
79+
dynamicParamsConfig: {
80+
"ApiKeyAuth.value": apiKey,
81+
},
7182
specVersion: dataSourceConfig.specVersion,
7283
};
7384
return runOpenApi(actionData, runApiDsConfig, version2spec(specs, dataSourceConfig.specVersion) as OpenAPIV3.Document);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /