@molecule/app-chatbot-tester-vue 0.0.0-stage → 1.1.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/LICENSE +202 -0
- package/README.md +355 -2
- package/dist/ChatbotTester.d.ts +73 -0
- package/dist/ChatbotTester.d.ts.map +1 -0
- package/dist/ChatbotTester.js +148 -0
- package/dist/ChatbotTester.js.map +1 -0
- package/dist/ChatbotTesterInput.d.ts +51 -0
- package/dist/ChatbotTesterInput.d.ts.map +1 -0
- package/dist/ChatbotTesterInput.js +105 -0
- package/dist/ChatbotTesterInput.js.map +1 -0
- package/dist/ChatbotTesterMessages.d.ts +36 -0
- package/dist/ChatbotTesterMessages.d.ts.map +1 -0
- package/dist/ChatbotTesterMessages.js +72 -0
- package/dist/ChatbotTesterMessages.js.map +1 -0
- package/dist/dom.d.ts +38 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +57 -0
- package/dist/dom.js.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +71 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +66 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@molecule/app-chatbot-tester-vue` — Vue sandbox UI shell for live-testing
|
|
3
|
+
* conversational AI: optional bot picker, message transcript, input row,
|
|
4
|
+
* error display.
|
|
5
|
+
*
|
|
6
|
+
* Stateless about transport. The consumer owns the message array, send
|
|
7
|
+
* handler, and bot list; the package handles the layout and composition.
|
|
8
|
+
*
|
|
9
|
+
* Extracted from the ai-chatbot-builder TestChat page; usable for any
|
|
10
|
+
* "preview your bot live" UI. This is the Vue counterpart of
|
|
11
|
+
* `@molecule/app-chatbot-tester-react`: the same props (React names) and the
|
|
12
|
+
* same DOM for the same input, so an app swaps framework by changing only the
|
|
13
|
+
* package name in its imports.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { defineComponent, h, ref } from 'vue'
|
|
18
|
+
* import { ChatbotTester, type TesterMessage } from '@molecule/app-chatbot-tester-vue'
|
|
19
|
+
*
|
|
20
|
+
* export default defineComponent({
|
|
21
|
+
* setup() {
|
|
22
|
+
* const messages = ref<TesterMessage[]>([])
|
|
23
|
+
* const sending = ref(false)
|
|
24
|
+
* const send = async (text: string) => {
|
|
25
|
+
* messages.value = [...messages.value, { id: Date.now(), role: 'user', content: text }]
|
|
26
|
+
* const reply = await http.post(`/api/conversations/${conversationId}/messages`, { content: text })
|
|
27
|
+
* messages.value = [...messages.value, { id: reply.id, role: 'assistant', content: reply.content }]
|
|
28
|
+
* }
|
|
29
|
+
* return () =>
|
|
30
|
+
* h(ChatbotTester, {
|
|
31
|
+
* messages: messages.value,
|
|
32
|
+
* onSend: send,
|
|
33
|
+
* loading: sending.value,
|
|
34
|
+
* bots,
|
|
35
|
+
* botId: botId.value,
|
|
36
|
+
* onBotChange: (id: string) => (botId.value = id),
|
|
37
|
+
* error: error.value,
|
|
38
|
+
* })
|
|
39
|
+
* },
|
|
40
|
+
* })
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Built-in labels (`botPickerLabel` "Test bot", `inputPlaceholder`
|
|
45
|
+
* "Type a message…", `sendLabel` "Send") go through `t()` with the
|
|
46
|
+
* `chatbotTester.*` keys of the companion locale bond
|
|
47
|
+
* `@molecule/app-locales-chatbot-tester`; an explicit prop still overrides
|
|
48
|
+
* them.
|
|
49
|
+
* Enter sends; Shift+Enter inserts a newline. The bot picker renders only
|
|
50
|
+
* when `bots` has 2+ entries. Node-valued props (`error`, `emptyState`,
|
|
51
|
+
* `botPickerLabel`) arrive as a prop or as the same-named slot; components
|
|
52
|
+
* accept either. Styling includes Tailwind classes with Material-3 tokens
|
|
53
|
+
* (`bg-surface-container-high`, `border-outline-variant`, `text-on-primary`,
|
|
54
|
+
* …) — the app's Tailwind theme must define those tokens (the default
|
|
55
|
+
* molecule Tailwind ClassMap bond does); with a non-Tailwind ClassMap the
|
|
56
|
+
* bubbles/borders lose their styling.
|
|
57
|
+
*
|
|
58
|
+
* @module
|
|
59
|
+
*/
|
|
60
|
+
export * from './ChatbotTester.js';
|
|
61
|
+
export * from './ChatbotTesterInput.js';
|
|
62
|
+
export * from './ChatbotTesterMessages.js';
|
|
63
|
+
export * from './types.js';
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,YAAY,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Vue chatbot-tester sandbox UI — the same props (React names)
|
|
3
|
+
* as `@molecule/app-chatbot-tester-react`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { VNodeChild } from 'vue';
|
|
8
|
+
/** A single chat message displayed in the chatbot tester sandbox UI. */
|
|
9
|
+
export interface TesterMessage {
|
|
10
|
+
id: string | number;
|
|
11
|
+
role: 'user' | 'assistant' | 'system';
|
|
12
|
+
content: string;
|
|
13
|
+
timestamp?: string;
|
|
14
|
+
}
|
|
15
|
+
/** A selectable bot/agent option shown in the chatbot tester sandbox UI. */
|
|
16
|
+
export interface TesterBotOption {
|
|
17
|
+
id: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Props accepted by the {@link ChatbotTester} component. */
|
|
21
|
+
export interface ChatbotTesterProps {
|
|
22
|
+
/** The transcript, in display order. */
|
|
23
|
+
messages: TesterMessage[];
|
|
24
|
+
/** A reply is in flight: the composer and its send action are disabled. */
|
|
25
|
+
loading?: boolean;
|
|
26
|
+
/** Called with the trimmed composer text when the user sends. */
|
|
27
|
+
onSend: (text: string) => void | Promise<void>;
|
|
28
|
+
/** Optional bot list — when length >= 2, a picker is rendered. */
|
|
29
|
+
bots?: TesterBotOption[];
|
|
30
|
+
/** The selected bot id (controlled). */
|
|
31
|
+
botId?: string;
|
|
32
|
+
/** Called with the newly selected bot id. */
|
|
33
|
+
onBotChange?: (id: string) => void;
|
|
34
|
+
/** Last error message — rendered in a `role="alert"` paragraph. Passed as a prop or as the same-named slot. */
|
|
35
|
+
error?: VNodeChild;
|
|
36
|
+
/** Empty-state slot when there are no messages yet. Passed as a prop or as the same-named slot. */
|
|
37
|
+
emptyState?: VNodeChild;
|
|
38
|
+
/** The bot picker's label — an explicit value overrides `t('chatbotTester.label.testBot')` (`'Test bot'`). Passed as a prop or as the same-named slot. */
|
|
39
|
+
botPickerLabel?: VNodeChild;
|
|
40
|
+
/** Composer placeholder — an explicit value overrides `t('chatbotTester.placeholder.message')` (`'Type a message…'`). */
|
|
41
|
+
inputPlaceholder?: string;
|
|
42
|
+
/** Send button label — an explicit value overrides `t('chatbotTester.label.send')` (`'Send'`). */
|
|
43
|
+
sendLabel?: string;
|
|
44
|
+
/** Extra classes on the outer wrapper. */
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Props accepted by the {@link ChatbotTesterInput} component. */
|
|
48
|
+
export interface ChatbotTesterInputProps {
|
|
49
|
+
/** The composer's current text (controlled). */
|
|
50
|
+
value: string;
|
|
51
|
+
/** Called with the field's new text on every edit. */
|
|
52
|
+
onChange: (next: string) => void;
|
|
53
|
+
/** Called when the user presses Enter (without Shift) or clicks send. */
|
|
54
|
+
onSend: () => void;
|
|
55
|
+
/** A reply is in flight: the field and the send button are disabled. */
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
/** Placeholder text — an explicit value overrides `t('chatbotTester.placeholder.message')` (`'Type a message…'`). */
|
|
58
|
+
placeholder?: string;
|
|
59
|
+
/** Send button label — an explicit value overrides `t('chatbotTester.label.send')` (`'Send'`). */
|
|
60
|
+
sendLabel?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Props accepted by the {@link ChatbotTesterMessages} component. */
|
|
63
|
+
export interface ChatbotTesterMessagesProps {
|
|
64
|
+
/** The transcript, in display order. */
|
|
65
|
+
messages: TesterMessage[];
|
|
66
|
+
/** A reply is in flight: the typing indicator is appended. */
|
|
67
|
+
loading?: boolean;
|
|
68
|
+
/** Rendered instead of the transcript when there are no messages. Passed as a prop or as the same-named slot. */
|
|
69
|
+
emptyState?: VNodeChild;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC,wEAAwE;AACxE,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,6DAA6D;AAC7D,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iEAAiE;IACjE,MAAM,EAAE,CAAC,IAAI,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names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-chatbot-tester-vue",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Bot-picker + transcript + composer sandbox UI",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-chatbot-tester-vue",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"dev": "vue-tsc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"chatbot",
|
|
28
|
+
"playground",
|
|
29
|
+
"tester",
|
|
30
|
+
"ai",
|
|
31
|
+
"vue"
|
|
32
|
+
],
|
|
33
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
38
|
+
"directory": "packages/app/features/chatbot-tester-vue"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20"
|
|
42
|
+
},
|
|
43
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@molecule/app-ui": "^1.3.11",
|
|
49
|
+
"@molecule/app-ui-vue": "^1.1.0",
|
|
50
|
+
"@molecule/app-vue": "^3.5.0",
|
|
51
|
+
"vue": "^3.4.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
55
|
+
"@molecule/app-i18n": "1.2.2",
|
|
56
|
+
"@molecule/app-icons": "1.0.4",
|
|
57
|
+
"@molecule/app-ui": "1.4.0",
|
|
58
|
+
"@molecule/app-ui-vue": "1.1.5",
|
|
59
|
+
"@molecule/app-vue": "3.7.2",
|
|
60
|
+
"@types/node": "26.6.5",
|
|
61
|
+
"jsdom": "30.1.3",
|
|
62
|
+
"typescript": "6.0.3",
|
|
63
|
+
"vite": "8.3.5",
|
|
64
|
+
"vitest": "4.1.12",
|
|
65
|
+
"vue": "3.5.44",
|
|
66
|
+
"vue-tsc": "3.3.13"
|
|
67
|
+
}
|
|
68
|
+
}
|