@chat-lab/ui 0.1.0-beta.51 → 0.1.0-beta.53
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/dist/components/Chatkit/index.cjs +42 -18
- package/dist/components/Chatkit/index.cjs.map +1 -1
- package/dist/components/Chatkit/index.d.ts.map +1 -1
- package/dist/components/Chatkit/index.js +42 -18
- package/dist/components/Chatkit/index.js.map +1 -1
- package/dist/components/Chatkit/types.d.ts +1 -0
- package/dist/components/Chatkit/types.d.ts.map +1 -1
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.cjs +30 -1
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.cjs.map +1 -1
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.d.ts +6 -2
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.d.ts.map +1 -1
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.js +30 -1
- package/dist/hooks/useSkillAgent/SkillAgentPlugin.js.map +1 -1
- package/dist/hooks/useSkillAgent/index.cjs +25 -3
- package/dist/hooks/useSkillAgent/index.cjs.map +1 -1
- package/dist/hooks/useSkillAgent/index.d.ts +3 -1
- package/dist/hooks/useSkillAgent/index.d.ts.map +1 -1
- package/dist/hooks/useSkillAgent/index.js +26 -4
- package/dist/hooks/useSkillAgent/index.js.map +1 -1
- package/dist/hooks/useThread.d.ts +24 -0
- package/dist/hooks/useThread.d.ts.map +1 -1
- package/dist/packages/core/dist/index.cjs +17 -9
- package/dist/packages/core/dist/index.cjs.map +1 -1
- package/dist/packages/core/dist/index.js +17 -9
- package/dist/packages/core/dist/index.js.map +1 -1
- package/dist/utils/convertToAssistantMessage.cjs +0 -1
- package/dist/utils/convertToAssistantMessage.cjs.map +1 -1
- package/dist/utils/convertToAssistantMessage.d.ts.map +1 -1
- package/dist/utils/convertToAssistantMessage.js +0 -1
- package/dist/utils/convertToAssistantMessage.js.map +1 -1
- package/dist/utils/deepAssign.cjs +31 -0
- package/dist/utils/deepAssign.cjs.map +1 -0
- package/dist/utils/deepAssign.d.ts +2 -0
- package/dist/utils/deepAssign.d.ts.map +1 -0
- package/dist/utils/deepAssign.js +29 -0
- package/dist/utils/deepAssign.js.map +1 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ import { proxy } from '../../../node_modules/.pnpm/valtio@2.1.8_patch_hash_boxi3
|
|
|
5
5
|
export { snapshot, subscribe } from '../../../node_modules/.pnpm/valtio@2.1.8_patch_hash_boxi3qpsg2dztwe4vz7tsjpr3m_@types_react@17.0.2_react@17.0.2/node_modules/valtio/esm/vanilla.js';
|
|
6
6
|
import v4 from '../../../node_modules/.pnpm/uuid@13.0.0/node_modules/uuid/dist/v4.js';
|
|
7
7
|
import last from '../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/last.js';
|
|
8
|
+
import isNil from '../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isNil.js';
|
|
8
9
|
import throttle from '../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/throttle.js';
|
|
9
10
|
import keys from '../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keys.js';
|
|
10
11
|
import compact from '../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/compact.js';
|
|
@@ -140,6 +141,7 @@ var AdkProtocol = class extends BaseProtocols_default {
|
|
|
140
141
|
this.protocol = ProtocolEnum.ADK;
|
|
141
142
|
this.authors = [];
|
|
142
143
|
this.omitCompleteText = options.omitCompleteText == true;
|
|
144
|
+
this.splitText = options.splitText || false;
|
|
143
145
|
this.protocolName = options.protocolName || options.protocol;
|
|
144
146
|
}
|
|
145
147
|
onStartSend() {
|
|
@@ -284,7 +286,7 @@ var AdkProtocol = class extends BaseProtocols_default {
|
|
|
284
286
|
generateRequestBody(request) {
|
|
285
287
|
const { userMessage, defaultParams, dynamicParams } = request;
|
|
286
288
|
const attachParts = userMessage.attaches?.map((item) => {
|
|
287
|
-
if (item.url.startsWith("https://") || item.url.startsWith("http://")) {
|
|
289
|
+
if (item.url.startsWith("https://") || item.url.startsWith("http://") || item.url.startsWith("/")) {
|
|
288
290
|
return {
|
|
289
291
|
fileData: {
|
|
290
292
|
displayName: item.attachId,
|
|
@@ -1445,6 +1447,9 @@ var AdkPlugin = class extends ChatkitPlugin {
|
|
|
1445
1447
|
this.setAppName = (appName) => {
|
|
1446
1448
|
this.options.appName = appName;
|
|
1447
1449
|
};
|
|
1450
|
+
this.updateOptions = (options) => {
|
|
1451
|
+
this.options = options;
|
|
1452
|
+
};
|
|
1448
1453
|
this.options = options;
|
|
1449
1454
|
this.adkProtocol = new Adk_default({
|
|
1450
1455
|
omitCompleteText: false,
|
|
@@ -1571,16 +1576,16 @@ var AdkPlugin = class extends ChatkitPlugin {
|
|
|
1571
1576
|
if (getFetchResponse.ok) {
|
|
1572
1577
|
const data = await getFetchResponse.json();
|
|
1573
1578
|
const xSessionId = getFetchResponse.headers.get("x-session-id");
|
|
1579
|
+
this.options.onStateChange?.(data.state);
|
|
1574
1580
|
this.chatController?.updateThread(threadId, {
|
|
1575
1581
|
metadata: {
|
|
1576
1582
|
...thread.metadata,
|
|
1577
1583
|
["sessionInited"]: true,
|
|
1578
1584
|
sessionId: data.id,
|
|
1579
1585
|
["isInitingSession"]: false,
|
|
1580
|
-
["x-session-id"]: xSessionId
|
|
1586
|
+
["x-session-id"]: xSessionId,
|
|
1587
|
+
state: data.state
|
|
1581
1588
|
},
|
|
1582
|
-
// messages: data?.events?.map(
|
|
1583
|
-
// (chunk: {
|
|
1584
1589
|
// id: string;
|
|
1585
1590
|
// author: string;
|
|
1586
1591
|
// content: { parts: any[] };
|
|
@@ -1818,8 +1823,6 @@ var toRaw = (obj) => {
|
|
|
1818
1823
|
return obj;
|
|
1819
1824
|
}
|
|
1820
1825
|
};
|
|
1821
|
-
|
|
1822
|
-
// src/ChatController.ts
|
|
1823
1826
|
var ChatController = class {
|
|
1824
1827
|
constructor(options) {
|
|
1825
1828
|
this.abortControllers = /* @__PURE__ */ new Map();
|
|
@@ -1891,7 +1894,11 @@ var ChatController = class {
|
|
|
1891
1894
|
this.store.setLoading(id, false);
|
|
1892
1895
|
}
|
|
1893
1896
|
getCurrentThread() {
|
|
1894
|
-
|
|
1897
|
+
const thread = this.store.getCurrentThread();
|
|
1898
|
+
if (isNil(thread)) {
|
|
1899
|
+
return null;
|
|
1900
|
+
}
|
|
1901
|
+
return toRaw(thread);
|
|
1895
1902
|
}
|
|
1896
1903
|
async setCurrentThread(threadId) {
|
|
1897
1904
|
this.store.setCurrentThread(threadId);
|
|
@@ -2025,7 +2032,8 @@ var ChatController = class {
|
|
|
2025
2032
|
}
|
|
2026
2033
|
const shouldSend = {
|
|
2027
2034
|
dynamicParams: hookContext.dynamicParams,
|
|
2028
|
-
requestOptions: hookContext.extraRequestOptions
|
|
2035
|
+
requestOptions: hookContext.extraRequestOptions,
|
|
2036
|
+
userMessage: hookContext.userMessage
|
|
2029
2037
|
};
|
|
2030
2038
|
const storeManager = this.store;
|
|
2031
2039
|
try {
|
|
@@ -2033,7 +2041,7 @@ var ChatController = class {
|
|
|
2033
2041
|
const requestBody = protocolAdaptor.generateRequestBody({
|
|
2034
2042
|
dynamicParams: shouldSend.dynamicParams,
|
|
2035
2043
|
defaultParams: this.requestOptions.defaultParams || {},
|
|
2036
|
-
userMessage,
|
|
2044
|
+
userMessage: shouldSend.userMessage,
|
|
2037
2045
|
thread,
|
|
2038
2046
|
contextMessages: allMessages
|
|
2039
2047
|
});
|