@twentyfourg/chat-kit 1.0.0-beta.2 → 1.0.0-beta.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/README.md +31 -0
- package/dist/chat-kit.js +17 -8
- package/dist/chat-kit.js.map +1 -1
- package/dist/components/Chat.vue.d.ts +7 -2
- package/dist/components/InputBar.vue.d.ts +8 -2
- package/dist/index.css +1 -1
- package/dist/theme.css +8 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -114,8 +114,21 @@ that changes once the conversation has started, say) can be a computed.
|
|
|
114
114
|
| `message-actions` | Scoped, gives you `{ message }`. Sits on the left of the row that holds the thumbs, on finished replies. This is where an app's own button goes, an export for example, and it comes before the kit's copy button so your actions stay together. |
|
|
115
115
|
| `message-footer` | Scoped, gives you `{ message }`. Whatever your app wants under a reply, below its sources and actions: follow-up prompts, a link back to something above. Rendered for every reply, streaming included, so check `message.isStreaming` if it should wait. |
|
|
116
116
|
| `composer` | Replaces the whole composer. For a state the kit's field has no shape for, such as a locked bar with an upgrade prompt. Your content calls `engine.sendMessage` itself if it needs to send. |
|
|
117
|
+
| `send` | Scoped, gives you `{ send, canSend }`. Replaces the send button and nothing else, so the field keeps its own typing, dictation, and Enter handling. For a client whose send button is a finished asset that draws its own shape and disabled state. Not rendered while an answer streams, when the stop button has the spot. |
|
|
117
118
|
| `composer-footer` | Sits inside the composer, under the field. An option that changes how the next question is handled, a hint, a counter. |
|
|
118
119
|
|
|
120
|
+
Your own send button, keeping everything else the kit does:
|
|
121
|
+
|
|
122
|
+
```vue
|
|
123
|
+
<Chat :engine="engine">
|
|
124
|
+
<template #send="{ send, canSend }">
|
|
125
|
+
<button :disabled="!canSend" @click="send">
|
|
126
|
+
<img :src="canSend ? sendIcon : sendDisabledIcon" alt="Send" />
|
|
127
|
+
</button>
|
|
128
|
+
</template>
|
|
129
|
+
</Chat>
|
|
130
|
+
```
|
|
131
|
+
|
|
119
132
|
### Events
|
|
120
133
|
|
|
121
134
|
`Chat` emits `rated` with the message and the rating now on it, or `null`
|
|
@@ -152,6 +165,24 @@ The heading, label, and interface fonts follow `--font-body` unless you set
|
|
|
152
165
|
them. The citation and button accents follow `--accent`. An app that already
|
|
153
166
|
defines the whole set itself can skip the import.
|
|
154
167
|
|
|
168
|
+
### Room around the chat
|
|
169
|
+
|
|
170
|
+
Two properties control how much space the chat takes, separately from the rest
|
|
171
|
+
of the theme:
|
|
172
|
+
|
|
173
|
+
| Property | Default | What it does |
|
|
174
|
+
| --- | --- | --- |
|
|
175
|
+
| `--chat-inset` | `24px` | The gutter between the chat's edge and its contents. The conversation and the composer both read it, so they stay lined up with each other. |
|
|
176
|
+
| `--composer-padding` | `8px` | Space between the composer's border and the field inside it. The 40px buttons set the height, not the text, so this is added to those: the default makes a 56px composer plus its border. |
|
|
177
|
+
|
|
178
|
+
A roomier chat, for a design with space to spend:
|
|
179
|
+
|
|
180
|
+
```css
|
|
181
|
+
:root {
|
|
182
|
+
--composer-padding: 24px;
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
155
186
|
One thing to watch. If your own tokens live inside a CSS cascade layer, layer
|
|
156
187
|
order decides the winner before anything else does. Import `theme.css` before
|
|
157
188
|
your layered styles, or state the order yourself:
|
package/dist/chat-kit.js
CHANGED
|
@@ -1271,8 +1271,10 @@ var it = {
|
|
|
1271
1271
|
}, {
|
|
1272
1272
|
default: j(() => [l(Z, { name: "stop" })]),
|
|
1273
1273
|
_: 1
|
|
1274
|
-
}, 8, ["label"])) : (
|
|
1275
|
-
|
|
1274
|
+
}, 8, ["label"])) : w(t.$slots, "send", {
|
|
1275
|
+
send: O,
|
|
1276
|
+
canSend: x.value
|
|
1277
|
+
}, () => [l(X, {
|
|
1276
1278
|
class: "input-bar__send",
|
|
1277
1279
|
label: D(u).composer.sendLabel,
|
|
1278
1280
|
disabled: !x.value,
|
|
@@ -1283,9 +1285,9 @@ var it = {
|
|
|
1283
1285
|
size: 20
|
|
1284
1286
|
})]),
|
|
1285
1287
|
_: 1
|
|
1286
|
-
}, 8, ["label", "disabled"]))])]), w(t.$slots, "footer", {}, void 0, !0)]));
|
|
1288
|
+
}, 8, ["label", "disabled"])], !0, 3)])]), w(t.$slots, "footer", {}, void 0, !0)]));
|
|
1287
1289
|
}
|
|
1288
|
-
}), [["__scopeId", "data-v-
|
|
1290
|
+
}), [["__scopeId", "data-v-4e9c096d"]]), St = 20, Ct = 300, wt = .3, Tt = 12, Et = 8;
|
|
1289
1291
|
function Dt(e, t = {}) {
|
|
1290
1292
|
let n = S("following"), r = !1, i = 0, a = !1, o = null, s = !1, c = () => t.mode?.() ?? "reply";
|
|
1291
1293
|
function l(e) {
|
|
@@ -1893,7 +1895,7 @@ var Mt = { class: "citation-popover__source" }, Nt = ["src"], Pt = { class: "cit
|
|
|
1893
1895
|
}, E(D(u).status.retryLabel), 1)])) : i("", !0)
|
|
1894
1896
|
], 512));
|
|
1895
1897
|
}
|
|
1896
|
-
}), [["__scopeId", "data-v-
|
|
1898
|
+
}), [["__scopeId", "data-v-7817c1d9"]]), rr = { class: "chat" }, ir = /*#__PURE__*/ Y(/* @__PURE__ */ u({
|
|
1897
1899
|
__name: "Chat",
|
|
1898
1900
|
props: {
|
|
1899
1901
|
engine: {},
|
|
@@ -1957,13 +1959,20 @@ var Mt = { class: "citation-popover__source" }, Nt = ["src"], Pt = { class: "cit
|
|
|
1957
1959
|
"show-mic": e.showMic,
|
|
1958
1960
|
onSend: i,
|
|
1959
1961
|
onStop: n[1] ||= () => e.engine.stopGeneration()
|
|
1960
|
-
}, s({ _: 2 }, [t.$slots
|
|
1962
|
+
}, s({ _: 2 }, [t.$slots.send ? {
|
|
1963
|
+
name: "send",
|
|
1964
|
+
fn: j(({ send: e, canSend: n }) => [w(t.$slots, "send", {
|
|
1965
|
+
send: e,
|
|
1966
|
+
canSend: n
|
|
1967
|
+
}, void 0, !0)]),
|
|
1968
|
+
key: "0"
|
|
1969
|
+
} : void 0, t.$slots["composer-footer"] ? {
|
|
1961
1970
|
name: "footer",
|
|
1962
1971
|
fn: j(() => [w(t.$slots, "composer-footer", {}, void 0, !0)]),
|
|
1963
|
-
key: "
|
|
1972
|
+
key: "1"
|
|
1964
1973
|
} : void 0]), 1032, ["busy", "show-mic"])], !0)]));
|
|
1965
1974
|
}
|
|
1966
|
-
}), [["__scopeId", "data-v-
|
|
1975
|
+
}), [["__scopeId", "data-v-7ae994a7"]]);
|
|
1967
1976
|
//#endregion
|
|
1968
1977
|
export { H as AnonymousAuthError, ue as BaseCampClient, le as BaseCampError, ir as Chat, X as IconButton, et as MockTransport, fe as RateLimitError, Ke as StreamingMessage, Ye as Typewriter, U as consumeSSEResponse, ce as createAnonymousTokenProvider, G as decodeHtmlEntities, L as defaultChatCopy, ie as fetchAuthConfig, R as formatCopy, re as provideChatCopy, W as renderMarkdownSafe, Ve as renderMarkdownStreaming, te as resolveChatCopy, se as signInAnonymously, Se as streamSSE, Ge as stripHtmlTags, B as useChatCopy, Qe as useChatEngine };
|
|
1969
1978
|
|