@servicetitan/titan-chatbot-api 7.1.2 → 9.0.0
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 +25 -0
- package/dist/api-client/__mocks__/chatbot-api-client.mock.d.ts +1 -0
- package/dist/api-client/__mocks__/chatbot-api-client.mock.d.ts.map +1 -1
- package/dist/api-client/__mocks__/chatbot-api-client.mock.js +22 -47
- package/dist/api-client/__mocks__/chatbot-api-client.mock.js.map +1 -1
- package/dist/api-client/base/chatbot-api-client.d.ts +7 -0
- package/dist/api-client/base/chatbot-api-client.d.ts.map +1 -1
- package/dist/api-client/base/chatbot-api-client.js +3 -4
- package/dist/api-client/base/chatbot-api-client.js.map +1 -1
- package/dist/api-client/index.d.ts +2 -2
- package/dist/api-client/index.d.ts.map +1 -1
- package/dist/api-client/index.js +12 -7
- package/dist/api-client/index.js.map +1 -1
- package/dist/api-client/models/__mocks__/models.mock.js +154 -124
- package/dist/api-client/models/__mocks__/models.mock.js.map +1 -1
- package/dist/api-client/models/index.d.ts +2 -1
- package/dist/api-client/models/index.d.ts.map +1 -1
- package/dist/api-client/models/index.js +8 -7
- package/dist/api-client/models/index.js.map +1 -1
- package/dist/api-client/titan-chat/__tests__/chatbot-api-client-stream.test.d.ts +2 -0
- package/dist/api-client/titan-chat/__tests__/chatbot-api-client-stream.test.d.ts.map +1 -0
- package/dist/api-client/titan-chat/__tests__/chatbot-api-client-stream.test.js +240 -0
- package/dist/api-client/titan-chat/__tests__/chatbot-api-client-stream.test.js.map +1 -0
- package/dist/api-client/titan-chat/__tests__/native-client.test.js +6 -6
- package/dist/api-client/titan-chat/__tests__/native-client.test.js.map +1 -1
- package/dist/api-client/titan-chat/chatbot-api-client.d.ts +11 -0
- package/dist/api-client/titan-chat/chatbot-api-client.d.ts.map +1 -1
- package/dist/api-client/titan-chat/chatbot-api-client.js +69 -35
- package/dist/api-client/titan-chat/chatbot-api-client.js.map +1 -1
- package/dist/api-client/titan-chat/index.d.ts +2 -1
- package/dist/api-client/titan-chat/index.d.ts.map +1 -1
- package/dist/api-client/titan-chat/index.js +1 -0
- package/dist/api-client/titan-chat/index.js.map +1 -1
- package/dist/api-client/titan-chat/native-client.js +359 -812
- package/dist/api-client/titan-chat/native-client.js.map +1 -1
- package/dist/api-client/utils/__tests__/model-utils.test.js +454 -191
- package/dist/api-client/utils/__tests__/model-utils.test.js.map +1 -1
- package/dist/api-client/utils/model-utils.d.ts.map +1 -1
- package/dist/api-client/utils/model-utils.js +28 -25
- package/dist/api-client/utils/model-utils.js.map +1 -1
- package/dist/hooks/use-customization-chatbot.js +2 -1
- package/dist/hooks/use-customization-chatbot.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/models/__tests__/chatbot-customizations.test.d.ts +2 -0
- package/dist/models/__tests__/chatbot-customizations.test.d.ts.map +1 -0
- package/dist/models/__tests__/chatbot-customizations.test.js +36 -0
- package/dist/models/__tests__/chatbot-customizations.test.js.map +1 -0
- package/dist/models/chatbot-customizations.d.ts +17 -0
- package/dist/models/chatbot-customizations.d.ts.map +1 -1
- package/dist/models/chatbot-customizations.js +7 -1
- package/dist/models/chatbot-customizations.js.map +1 -1
- package/dist/models/index.js +1 -0
- package/dist/models/index.js.map +1 -1
- package/dist/stores/__tests__/chatbot-ui-backend.store.observability.test.d.ts +2 -0
- package/dist/stores/__tests__/chatbot-ui-backend.store.observability.test.d.ts.map +1 -0
- package/dist/stores/__tests__/chatbot-ui-backend.store.observability.test.js +107 -0
- package/dist/stores/__tests__/chatbot-ui-backend.store.observability.test.js.map +1 -0
- package/dist/stores/__tests__/chatbot-ui-backend.store.streaming.test.d.ts +2 -0
- package/dist/stores/__tests__/chatbot-ui-backend.store.streaming.test.d.ts.map +1 -0
- package/dist/stores/__tests__/chatbot-ui-backend.store.streaming.test.js +312 -0
- package/dist/stores/__tests__/chatbot-ui-backend.store.streaming.test.js.map +1 -0
- package/dist/stores/__tests__/chatbot-ui-backend.store.test.js +267 -172
- package/dist/stores/__tests__/chatbot-ui-backend.store.test.js.map +1 -1
- package/dist/stores/__tests__/chatbot-ui.store.test.js +61 -64
- package/dist/stores/__tests__/chatbot-ui.store.test.js.map +1 -1
- package/dist/stores/__tests__/filter.store.test.js +243 -116
- package/dist/stores/__tests__/filter.store.test.js.map +1 -1
- package/dist/stores/__tests__/initialize.store.test.js +9 -8
- package/dist/stores/__tests__/initialize.store.test.js.map +1 -1
- package/dist/stores/__tests__/message-feedback-guardrail.store.test.js +8 -7
- package/dist/stores/__tests__/message-feedback-guardrail.store.test.js.map +1 -1
- package/dist/stores/__tests__/message-feedback.store.test.js +34 -27
- package/dist/stores/__tests__/message-feedback.store.test.js.map +1 -1
- package/dist/stores/__tests__/session-feedback.store.test.js +9 -8
- package/dist/stores/__tests__/session-feedback.store.test.js.map +1 -1
- package/dist/stores/chatbot-ui-backend.store.d.ts +26 -2
- package/dist/stores/chatbot-ui-backend.store.d.ts.map +1 -1
- package/dist/stores/chatbot-ui-backend.store.js +295 -239
- package/dist/stores/chatbot-ui-backend.store.js.map +1 -1
- package/dist/stores/chatbot-ui.store.js +73 -46
- package/dist/stores/chatbot-ui.store.js.map +1 -1
- package/dist/stores/filter.store.js +298 -378
- package/dist/stores/filter.store.js.map +1 -1
- package/dist/stores/index.d.ts +5 -3
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +3 -2
- package/dist/stores/index.js.map +1 -1
- package/dist/stores/initialize.store.js +55 -51
- package/dist/stores/initialize.store.js.map +1 -1
- package/dist/stores/message-feedback-base.store.js +2 -1
- package/dist/stores/message-feedback-base.store.js.map +1 -1
- package/dist/stores/message-feedback-guardrail.store.js +50 -47
- package/dist/stores/message-feedback-guardrail.store.js.map +1 -1
- package/dist/stores/message-feedback.store.js +84 -89
- package/dist/stores/message-feedback.store.js.map +1 -1
- package/dist/stores/session-feedback.store.js +46 -39
- package/dist/stores/session-feedback.store.js.map +1 -1
- package/dist/streaming/__tests__/agent-stream.test.d.ts +2 -0
- package/dist/streaming/__tests__/agent-stream.test.d.ts.map +1 -0
- package/dist/streaming/__tests__/agent-stream.test.js +92 -0
- package/dist/streaming/__tests__/agent-stream.test.js.map +1 -0
- package/dist/streaming/agent-stream.d.ts +83 -0
- package/dist/streaming/agent-stream.d.ts.map +1 -0
- package/dist/streaming/agent-stream.js +28 -0
- package/dist/streaming/agent-stream.js.map +1 -0
- package/dist/streaming/index.d.ts +3 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +4 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/run-agent-stream.d.ts +23 -0
- package/dist/streaming/run-agent-stream.d.ts.map +1 -0
- package/dist/streaming/run-agent-stream.js +83 -0
- package/dist/streaming/run-agent-stream.js.map +1 -0
- package/dist/utils/__tests__/axios-utils.test.js +8 -7
- package/dist/utils/__tests__/axios-utils.test.js.map +1 -1
- package/dist/utils/axios-utils.js +9 -7
- package/dist/utils/axios-utils.js.map +1 -1
- package/dist/utils/test-utils.js +5 -5
- package/dist/utils/test-utils.js.map +1 -1
- package/package.json +6 -3
- package/src/api-client/__mocks__/chatbot-api-client.mock.ts +1 -0
- package/src/api-client/base/chatbot-api-client.ts +11 -0
- package/src/api-client/index.ts +2 -7
- package/src/api-client/models/index.ts +15 -13
- package/src/api-client/titan-chat/__tests__/chatbot-api-client-stream.test.ts +208 -0
- package/src/api-client/titan-chat/chatbot-api-client.ts +46 -0
- package/src/api-client/titan-chat/index.ts +2 -1
- package/src/api-client/utils/model-utils.ts +4 -8
- package/src/index.ts +7 -2
- package/src/models/__tests__/chatbot-customizations.test.ts +26 -0
- package/src/models/chatbot-customizations.ts +20 -0
- package/src/stores/__tests__/chatbot-ui-backend.store.observability.test.ts +105 -0
- package/src/stores/__tests__/chatbot-ui-backend.store.streaming.test.ts +261 -0
- package/src/stores/chatbot-ui-backend.store.ts +179 -4
- package/src/stores/index.ts +5 -12
- package/src/streaming/__tests__/agent-stream.test.ts +80 -0
- package/src/streaming/agent-stream.ts +103 -0
- package/src/streaming/index.ts +2 -0
- package/src/streaming/run-agent-stream.ts +109 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/api-client/help-center/__tests__/converter-from-models.test.d.ts +0 -2
- package/dist/api-client/help-center/__tests__/converter-from-models.test.d.ts.map +0 -1
- package/dist/api-client/help-center/__tests__/converter-from-models.test.js +0 -34
- package/dist/api-client/help-center/__tests__/converter-from-models.test.js.map +0 -1
- package/dist/api-client/help-center/__tests__/converter-to-models.test.d.ts +0 -2
- package/dist/api-client/help-center/__tests__/converter-to-models.test.d.ts.map +0 -1
- package/dist/api-client/help-center/__tests__/converter-to-models.test.js +0 -82
- package/dist/api-client/help-center/__tests__/converter-to-models.test.js.map +0 -1
- package/dist/api-client/help-center/chatbot-api-client.d.ts +0 -32
- package/dist/api-client/help-center/chatbot-api-client.d.ts.map +0 -1
- package/dist/api-client/help-center/chatbot-api-client.js +0 -102
- package/dist/api-client/help-center/chatbot-api-client.js.map +0 -1
- package/dist/api-client/help-center/converter-from-models.d.ts +0 -13
- package/dist/api-client/help-center/converter-from-models.d.ts.map +0 -1
- package/dist/api-client/help-center/converter-from-models.js +0 -114
- package/dist/api-client/help-center/converter-from-models.js.map +0 -1
- package/dist/api-client/help-center/converter-to-models.d.ts +0 -13
- package/dist/api-client/help-center/converter-to-models.d.ts.map +0 -1
- package/dist/api-client/help-center/converter-to-models.js +0 -98
- package/dist/api-client/help-center/converter-to-models.js.map +0 -1
- package/dist/api-client/help-center/index.d.ts +0 -2
- package/dist/api-client/help-center/index.d.ts.map +0 -1
- package/dist/api-client/help-center/index.js +0 -2
- package/dist/api-client/help-center/index.js.map +0 -1
- package/dist/api-client/help-center/native-client.d.ts +0 -1268
- package/dist/api-client/help-center/native-client.d.ts.map +0 -1
- package/dist/api-client/help-center/native-client.js +0 -6242
- package/dist/api-client/help-center/native-client.js.map +0 -1
- package/src/api-client/help-center/__tests__/converter-from-models.test.ts +0 -41
- package/src/api-client/help-center/__tests__/converter-to-models.test.ts +0 -89
- package/src/api-client/help-center/chatbot-api-client.ts +0 -122
- package/src/api-client/help-center/converter-from-models.ts +0 -133
- package/src/api-client/help-center/converter-to-models.ts +0 -127
- package/src/api-client/help-center/index.ts +0 -1
- package/src/api-client/help-center/native-client.ts +0 -5727
|
@@ -1,52 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
2
15
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
16
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for
|
|
17
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
18
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
}
|
|
7
|
-
|
|
19
|
+
}
|
|
20
|
+
function _ts_metadata(k, v) {
|
|
8
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return function
|
|
12
|
-
|
|
22
|
+
}
|
|
23
|
+
function _ts_param(paramIndex, decorator) {
|
|
24
|
+
return function(target, key) {
|
|
25
|
+
decorator(target, key, paramIndex);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
13
28
|
import { inject, injectable } from '@servicetitan/react-ioc';
|
|
14
|
-
import {
|
|
29
|
+
import { runAgentStream } from '../../streaming';
|
|
30
|
+
import { CHATBOT_CLIENT_SETTINGS } from '../base/chatbot-api-client';
|
|
15
31
|
// eslint-disable-next-line no-restricted-imports
|
|
16
32
|
import { Client } from './native-client';
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
* Contains client-specific methods for interacting with the titan chatbot API.
|
|
20
|
-
*/
|
|
21
|
-
let ChatbotApiClient = class ChatbotApiClient {
|
|
33
|
+
/** Streaming endpoint template, mirroring the generated client's `/api/v{version}/message`. */ const AGENT_STREAM_PATH_TEMPLATE = '/api/v{version}/message/stream';
|
|
34
|
+
export class ChatbotApiClient {
|
|
22
35
|
get version() {
|
|
23
36
|
return this.chatbotApiClientSettings.version;
|
|
24
37
|
}
|
|
25
38
|
get clientId() {
|
|
26
39
|
return this.chatbotApiClientSettings.clientId;
|
|
27
40
|
}
|
|
28
|
-
constructor(chatbotApiClientSettings) {
|
|
29
|
-
Object.defineProperty(this, "chatbotApiClientSettings", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: chatbotApiClientSettings
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "client", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: void 0
|
|
40
|
-
});
|
|
41
|
-
const { baseUrl, httpClient } = this.chatbotApiClientSettings.constructorParametersFactory();
|
|
42
|
-
this.client = new Client(baseUrl, httpClient);
|
|
43
|
-
}
|
|
44
41
|
postFeedback(body, abortSignal) {
|
|
45
42
|
return this.client.feedback(this.version, this.clientId, body, abortSignal);
|
|
46
43
|
}
|
|
47
44
|
postMessage(body, abortSignal) {
|
|
48
45
|
return this.client.message(this.version, this.clientId, body, abortSignal);
|
|
49
46
|
}
|
|
47
|
+
streamMessage(body, handlers, abortSignal) {
|
|
48
|
+
var _ref;
|
|
49
|
+
var _this_chatbotApiClientSettings_streamHeadersFactory, _this_chatbotApiClientSettings;
|
|
50
|
+
/*
|
|
51
|
+
* Build the URL exactly as the generated Client does for `/api/v{version}/message`:
|
|
52
|
+
* substitute {version}, then strip a dangling query separator.
|
|
53
|
+
*/ const url = (this.baseUrl + AGENT_STREAM_PATH_TEMPLATE).replace('{version}', encodeURIComponent('' + this.version)).replace(/[?&]$/, '');
|
|
54
|
+
return runAgentStream({
|
|
55
|
+
url,
|
|
56
|
+
fetch: this.httpFetch,
|
|
57
|
+
headers: {
|
|
58
|
+
'X-Client-ID': this.clientId,
|
|
59
|
+
...(_ref = (_this_chatbotApiClientSettings_streamHeadersFactory = (_this_chatbotApiClientSettings = this.chatbotApiClientSettings).streamHeadersFactory) === null || _this_chatbotApiClientSettings_streamHeadersFactory === void 0 ? void 0 : _this_chatbotApiClientSettings_streamHeadersFactory.call(_this_chatbotApiClientSettings)) !== null && _ref !== void 0 ? _ref : {}
|
|
60
|
+
},
|
|
61
|
+
body,
|
|
62
|
+
handlers,
|
|
63
|
+
abortSignal
|
|
64
|
+
});
|
|
65
|
+
}
|
|
50
66
|
postFollowUpEmail(body, abortSignal) {
|
|
51
67
|
return this.client.followUpEmail(this.version, this.clientId, body, abortSignal);
|
|
52
68
|
}
|
|
@@ -65,11 +81,29 @@ let ChatbotApiClient = class ChatbotApiClient {
|
|
|
65
81
|
getTranscripts(start, end, signal) {
|
|
66
82
|
return this.client.transcripts(start, end, this.version, this.clientId, signal);
|
|
67
83
|
}
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
constructor(chatbotApiClientSettings){
|
|
85
|
+
_define_property(this, "chatbotApiClientSettings", void 0);
|
|
86
|
+
_define_property(this, "client", void 0);
|
|
87
|
+
/** Same base URL the generated `Client` uses, so streaming URLs are built identically. */ _define_property(this, "baseUrl", void 0);
|
|
88
|
+
/** Same `fetch` the generated `Client` uses, so the SSE request gets identical auth/headers. */ _define_property(this, "httpFetch", void 0);
|
|
89
|
+
this.chatbotApiClientSettings = chatbotApiClientSettings;
|
|
90
|
+
const { baseUrl, httpClient } = this.chatbotApiClientSettings.constructorParametersFactory();
|
|
91
|
+
this.client = new Client(baseUrl, httpClient);
|
|
92
|
+
// Mirror the generated client's `this.baseUrl = baseUrl ?? ""`.
|
|
93
|
+
this.baseUrl = baseUrl !== null && baseUrl !== void 0 ? baseUrl : '';
|
|
94
|
+
/*
|
|
95
|
+
* Reuse the same fetch the generated client uses, so the SSE request goes through the
|
|
96
|
+
* consumer's request configuration (auth token, X-HC-Instance, credentials, …).
|
|
97
|
+
*/ this.httpFetch = httpClient === null || httpClient === void 0 ? void 0 : httpClient.fetch;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
ChatbotApiClient = _ts_decorate([
|
|
70
101
|
injectable(),
|
|
71
|
-
|
|
72
|
-
|
|
102
|
+
_ts_param(0, inject(CHATBOT_CLIENT_SETTINGS)),
|
|
103
|
+
_ts_metadata("design:type", Function),
|
|
104
|
+
_ts_metadata("design:paramtypes", [
|
|
105
|
+
typeof IChatbotClientSettingsTitanChat === "undefined" ? Object : IChatbotClientSettingsTitanChat
|
|
106
|
+
])
|
|
73
107
|
], ChatbotApiClient);
|
|
74
|
-
|
|
108
|
+
|
|
75
109
|
//# sourceMappingURL=chatbot-api-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/api-client/titan-chat/chatbot-api-client.ts"],"sourcesContent":["import { inject, injectable } from '@servicetitan/react-ioc';\nimport { Models } from '..';\nimport { AgentStreamHandlers, runAgentStream } from '../../streaming';\nimport {\n CHATBOT_CLIENT_SETTINGS,\n FirstParameterType,\n IChatbotApiClient,\n IChatbotClientSettings,\n SecondParameterType,\n} from '../base/chatbot-api-client';\n// eslint-disable-next-line no-restricted-imports\nimport { Client } from './native-client';\n\n/** Streaming endpoint template, mirroring the generated client's `/api/v{version}/message`. */\nconst AGENT_STREAM_PATH_TEMPLATE = '/api/v{version}/message/stream';\n\n/**\n * Settings for the chatbot client, which includes a factory for constructor parameters, and additional settings\n * like version and clientId which are used in the API calls.\n */\nexport interface IChatbotClientSettingsTitanChat extends IChatbotClientSettings {\n constructorParametersFactory: () => {\n baseUrl?: FirstParameterType<typeof Client>;\n httpClient?: SecondParameterType<typeof Client>;\n };\n version: string;\n clientId: string;\n /**\n * Extra headers for the SSE streaming request. `X-Client-ID` is always sent (from `clientId`);\n * use this for anything the fetch http client would otherwise add (e.g. Authorization). Optional.\n */\n streamHeadersFactory?: () => Record<string, string>;\n}\n\n/**\n * Client adapter adopts the generated titan chatbot client to the generic IChatbotApiClient interface.\n * Contains client-specific methods for interacting with the titan chatbot API.\n */\n@injectable()\nexport class ChatbotApiClient implements IChatbotApiClient {\n private readonly client: Client;\n /** Same base URL the generated `Client` uses, so streaming URLs are built identically. */\n private readonly baseUrl: string;\n /** Same `fetch` the generated `Client` uses, so the SSE request gets identical auth/headers. */\n private readonly httpFetch?: typeof fetch;\n\n get version(): string {\n return this.chatbotApiClientSettings.version;\n }\n\n get clientId(): string {\n return this.chatbotApiClientSettings.clientId;\n }\n\n constructor(\n @inject(CHATBOT_CLIENT_SETTINGS)\n private readonly chatbotApiClientSettings: IChatbotClientSettingsTitanChat\n ) {\n const { baseUrl, httpClient } =\n this.chatbotApiClientSettings.constructorParametersFactory();\n this.client = new Client(baseUrl, httpClient);\n // Mirror the generated client's `this.baseUrl = baseUrl ?? \"\"`.\n this.baseUrl = baseUrl ?? '';\n /*\n * Reuse the same fetch the generated client uses, so the SSE request goes through the\n * consumer's request configuration (auth token, X-HC-Instance, credentials, …).\n */\n this.httpFetch = httpClient?.fetch as typeof fetch | undefined;\n }\n\n postFeedback(body: Models.Feedback, abortSignal?: AbortSignal) {\n return this.client.feedback(this.version, this.clientId, body, abortSignal);\n }\n\n postMessage(body: Models.UserMessage, abortSignal?: AbortSignal) {\n return this.client.message(this.version, this.clientId, body, abortSignal);\n }\n\n streamMessage(\n body: Models.IUserMessage,\n handlers: AgentStreamHandlers,\n abortSignal?: AbortSignal\n ): Promise<Models.BotMessage> {\n /*\n * Build the URL exactly as the generated Client does for `/api/v{version}/message`:\n * substitute {version}, then strip a dangling query separator.\n */\n const url = (this.baseUrl + AGENT_STREAM_PATH_TEMPLATE)\n .replace('{version}', encodeURIComponent('' + this.version))\n .replace(/[?&]$/, '');\n\n return runAgentStream({\n url,\n fetch: this.httpFetch,\n headers: {\n 'X-Client-ID': this.clientId,\n ...(this.chatbotApiClientSettings.streamHeadersFactory?.() ?? {}),\n },\n body,\n handlers,\n abortSignal,\n });\n }\n\n postFollowUpEmail(body: Models.UserMessage, abortSignal?: AbortSignal) {\n return this.client.followUpEmail(this.version, this.clientId, body, abortSignal);\n }\n\n getOptions(abortSignal?: AbortSignal): Promise<Models.FrontendModel> {\n return this.client.options(this.version, this.clientId, abortSignal);\n }\n\n async postSession(body: Models.Session, abortSignal?: AbortSignal) {\n return this.client.sessionPOST(this.version, this.clientId, body, abortSignal);\n }\n\n patchSession(body: Models.Session, abortSignal?: AbortSignal) {\n return this.client.sessionPATCH(this.version, this.clientId, body, abortSignal);\n }\n\n deleteSession(body: Models.Session, abortSignal?: AbortSignal) {\n return this.client.sessionDELETE(this.version, this.clientId, body, abortSignal);\n }\n\n getTranscripts(start?: Date, end?: Date, signal?: AbortSignal) {\n return this.client.transcripts(start, end, this.version, this.clientId, signal);\n }\n}\n"],"names":["inject","injectable","runAgentStream","CHATBOT_CLIENT_SETTINGS","Client","AGENT_STREAM_PATH_TEMPLATE","ChatbotApiClient","version","chatbotApiClientSettings","clientId","postFeedback","body","abortSignal","client","feedback","postMessage","message","streamMessage","handlers","url","baseUrl","replace","encodeURIComponent","fetch","httpFetch","headers","streamHeadersFactory","postFollowUpEmail","followUpEmail","getOptions","options","postSession","sessionPOST","patchSession","sessionPATCH","deleteSession","sessionDELETE","getTranscripts","start","end","signal","transcripts","httpClient","constructorParametersFactory"],"mappings":";;;;;;;;;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AOgB,SAASsB;QAClC,gEAAgE;QAChE,IAAI,CAACtB,OAAO,GAAGA,oBAAAA,qBAAAA,UAAW;QAC1B;;;SAGC,GACD,IAAI,CAACI,SAAS,GAAGkB,uBAAAA,iCAAAA,WAAYnB,KAAK;IACtC;AA2DJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api-client/titan-chat/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api-client/titan-chat/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../../../src/api-client/titan-chat/index.ts"],"sourcesContent":["export type { IChatbotClientSettingsTitanChat } from './chatbot-api-client';\nexport { ChatbotApiClient } from './chatbot-api-client';\n"],"names":["ChatbotApiClient"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,uBAAuB"}
|