From f97fd953d9353e0746e96c35fbb4a49b111efcaa Mon Sep 17 00:00:00 2001 From: MaxtuneLee Date: Mon, 3 Jun 2024 16:45:28 +0800 Subject: [PATCH 1/3] docs: add auth header when use openai model --- .../docs-demo-openai-header_2024-06-03-08-17.json | 10 ++++++++++ .../vmind/__tests__/browser/src/pages/DataInput.tsx | 12 +++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 common/changes/@visactor/vmind/docs-demo-openai-header_2024-06-03-08-17.json diff --git a/common/changes/@visactor/vmind/docs-demo-openai-header_2024-06-03-08-17.json b/common/changes/@visactor/vmind/docs-demo-openai-header_2024-06-03-08-17.json new file mode 100644 index 00000000..9f9d6260 --- /dev/null +++ b/common/changes/@visactor/vmind/docs-demo-openai-header_2024-06-03-08-17.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vmind", + "comment": "send authorization header when use openai models", + "type": "none" + } + ], + "packageName": "@visactor/vmind" +} \ No newline at end of file diff --git a/packages/vmind/__tests__/browser/src/pages/DataInput.tsx b/packages/vmind/__tests__/browser/src/pages/DataInput.tsx index 8712ed95..46b97eaa 100644 --- a/packages/vmind/__tests__/browser/src/pages/DataInput.tsx +++ b/packages/vmind/__tests__/browser/src/pages/DataInput.tsx @@ -118,9 +118,15 @@ export function DataInput(props: IPropsType) { model, cache, showThoughts: showThoughts, - headers: { - 'api-key': apiKey - } + headers: + model.includes(Model.GPT3_5) || model.includes(Model.GPT4) + ? { + //must has Authorization: `Bearer ${openAIKey}` if use openai api + Authorization: `Bearer ${apiKey}` + } + : { + 'api-key': apiKey + } }); }, [apiKey, cache, model, showThoughts, url]); From 368b1bf99202eb0c7ef877a7e8a7e03cbb4bfd78 Mon Sep 17 00:00:00 2001 From: MaxtuneLee Date: Wed, 3 Jul 2024 10:56:02 +0800 Subject: [PATCH 2/3] docs: set all headers in all cases --- .../docs-demo-openai-header_2024-07-03-02-55.json | 10 ++++++++++ .../__tests__/browser/src/pages/DataInput.tsx | 14 +++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 common/changes/@visactor/vmind/docs-demo-openai-header_2024-07-03-02-55.json diff --git a/common/changes/@visactor/vmind/docs-demo-openai-header_2024-07-03-02-55.json b/common/changes/@visactor/vmind/docs-demo-openai-header_2024-07-03-02-55.json new file mode 100644 index 00000000..0945a5c3 --- /dev/null +++ b/common/changes/@visactor/vmind/docs-demo-openai-header_2024-07-03-02-55.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vmind", + "comment": "set all headers in all cases", + "type": "none" + } + ], + "packageName": "@visactor/vmind" +} \ No newline at end of file diff --git a/packages/vmind/__tests__/browser/src/pages/DataInput.tsx b/packages/vmind/__tests__/browser/src/pages/DataInput.tsx index 46b97eaa..f245e1e4 100644 --- a/packages/vmind/__tests__/browser/src/pages/DataInput.tsx +++ b/packages/vmind/__tests__/browser/src/pages/DataInput.tsx @@ -118,15 +118,11 @@ export function DataInput(props: IPropsType) { model, cache, showThoughts: showThoughts, - headers: - model.includes(Model.GPT3_5) || model.includes(Model.GPT4) - ? { - //must has Authorization: `Bearer ${openAIKey}` if use openai api - Authorization: `Bearer ${apiKey}` - } - : { - 'api-key': apiKey - } + headers: { + //must has Authorization: `Bearer ${openAIKey}` if use openai api + Authorization: `Bearer ${apiKey}`, + 'api-key': apiKey + } }); }, [apiKey, cache, model, showThoughts, url]); From 69f0cf73c0e02c32c936eac2f2b4e0d1fe874e10 Mon Sep 17 00:00:00 2001 From: MaxtuneLee Date: Wed, 3 Jul 2024 11:06:36 +0800 Subject: [PATCH 3/3] docs: add bearer header in smart insight page --- .../docs-demo-openai-header_2024-07-03-03-05.json | 10 ++++++++++ .../__tests__/browser/src/pages/Insight/DataInput.tsx | 1 + 2 files changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vmind/docs-demo-openai-header_2024-07-03-03-05.json diff --git a/common/changes/@visactor/vmind/docs-demo-openai-header_2024-07-03-03-05.json b/common/changes/@visactor/vmind/docs-demo-openai-header_2024-07-03-03-05.json new file mode 100644 index 00000000..3ef3b3d9 --- /dev/null +++ b/common/changes/@visactor/vmind/docs-demo-openai-header_2024-07-03-03-05.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vmind", + "comment": "add bearer header in smart insight page", + "type": "none" + } + ], + "packageName": "@visactor/vmind" +} \ No newline at end of file diff --git a/packages/vmind/__tests__/browser/src/pages/Insight/DataInput.tsx b/packages/vmind/__tests__/browser/src/pages/Insight/DataInput.tsx index 8b89b781..d20d6e98 100644 --- a/packages/vmind/__tests__/browser/src/pages/Insight/DataInput.tsx +++ b/packages/vmind/__tests__/browser/src/pages/Insight/DataInput.tsx @@ -90,6 +90,7 @@ export function DataInput(props: IPropsType) { cache, showThoughts: showThoughts, headers: { + Authorization: `Bearer ${apiKey}`, 'api-key': apiKey } });