@adobe/spacecat-shared-gpt-client 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/clients/firefall-client.js +22 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-gpt-client-v1.2.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.2.2...@adobe/spacecat-shared-gpt-client-v1.2.3) (2024-05-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* get access_token ([#232](https://github.com/adobe/spacecat-shared/issues/232)) ([a4bd344](https://github.com/adobe/spacecat-shared/commit/a4bd344d0ab06dbcf4a1a2d310fc8a42ca3318b8))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-gpt-client-v1.2.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.2.1...@adobe/spacecat-shared-gpt-client-v1.2.2) (2024-05-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add logs ([#231](https://github.com/adobe/spacecat-shared/issues/231)) ([1777bb3](https://github.com/adobe/spacecat-shared/commit/1777bb331726086040b00aadbf82835cff8385df))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-gpt-client-v1.2.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-gpt-client-v1.2.0...@adobe/spacecat-shared-gpt-client-v1.2.1) (2024-05-11)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -78,7 +78,7 @@ export default class FirefallClient {
|
|
|
78
78
|
|
|
79
79
|
async #getApiAuth() {
|
|
80
80
|
if (!this.apiAuth) {
|
|
81
|
-
this.apiAuth = await this.imsClient.getServiceAccessToken();
|
|
81
|
+
this.apiAuth = (await this.imsClient.getServiceAccessToken()).access_token;
|
|
82
82
|
}
|
|
83
83
|
return this.apiAuth;
|
|
84
84
|
}
|
|
@@ -98,14 +98,18 @@ export default class FirefallClient {
|
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
const url = createUrl(`${this.config.apiEndpoint}/v2/capability_execution/job`);
|
|
101
|
+
const headers = {
|
|
102
|
+
'Content-Type': 'application/json',
|
|
103
|
+
Authorization: `Bearer ${apiAuth}`,
|
|
104
|
+
'x-api-key': this.config.apiKey,
|
|
105
|
+
'x-gw-ims-org-id': this.config.imsOrg,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
this.log.info(`URL: ${url}, Headers: ${JSON.stringify(headers)}`);
|
|
109
|
+
|
|
101
110
|
const response = await httpFetch(url, {
|
|
102
111
|
method: 'POST',
|
|
103
|
-
headers
|
|
104
|
-
'Content-Type': 'application/json',
|
|
105
|
-
Authorization: `Bearer ${apiAuth}`,
|
|
106
|
-
'x-api-key': this.config.apiKey,
|
|
107
|
-
'x-gw-ims-org-id': this.config.imsOrg,
|
|
108
|
-
},
|
|
112
|
+
headers,
|
|
109
113
|
body,
|
|
110
114
|
});
|
|
111
115
|
|
|
@@ -126,15 +130,20 @@ export default class FirefallClient {
|
|
|
126
130
|
(resolve) => { setTimeout(resolve, this.config.pollInterval); },
|
|
127
131
|
); // Wait for 2 seconds before polling
|
|
128
132
|
|
|
133
|
+
const url = `${this.config.apiEndpoint}/v2/capability_execution/job/${jobId}`;
|
|
134
|
+
const headers = {
|
|
135
|
+
Authorization: `Bearer ${apiAuth}`,
|
|
136
|
+
'x-api-key': this.config.apiKey,
|
|
137
|
+
'x-gw-ims-org-id': this.config.imsOrg,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
this.log.info(`URL: ${url}, Headers: ${JSON.stringify(headers)}`);
|
|
141
|
+
|
|
129
142
|
const response = await httpFetch(
|
|
130
|
-
createUrl(
|
|
143
|
+
createUrl(url),
|
|
131
144
|
{
|
|
132
145
|
method: 'GET',
|
|
133
|
-
headers
|
|
134
|
-
Authorization: `Bearer ${apiAuth}`,
|
|
135
|
-
'x-api-key': this.config.apiKey,
|
|
136
|
-
'x-gw-ims-org-id': this.config.imsOrg,
|
|
137
|
-
},
|
|
146
|
+
headers,
|
|
138
147
|
},
|
|
139
148
|
);
|
|
140
149
|
|