@hackbuild/ai-views 0.1.9 → 0.1.11

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/vue.js CHANGED
@@ -34,11 +34,15 @@ function hosted(setupMount, deps = () => []) {
34
34
  export const ModelSelect = defineComponent({
35
35
  name: "ModelSelect",
36
36
  props: {
37
+ /** The job to pick for when no pick is passed: chat, voice, transcribe, detect and the rest. */
37
38
  job: { type: String, default: "chat" },
39
+ /** A picker made with useModelPick, shared with the code that uses the model. Without one the view makes its own and emits it as `pick`. */
38
40
  pick: { type: Object, default: undefined },
39
41
  variant: { type: String, default: "line" },
40
42
  go: { type: Boolean, default: true },
43
+ /** What this machine can run, from probe(); rows it cannot run say why. Used only when no pick is passed. */
41
44
  env: { type: Object, default: undefined },
45
+ /** Fetches and starts the chosen model, such as jobLoader(job). Used only when no pick is passed. */
42
46
  loader: { type: Function, default: undefined },
43
47
  },
44
48
  emits: ["choose", "pick", "loaded", "failed"],
@@ -64,9 +68,13 @@ export const ModelSelect = defineComponent({
64
68
  export const ChatPane = defineComponent({
65
69
  name: "ChatPane",
66
70
  props: {
71
+ /** The thread to draw, from chatThread or a chatList's thread. */
67
72
  thread: { type: Object, required: true },
73
+ /** The reply's name in its head. */
68
74
  name: { type: String, default: "reply" },
75
+ /** The empty state's line, shown until the first turn. */
69
76
  emptyName: { type: String, default: "what are we working on?" },
77
+ /** A plain note under the empty state's line. */
70
78
  emptyNote: { type: String, default: "" },
71
79
  },
72
80
  setup: hosted((host, p) => mountChatPane(host, p.thread, { name: p.name, emptyName: p.emptyName, emptyNote: p.emptyNote }), (p) => [p.thread]),
@@ -74,19 +82,31 @@ export const ChatPane = defineComponent({
74
82
  /** Vue component for the message box of a chat thread. */
75
83
  export const Composer = defineComponent({
76
84
  name: "Composer",
77
- props: { thread: { type: Object, required: true }, placeholder: { type: String, default: "say something" } },
85
+ props: {
86
+ /** The thread a message goes to. */
87
+ thread: { type: Object, required: true },
88
+ /** The box's placeholder. */
89
+ placeholder: { type: String, default: "say something" },
90
+ },
78
91
  setup: hosted((host, p) => mountComposer(host, p.thread, { placeholder: p.placeholder }), (p) => [p.thread]),
79
92
  });
80
93
  /** Vue component for the drop zone that becomes the transcript; emits `sample` and `drop` (the handle, whose `pick` opens the file picker). */
81
94
  export const TranscribeDrop = defineComponent({
82
95
  name: "TranscribeDrop",
83
96
  props: {
97
+ /** The queue from transcribeQueue: files, their transcripts, edits and undo. */
84
98
  queue: { type: Object, required: true },
99
+ /** The file types the picker offers; a drop takes any audio or video. */
85
100
  accept: { type: String, default: "audio/*,video/*" },
101
+ /** A sample button's label; empty hides it. A press emits `sample` for the page to queue one. */
86
102
  sampleLabel: { type: String, default: "" },
103
+ /** The zone's line before anything is dropped. */
87
104
  title: { type: String, default: "" },
105
+ /** A plain note under the line. */
88
106
  note: { type: String, default: "" },
107
+ /** Add a "choose a folder" button; a dropped folder is read whole either way. */
89
108
  folders: { type: Boolean, default: false },
109
+ /** Show the lines the cleanup dropped (repeats, phantom text), struck through. */
90
110
  showDropped: { type: Boolean, default: false },
91
111
  },
92
112
  emits: ["sample", "drop"],
@@ -106,14 +126,23 @@ export const TranscribeDrop = defineComponent({
106
126
  /** Vue component for the export menu of a transcribe queue: four formats, copy, all as zip, undo and redo. */
107
127
  export const ExportMenu = defineComponent({
108
128
  name: "ExportMenu",
109
- props: { queue: { type: Object, required: true }, tool: { type: String, default: "" }, go: { type: Boolean, default: false } },
129
+ props: {
130
+ /** The queue from transcribeQueue: files, their transcripts, edits and undo. */
131
+ queue: { type: Object, required: true },
132
+ /** The tool name written into an export's header and the zip manifest. */
133
+ tool: { type: String, default: "" },
134
+ /** Make the main export button the pink action. */
135
+ go: { type: Boolean, default: false },
136
+ },
110
137
  setup: hosted((host, p) => mountExportMenu(host, p.queue, { go: p.go, ...(p.tool ? { tool: p.tool } : {}) }), (p) => [p.queue, p.go]),
111
138
  });
112
139
  /** Vue component for a memory pane over a store; emits `pane` with the handle (refresh, used). */
113
140
  export const MemoryPane = defineComponent({
114
141
  name: "MemoryPane",
115
142
  props: {
143
+ /** The store to show: a @hackbuild/memory store or anything with the same list, edit and forget calls. */
116
144
  memory: { type: Object, required: true },
145
+ /** The pane's heading. */
117
146
  name: { type: String, default: "memory" },
118
147
  by: { type: String, default: "source" },
119
148
  kinds: { type: Object, default: undefined },
@@ -130,38 +159,68 @@ export const MemoryPane = defineComponent({
130
159
  /** Vue component for a sources drop: files and folders into memory through `ingest`. */
131
160
  export const SourcesDrop = defineComponent({
132
161
  name: "SourcesDrop",
133
- props: { ingest: { type: Function, required: true }, accept: { type: String, default: "" } },
162
+ props: {
163
+ /** @hackbuild/memory `ingest(mem, files, o)` bound to a store; resolves to the files and parts read. */
164
+ ingest: { type: Function, required: true },
165
+ /** The file types the picker offers; empty takes text, markdown, csv, json, html, pdf, docx, zip and eml. */
166
+ accept: { type: String, default: "" },
167
+ },
134
168
  setup: hosted((host, p) => mountSourcesDrop(host, { ingest: p.ingest, ...(p.accept ? { accept: p.accept } : {}) }), (p) => [p.ingest]),
135
169
  });
136
170
  /** Vue component for a persona rack. */
137
171
  export const PersonaRack = defineComponent({
138
172
  name: "PersonaRack",
139
- props: { rack: { type: Object, required: true } },
173
+ props: {
174
+ /** The persona state from personaRack: name, prompt, presets and saved ones. */
175
+ rack: { type: Object, required: true },
176
+ },
140
177
  setup: hosted((host, p) => mountPersonaRack(host, p.rack), (p) => [p.rack]),
141
178
  });
142
179
  /** Vue component for a voice row. */
143
180
  export const VoiceRow = defineComponent({
144
181
  name: "VoiceRow",
145
- props: { row: { type: Object, required: true }, test: { type: String, default: "" } },
182
+ props: {
183
+ /** The voice state from voiceRow: voice, rate, pitch and auto speak. */
184
+ row: { type: Object, required: true },
185
+ /** The line the test button reads; empty uses the row's own. */
186
+ test: { type: String, default: "" },
187
+ },
146
188
  setup: hosted((host, p) => mountVoiceRow(host, p.row, p.test ? { test: p.test } : {}), (p) => [p.row]),
147
189
  });
148
190
  /** Vue component for the voice clone row of a speaker; `can` says the loaded voice clones. */
149
191
  export const VoiceClone = defineComponent({
150
192
  name: "VoiceClone",
151
- props: { speaker: { type: Object, required: true }, can: { type: Boolean, default: true }, seconds: { type: Number, default: 10 }, hint: { type: String, default: "" } },
193
+ props: {
194
+ /** The speaker from speaker(): its engine takes the reference clip. */
195
+ speaker: { type: Object, required: true },
196
+ /** Whether the loaded voice can clone; when false the row says to load one that can. */
197
+ can: { type: Boolean, default: true },
198
+ /** How many seconds the microphone records. */
199
+ seconds: { type: Number, default: 10 },
200
+ /** A plain line under the row. */
201
+ hint: { type: String, default: "" },
202
+ },
152
203
  setup: hosted((host, p) => mountVoiceClone(host, p.speaker, { seconds: p.seconds, can: () => p.can, ...(p.hint ? { hint: p.hint } : {}) }), (p) => [p.speaker, p.can]),
153
204
  });
154
205
  /** Vue component for the session menu of a chat list; emits `import` with the number of chats. */
155
206
  export const SessionMenu = defineComponent({
156
207
  name: "SessionMenu",
157
- props: { list: { type: Object, required: true } },
208
+ props: {
209
+ /** The chat list to export, import and clear. */
210
+ list: { type: Object, required: true },
211
+ },
158
212
  emits: ["import"],
159
213
  setup: hosted((host, p, emit) => mountSessionMenu(host, p.list, { onImport: (n) => emit("import", n) }), (p) => [p.list]),
160
214
  });
161
215
  /** Vue component for the selected transcript, or its export buttons when `exports` is set. */
162
216
  export const TranscriptView = defineComponent({
163
217
  name: "TranscriptView",
164
- props: { queue: { type: Object, required: true }, exports: { type: Boolean, default: false } },
218
+ props: {
219
+ /** The queue from transcribeQueue: files, their transcripts, edits and undo. */
220
+ queue: { type: Object, required: true },
221
+ /** Show the export buttons for the selected file instead of its lines. */
222
+ exports: { type: Boolean, default: false },
223
+ },
165
224
  setup: hosted((host, p) => (p.exports ? mountTranscriptExports(host, p.queue) : mountTranscriptView(host, p.queue)), (p) => [p.queue, p.exports]),
166
225
  });
167
226
  /**
@@ -170,7 +229,14 @@ export const TranscriptView = defineComponent({
170
229
  */
171
230
  export const MaskStudio = defineComponent({
172
231
  name: "MaskStudio",
173
- props: { models: { type: Object, default: () => ({}) }, sampleLabel: { type: String, default: "" }, demand: { type: Boolean, default: false } },
232
+ props: {
233
+ /** The models it may use: a click segment and a segment everything. With none, the hand tools still work. */
234
+ models: { type: Object, default: () => ({}) },
235
+ /** A sample button's label; empty hides it. A press emits `sample` for the page to set an image. */
236
+ sampleLabel: { type: String, default: "" },
237
+ /** Show the model tools before their models load; using one emits `want` so the page loads it. */
238
+ demand: { type: Boolean, default: false },
239
+ },
174
240
  emits: ["studio", "sample", "want"],
175
241
  setup(props, { emit }) {
176
242
  const el = ref(null);
@@ -190,21 +256,30 @@ export const MaskStudio = defineComponent({
190
256
  /** Vue component for the tool rail of a mask studio. */
191
257
  export const MaskTools = defineComponent({
192
258
  name: "MaskTools",
193
- props: { studio: { type: Object, required: true } },
259
+ props: {
260
+ /** The studio from mountMaskStudio, or the one MaskStudio emits as `studio`. */
261
+ studio: { type: Object, required: true },
262
+ },
194
263
  setup: hosted((host, p) => mountMaskTools(host, p.studio), (p) => [p.studio]),
195
264
  });
196
265
  /** Vue component for the undo, redo and zoom row of a mask studio. */
197
266
  export const MaskVerbs = defineComponent({
198
267
  name: "MaskVerbs",
199
- props: { studio: { type: Object, required: true } },
268
+ props: {
269
+ /** The studio from mountMaskStudio, or the one MaskStudio emits as `studio`. */
270
+ studio: { type: Object, required: true },
271
+ },
200
272
  setup: hosted((host, p) => mountMaskVerbs(host, p.studio), (p) => [p.studio]),
201
273
  });
202
274
  /** Vue component for one rack part of a mask studio: found, mask, saved or export. */
203
275
  export const MaskRack = defineComponent({
204
276
  name: "MaskRack",
205
277
  props: {
278
+ /** The studio from mountMaskStudio, or the one MaskStudio emits as `studio`. */
206
279
  studio: { type: Object, required: true },
280
+ /** Which panel: the found objects, the mask tools, saved masks or the exports. */
207
281
  part: { type: String, default: "found" },
282
+ /** The exported files' name, without extension. */
208
283
  name: { type: String, default: "mask" },
209
284
  },
210
285
  setup: hosted((host, p) => mountMaskRack(host, p.studio, p.part, { name: p.name }), (p) => [p.studio, p.part]),
@@ -213,7 +288,9 @@ export const MaskRack = defineComponent({
213
288
  export const ModelJobs = defineComponent({
214
289
  name: "ModelJobs",
215
290
  props: {
291
+ /** The rack made with useJobsPick: one picker per job, presets and load all. */
216
292
  jobs: { type: Object, required: true },
293
+ /** Draw the pink load all. Off on a gate, whose own button is the pink action. */
217
294
  go: { type: Boolean, default: true },
218
295
  },
219
296
  setup: hosted((host, p) => mountModelJobs(host, p.jobs, { go: p.go }), (p) => [p.jobs, p.go]),
@@ -221,13 +298,19 @@ export const ModelJobs = defineComponent({
221
298
  /** Vue component for the file list of a transcribe queue. */
222
299
  export const TranscribeQueue = defineComponent({
223
300
  name: "TranscribeQueue",
224
- props: { queue: { type: Object, required: true } },
301
+ props: {
302
+ /** The queue from transcribeQueue: files, their transcripts, edits and undo. */
303
+ queue: { type: Object, required: true },
304
+ },
225
305
  setup: hosted((host, p) => mountTranscribeQueue(host, p.queue), (p) => [p.queue]),
226
306
  });
227
307
  /** Vue component that shows a recall trace as a table. */
228
308
  export const MemoryInspector = defineComponent({
229
309
  name: "MemoryInspector",
230
- props: { recall: { type: Object, default: null } },
310
+ props: {
311
+ /** The last recall from @hackbuild/memory: its query, mode, hits and the trace of each memory scored. */
312
+ recall: { type: Object, default: null },
313
+ },
231
314
  setup(props) {
232
315
  const el = ref(null);
233
316
  let m = null;
@@ -240,13 +323,25 @@ export const MemoryInspector = defineComponent({
240
323
  /** Vue component for the chat list rail of a `chatList`. */
241
324
  export const ChatList = defineComponent({
242
325
  name: "ChatList",
243
- props: { list: { type: Object, required: true }, label: { type: String, default: "chats" } },
326
+ props: {
327
+ /** The chats, from chatList: each a thread, one of them open. */
328
+ list: { type: Object, required: true },
329
+ /** The rail's accessible name. */
330
+ label: { type: String, default: "chats" },
331
+ },
244
332
  setup: hosted((host, p) => mountChatList(host, p.list, { label: p.label }), (p) => [p.list]),
245
333
  });
246
334
  /** Vue component that shows what the next request carries against the context budget. */
247
335
  export const ContextMeter = defineComponent({
248
336
  name: "ContextMeter",
249
- props: { thread: { type: Object, required: true }, budget: { type: Number, default: 4096 }, system: { type: String, default: "" } },
337
+ props: {
338
+ /** The thread whose next request is measured. */
339
+ thread: { type: Object, required: true },
340
+ /** The model's context window in tokens. */
341
+ budget: { type: Number, default: 4096 },
342
+ /** The system prompt that rides with every request. */
343
+ system: { type: String, default: "" },
344
+ },
250
345
  setup: hosted((host, p) => mountContextMeter(host, p.thread, { budget: () => p.budget, system: () => p.system }), (p) => [p.thread]),
251
346
  });
252
347
  /**
@@ -256,8 +351,11 @@ export const ContextMeter = defineComponent({
256
351
  export const FrameView = defineComponent({
257
352
  name: "FrameView",
258
353
  props: {
354
+ /** The picture: a URL, an image, a live video or a canvas. */
259
355
  source: { type: [String, Object], default: null },
356
+ /** What to draw on it, in image pixels: boxes, landmarks, a caption and a corner tag. */
260
357
  results: { type: Object, default: () => ({}) },
358
+ /** Flip it left to right, as a front camera reads. */
261
359
  mirror: { type: Boolean, default: false },
262
360
  },
263
361
  emits: ["view"],
@@ -282,7 +380,10 @@ export const FrameView = defineComponent({
282
380
  /** Vue component that opens the camera; emits `feed` with the feed and `frame` with the video at `fps`. */
283
381
  export const CameraFeed = defineComponent({
284
382
  name: "CameraFeed",
285
- props: { fps: { type: Number, default: 4 } },
383
+ props: {
384
+ /** How many times a second the video goes out as `frame` while live. */
385
+ fps: { type: Number, default: 4 },
386
+ },
286
387
  emits: ["feed", "frame"],
287
388
  setup: hosted((host, p, emit) => {
288
389
  const feed = mountCameraFeed(host, { fps: p.fps, onFrame: (v) => emit("frame", v) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackbuild/ai-views",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Views that bind the browser AI packages to hackbuild-ui: a model picker per job, a chat pane and composer, a drop first transcriber, a mask studio, a frame view and a camera feed. Each ships as a Vue component and a custom element.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "@hackbuild/chat": "0.1.3",
47
47
  "@hackbuild/devices": "0.1.4",
48
48
  "@hackbuild/embed": "0.1.5",
49
- "@hackbuild/imagegen": "0.2.1",
49
+ "@hackbuild/imagegen": "0.2.2",
50
50
  "@hackbuild/memory": "0.1.4",
51
51
  "@hackbuild/models": "0.2.3",
52
52
  "@hackbuild/speak": "0.1.4",