@chat-lab/ui 0.1.0-beta.85 → 0.1.0-beta.86
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.
|
@@ -45,8 +45,14 @@ class ClawPlugin extends index.ChatkitPlugin {
|
|
|
45
45
|
compiler.hooks.message.abort.tap(pluginName, (ctx) => {
|
|
46
46
|
const runIds = this.options.getRunIds();
|
|
47
47
|
runIds.forEach((runId) => this.options.onAbort(runId));
|
|
48
|
-
this.sending = false;
|
|
49
|
-
this.queue
|
|
48
|
+
// this.sending = false;
|
|
49
|
+
const text = this.queue.shift();
|
|
50
|
+
if (text) {
|
|
51
|
+
this.options.onSend(text);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.sending = false;
|
|
55
|
+
}
|
|
50
56
|
return {
|
|
51
57
|
preventDefault: true,
|
|
52
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clawPlugin.cjs","sources":["../../../src/hooks/useClawChat/clawPlugin.ts"],"sourcesContent":["import {\n BaseProtocol,\n ChatkitPlugin,\n Compiler,\n AdkProtocol,\n ChatController,\n} from '@chat-lab/core';\n\nexport type ClawPluginOptions = {\n onSend: (text: string) => void;\n getRunIds: () => string[];\n onAbort: (runId: string) => void;\n};\n\nconst pluginName = 'ClawPlugin';\n\nexport class ClawPlugin extends ChatkitPlugin {\n private options: ClawPluginOptions;\n\n private queue: string[] = [];\n\n private sending = false;\n\n constructor(options: ClawPluginOptions) {\n super({ pluginName });\n this.options = options;\n }\n\n public apply(compiler: Compiler) {\n compiler.hooks.message.beforeSend.tap(pluginName, async (ctx: any) => {\n const message = ctx.userMessage?.content?.[0].text;\n if (message) {\n if (!this.sending) {\n this.sending = true;\n this.options.onSend(message);\n } else {\n this.queue.push(message);\n }\n }\n const runIds = this.options.getRunIds();\n return {\n ...ctx,\n shouldSend: !message,\n shouldAddUserMessage: Boolean(message),\n resetStatus:\n runIds.length === 0\n ? { loading: false, sending: false }\n : { loading: false, sending: true },\n };\n });\n compiler.hooks.message.finallyEnd.tap(\n pluginName,\n (ctx: { loading: boolean; sending: boolean }) => {\n const text = this.queue.pop();\n if (text) {\n this.options.onSend(text);\n } else {\n this.sending = false;\n }\n return ctx;\n },\n );\n\n compiler.hooks.message.abort.tap(\n pluginName,\n (ctx: { preventDefault: boolean }) => {\n const runIds = this.options.getRunIds();\n runIds.forEach((runId) => this.options.onAbort(runId));\n this.sending = false;\n this.queue =
|
|
1
|
+
{"version":3,"file":"clawPlugin.cjs","sources":["../../../src/hooks/useClawChat/clawPlugin.ts"],"sourcesContent":["import {\n BaseProtocol,\n ChatkitPlugin,\n Compiler,\n AdkProtocol,\n ChatController,\n} from '@chat-lab/core';\n\nexport type ClawPluginOptions = {\n onSend: (text: string) => void;\n getRunIds: () => string[];\n onAbort: (runId: string) => void;\n};\n\nconst pluginName = 'ClawPlugin';\n\nexport class ClawPlugin extends ChatkitPlugin {\n private options: ClawPluginOptions;\n\n private queue: string[] = [];\n\n private sending = false;\n\n constructor(options: ClawPluginOptions) {\n super({ pluginName });\n this.options = options;\n }\n\n public apply(compiler: Compiler) {\n compiler.hooks.message.beforeSend.tap(pluginName, async (ctx: any) => {\n const message = ctx.userMessage?.content?.[0].text;\n if (message) {\n if (!this.sending) {\n this.sending = true;\n this.options.onSend(message);\n } else {\n this.queue.push(message);\n }\n }\n const runIds = this.options.getRunIds();\n return {\n ...ctx,\n shouldSend: !message,\n shouldAddUserMessage: Boolean(message),\n resetStatus:\n runIds.length === 0\n ? { loading: false, sending: false }\n : { loading: false, sending: true },\n };\n });\n compiler.hooks.message.finallyEnd.tap(\n pluginName,\n (ctx: { loading: boolean; sending: boolean }) => {\n const text = this.queue.pop();\n if (text) {\n this.options.onSend(text);\n } else {\n this.sending = false;\n }\n return ctx;\n },\n );\n\n compiler.hooks.message.abort.tap(\n pluginName,\n (ctx: { preventDefault: boolean }) => {\n const runIds = this.options.getRunIds();\n runIds.forEach((runId) => this.options.onAbort(runId));\n // this.sending = false;\n const text = this.queue.shift();\n if (text) {\n this.options.onSend(text);\n } else {\n this.sending = false;\n }\n return {\n preventDefault: true,\n };\n },\n );\n }\n}\n"],"names":["ChatkitPlugin"],"mappings":";;;;AAcA,MAAM,UAAU,GAAG,YAAY,CAAC;AAE1B,MAAO,UAAW,SAAQA,mBAAa,CAAA;AAO3C,IAAA,WAAA,CAAY,OAA0B,EAAA;AACpC,QAAA,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QALhB,IAAK,CAAA,KAAA,GAAa,EAAE,CAAC;QAErB,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;AAItB,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;KACxB;AAEM,IAAA,KAAK,CAAC,QAAkB,EAAA;AAC7B,QAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,GAAQ,KAAI;AACnE,YAAA,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;YACnD,IAAI,OAAO,EAAE;AACX,gBAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACjB,oBAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,oBAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;iBAC9B;qBAAM;AACL,oBAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;iBAC1B;aACF;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACxC,OAAO;AACL,gBAAA,GAAG,GAAG;gBACN,UAAU,EAAE,CAAC,OAAO;AACpB,gBAAA,oBAAoB,EAAE,OAAO,CAAC,OAAO,CAAC;AACtC,gBAAA,WAAW,EACT,MAAM,CAAC,MAAM,KAAK,CAAC;sBACf,EAAE,OAAO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],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,QAAQ,EAGT,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC;AAIF,qBAAa,UAAW,SAAQ,aAAa;IAC3C,OAAO,CAAC,OAAO,CAAoB;IAEnC,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,iBAAiB;IAK/B,KAAK,CAAC,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"clawPlugin.d.ts","sourceRoot":"","sources":["../../../src/hooks/useClawChat/clawPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,QAAQ,EAGT,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC;AAIF,qBAAa,UAAW,SAAQ,aAAa;IAC3C,OAAO,CAAC,OAAO,CAAoB;IAEnC,OAAO,CAAC,KAAK,CAAgB;IAE7B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,iBAAiB;IAK/B,KAAK,CAAC,QAAQ,EAAE,QAAQ;CAqDhC"}
|
|
@@ -43,8 +43,14 @@ class ClawPlugin extends ChatkitPlugin {
|
|
|
43
43
|
compiler.hooks.message.abort.tap(pluginName, (ctx) => {
|
|
44
44
|
const runIds = this.options.getRunIds();
|
|
45
45
|
runIds.forEach((runId) => this.options.onAbort(runId));
|
|
46
|
-
this.sending = false;
|
|
47
|
-
this.queue
|
|
46
|
+
// this.sending = false;
|
|
47
|
+
const text = this.queue.shift();
|
|
48
|
+
if (text) {
|
|
49
|
+
this.options.onSend(text);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.sending = false;
|
|
53
|
+
}
|
|
48
54
|
return {
|
|
49
55
|
preventDefault: true,
|
|
50
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clawPlugin.js","sources":["../../../src/hooks/useClawChat/clawPlugin.ts"],"sourcesContent":["import {\n BaseProtocol,\n ChatkitPlugin,\n Compiler,\n AdkProtocol,\n ChatController,\n} from '@chat-lab/core';\n\nexport type ClawPluginOptions = {\n onSend: (text: string) => void;\n getRunIds: () => string[];\n onAbort: (runId: string) => void;\n};\n\nconst pluginName = 'ClawPlugin';\n\nexport class ClawPlugin extends ChatkitPlugin {\n private options: ClawPluginOptions;\n\n private queue: string[] = [];\n\n private sending = false;\n\n constructor(options: ClawPluginOptions) {\n super({ pluginName });\n this.options = options;\n }\n\n public apply(compiler: Compiler) {\n compiler.hooks.message.beforeSend.tap(pluginName, async (ctx: any) => {\n const message = ctx.userMessage?.content?.[0].text;\n if (message) {\n if (!this.sending) {\n this.sending = true;\n this.options.onSend(message);\n } else {\n this.queue.push(message);\n }\n }\n const runIds = this.options.getRunIds();\n return {\n ...ctx,\n shouldSend: !message,\n shouldAddUserMessage: Boolean(message),\n resetStatus:\n runIds.length === 0\n ? { loading: false, sending: false }\n : { loading: false, sending: true },\n };\n });\n compiler.hooks.message.finallyEnd.tap(\n pluginName,\n (ctx: { loading: boolean; sending: boolean }) => {\n const text = this.queue.pop();\n if (text) {\n this.options.onSend(text);\n } else {\n this.sending = false;\n }\n return ctx;\n },\n );\n\n compiler.hooks.message.abort.tap(\n pluginName,\n (ctx: { preventDefault: boolean }) => {\n const runIds = this.options.getRunIds();\n runIds.forEach((runId) => this.options.onAbort(runId));\n this.sending = false;\n this.queue =
|
|
1
|
+
{"version":3,"file":"clawPlugin.js","sources":["../../../src/hooks/useClawChat/clawPlugin.ts"],"sourcesContent":["import {\n BaseProtocol,\n ChatkitPlugin,\n Compiler,\n AdkProtocol,\n ChatController,\n} from '@chat-lab/core';\n\nexport type ClawPluginOptions = {\n onSend: (text: string) => void;\n getRunIds: () => string[];\n onAbort: (runId: string) => void;\n};\n\nconst pluginName = 'ClawPlugin';\n\nexport class ClawPlugin extends ChatkitPlugin {\n private options: ClawPluginOptions;\n\n private queue: string[] = [];\n\n private sending = false;\n\n constructor(options: ClawPluginOptions) {\n super({ pluginName });\n this.options = options;\n }\n\n public apply(compiler: Compiler) {\n compiler.hooks.message.beforeSend.tap(pluginName, async (ctx: any) => {\n const message = ctx.userMessage?.content?.[0].text;\n if (message) {\n if (!this.sending) {\n this.sending = true;\n this.options.onSend(message);\n } else {\n this.queue.push(message);\n }\n }\n const runIds = this.options.getRunIds();\n return {\n ...ctx,\n shouldSend: !message,\n shouldAddUserMessage: Boolean(message),\n resetStatus:\n runIds.length === 0\n ? { loading: false, sending: false }\n : { loading: false, sending: true },\n };\n });\n compiler.hooks.message.finallyEnd.tap(\n pluginName,\n (ctx: { loading: boolean; sending: boolean }) => {\n const text = this.queue.pop();\n if (text) {\n this.options.onSend(text);\n } else {\n this.sending = false;\n }\n return ctx;\n },\n );\n\n compiler.hooks.message.abort.tap(\n pluginName,\n (ctx: { preventDefault: boolean }) => {\n const runIds = this.options.getRunIds();\n runIds.forEach((runId) => this.options.onAbort(runId));\n // this.sending = false;\n const text = this.queue.shift();\n if (text) {\n this.options.onSend(text);\n } else {\n this.sending = false;\n }\n return {\n preventDefault: true,\n };\n },\n );\n }\n}\n"],"names":[],"mappings":";;AAcA,MAAM,UAAU,GAAG,YAAY,CAAC;AAE1B,MAAO,UAAW,SAAQ,aAAa,CAAA;AAO3C,IAAA,WAAA,CAAY,OAA0B,EAAA;AACpC,QAAA,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC,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