@yaks/speech 0.0.0-stage → 0.2.36
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 +185 -2
- package/_dist/audio.d.ts +65 -0
- package/_dist/audio.d.ts.map +1 -0
- package/_dist/deepgram.d.ts +3 -0
- package/_dist/deepgram.d.ts.map +1 -0
- package/_dist/elevenlabs.d.ts +3 -0
- package/_dist/elevenlabs.d.ts.map +1 -0
- package/_dist/mod.d.ts +677 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/openai.d.ts +4 -0
- package/_dist/openai.d.ts.map +1 -0
- package/_dist/query.d.ts +2 -0
- package/_dist/query.d.ts.map +1 -0
- package/_dist/speech-from.d.ts +22 -0
- package/_dist/speech-from.d.ts.map +1 -0
- package/_dist/ui.d.ts +56 -0
- package/_dist/ui.d.ts.map +1 -0
- package/_dist/vocab.d.ts +6 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/audio.js +141 -0
- package/audio.js.map +1 -0
- package/audio.ts +166 -0
- package/deepgram.js +509 -0
- package/deepgram.js.map +1 -0
- package/deepgram.ts +497 -0
- package/deno.json +1 -0
- package/elevenlabs.js +339 -0
- package/elevenlabs.js.map +1 -0
- package/elevenlabs.ts +284 -0
- package/mod.js +1113 -0
- package/mod.js.map +1 -0
- package/mod.ts +1777 -0
- package/openai.js +842 -0
- package/openai.js.map +1 -0
- package/openai.ts +714 -0
- package/package.json +30 -4
- package/query.js +7 -0
- package/query.js.map +1 -0
- package/query.ts +7 -0
- package/speech-from.js +33 -0
- package/speech-from.js.map +1 -0
- package/speech-from.ts +37 -0
- package/ui.js +52 -0
- package/ui.js.map +1 -0
- package/ui.ts +180 -0
- package/vocab.js +16 -0
- package/vocab.js.map +1 -0
- package/vocab.json +42 -0
- package/vocab.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaks/speech",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.36",
|
|
4
|
+
"homepage": "https://jsr.io/@yaks/speech",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./_dist/mod.d.ts",
|
|
9
|
+
"default": "./mod.js"
|
|
10
|
+
},
|
|
11
|
+
"./vocab": {
|
|
12
|
+
"types": "./_dist/vocab.d.ts",
|
|
13
|
+
"default": "./vocab.js"
|
|
14
|
+
},
|
|
15
|
+
"./ui": {
|
|
16
|
+
"types": "./_dist/ui.d.ts",
|
|
17
|
+
"default": "./ui.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@yaks/fp": "0.2.36",
|
|
23
|
+
"@yaks/model": "0.2.36",
|
|
24
|
+
"@yaks/ui": "0.2.36",
|
|
25
|
+
"@yaks/vocab": "0.2.36",
|
|
26
|
+
"@types/react": "19.3.0",
|
|
27
|
+
"lucide": "1.31.0",
|
|
28
|
+
"react": "19.3.0"
|
|
29
|
+
},
|
|
30
|
+
"description": "Speech to text, text to speech and speech to speech, each provider given as data: Deepgram, OpenAI and ElevenLabs, their endpoints, models, voices and prices.",
|
|
31
|
+
"repository": "https://github.com/yak-sh/yak.git"
|
|
32
|
+
}
|
package/query.js
ADDED
package/query.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sources":["./query.ts"],"names":[],"mappings":"AAAA,mEAAmE,GACnE,OAAO,IAAI,QAAQ,CACjB,IAEA,IAAI,gBACF,OAAO,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,GAAK,KAAK,OAAO,EAAE,GAAG;MAAC;QAAC;QAAG,OAAO;OAAG;KAAC,GACxE"}
|
package/query.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A query string of the values given, leaving out what is unset. */
|
|
2
|
+
export let query = (
|
|
3
|
+
o: Record<string, string | number | undefined>,
|
|
4
|
+
): URLSearchParams =>
|
|
5
|
+
new URLSearchParams(
|
|
6
|
+
Object.entries(o).flatMap(([k, v]) => v == null ? [] : [[k, String(v)]]),
|
|
7
|
+
)
|
package/speech-from.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// How a persona speaks aloud (`speech{voice, pace, model, backend, speaker}`,
|
|
2
|
+
// ./vocab.json): its own, each property it lacks its base persona's, and what
|
|
3
|
+
// none of them holds the host's to choose.
|
|
4
|
+
/** A persona's `speech{}`: each property an id the host knows, or none. */ let KEYS = [
|
|
5
|
+
'voice',
|
|
6
|
+
'pace',
|
|
7
|
+
'model',
|
|
8
|
+
'backend',
|
|
9
|
+
'speaker'
|
|
10
|
+
];
|
|
11
|
+
/** The speech of the first row in `chain` (a persona, then the persona it is
|
|
12
|
+
* worn on, and so on) that holds each property; a property none holds is
|
|
13
|
+
* absent, for the host's own.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { equal } from '@yaks/testing'
|
|
17
|
+
* import { speechFrom } from './speech-from.ts'
|
|
18
|
+
* equal(
|
|
19
|
+
* speechFrom({ speech: { pace: 'relaxed', voice: null } }, { speech: { voice: 'ash' } }),
|
|
20
|
+
* { voice: 'ash', pace: 'relaxed' },
|
|
21
|
+
* )
|
|
22
|
+
* equal(speechFrom(undefined, {}), {})
|
|
23
|
+
* ```
|
|
24
|
+
*/ export let speechFrom = (...chain)=>Object.fromEntries(KEYS.flatMap((k)=>{
|
|
25
|
+
let v = chain.map((row)=>row?.speech?.[k]).find((v)=>v != null);
|
|
26
|
+
return v == null ? [] : [
|
|
27
|
+
[
|
|
28
|
+
k,
|
|
29
|
+
v
|
|
30
|
+
]
|
|
31
|
+
];
|
|
32
|
+
}));
|
|
33
|
+
//# sourceMappingURL=speech-from.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speech-from.js","sources":["./speech-from.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,2CAA2C;AAE3C,yEAAyE,GASzE,IAAI,OAAO;EAAC;EAAS;EAAQ;EAAS;EAAW;CAAU;AAE3D;;;;;;;;;;;;;CAaC,GACD,OAAO,IAAI,aAAa,CACtB,GAAG,QAEH,OAAO,WAAW,CAAC,KAAK,OAAO,CAAC,CAAC;IAC/B,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC,MAAS,KAAK,QAA+B,CAAC,EAAE,EAChE,IAAI,CAAC,CAAC,IAAM,KAAK;IACpB,OAAO,KAAK,OAAO,EAAE,GAAG;MAAC;QAAC;QAAG;OAAE;KAAC;EAClC,IAAG"}
|
package/speech-from.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// How a persona speaks aloud (`speech{voice, pace, model, backend, speaker}`,
|
|
2
|
+
// ./vocab.json): its own, each property it lacks its base persona's, and what
|
|
3
|
+
// none of them holds the host's to choose.
|
|
4
|
+
|
|
5
|
+
/** A persona's `speech{}`: each property an id the host knows, or none. */
|
|
6
|
+
export type Speech = {
|
|
7
|
+
voice?: string | null
|
|
8
|
+
pace?: string | null
|
|
9
|
+
model?: string | null
|
|
10
|
+
backend?: string | null
|
|
11
|
+
speaker?: string | null
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let KEYS = ['voice', 'pace', 'model', 'backend', 'speaker'] as const
|
|
15
|
+
|
|
16
|
+
/** The speech of the first row in `chain` (a persona, then the persona it is
|
|
17
|
+
* worn on, and so on) that holds each property; a property none holds is
|
|
18
|
+
* absent, for the host's own.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { equal } from '@yaks/testing'
|
|
22
|
+
* import { speechFrom } from './speech-from.ts'
|
|
23
|
+
* equal(
|
|
24
|
+
* speechFrom({ speech: { pace: 'relaxed', voice: null } }, { speech: { voice: 'ash' } }),
|
|
25
|
+
* { voice: 'ash', pace: 'relaxed' },
|
|
26
|
+
* )
|
|
27
|
+
* equal(speechFrom(undefined, {}), {})
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export let speechFrom = (
|
|
31
|
+
...chain: (Record<string, unknown> | undefined)[]
|
|
32
|
+
): Speech =>
|
|
33
|
+
Object.fromEntries(KEYS.flatMap((k) => {
|
|
34
|
+
let v = chain.map((row) => (row?.speech as Speech | undefined)?.[k])
|
|
35
|
+
.find((v) => v != null)
|
|
36
|
+
return v == null ? [] : [[k, v]]
|
|
37
|
+
}))
|
package/ui.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// The `@yaks/speech/ui` facet: where a persona's people pick how it speaks
|
|
2
|
+
// on a call (`speech{}`, ./vocab.json), and where the host's admin picks the
|
|
3
|
+
// model that answers every call, drawn from the kit's parts. What each offers
|
|
4
|
+
// is its host's, which knows the providers it has keys for, and so is where
|
|
5
|
+
// its fields and its samples are sent.
|
|
6
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h } from "react";
|
|
7
|
+
import { Button, Card, Check, Form, Icon, More, Rows } from "@yaks/ui/parts";
|
|
8
|
+
// @ts-types="@yaks/ui/lucide"
|
|
9
|
+
import Play from "lucide/dist/esm/icons/play.mjs";
|
|
10
|
+
// One of a few to pick, as a radio: its name in bold, what it means beside
|
|
11
|
+
// it, `also` on its input.
|
|
12
|
+
let choice = (name, o, checked, also = {}, more = '')=>/*#__PURE__*/ h(Check, null, /*#__PURE__*/ h(Check.Input, {
|
|
13
|
+
type: 'radio',
|
|
14
|
+
name,
|
|
15
|
+
value: o.id,
|
|
16
|
+
checked,
|
|
17
|
+
...also
|
|
18
|
+
}), /*#__PURE__*/ h('span', null, /*#__PURE__*/ h('b', null, o.name), more, ' ', /*#__PURE__*/ h(Check.Note, null, o.about)));
|
|
19
|
+
// A field of few to pick one from, its label over them.
|
|
20
|
+
let choices = (id, label, name, offers, picked)=>/*#__PURE__*/ h(Form.Field, {
|
|
21
|
+
role: 'radiogroup',
|
|
22
|
+
'aria-labelledby': id
|
|
23
|
+
}, /*#__PURE__*/ h(Form.Label, {
|
|
24
|
+
id
|
|
25
|
+
}, label), offers.map((o)=>choice(name, o, o.id == picked)));
|
|
26
|
+
/** Where the people of `name` pick its voice from those offered, each played
|
|
27
|
+
* from `sample(id)`, and, folded under one line, how fast it speaks. It posts
|
|
28
|
+
* `voice` and `voice_speed`. */ export let VoiceCard = ({ name, offer: { setup, voices, paces }, sample })=>/*#__PURE__*/ h(Card, null, /*#__PURE__*/ h(Card.Head, null, /*#__PURE__*/ h(Card.Title, null, 'Voice')), /*#__PURE__*/ h('p', null, `How ${name} sounds when you call. Play a few voices, pick one, and save.`), /*#__PURE__*/ h(Rows, null, voices.map((v)=>/*#__PURE__*/ h(Rows.Item, null, choice('voice', v, v.id == setup.voice, {}, v.like ? ` (like ${v.like})` : ''), /*#__PURE__*/ h(Rows.Actions, null, /*#__PURE__*/ h(Button, {
|
|
29
|
+
type: 'button',
|
|
30
|
+
'data-sample': sample(v.id),
|
|
31
|
+
'aria-label': `Play ${v.name}`,
|
|
32
|
+
'data-tip': `Play ${v.name}`
|
|
33
|
+
}, /*#__PURE__*/ h(Icon, {
|
|
34
|
+
of: Play
|
|
35
|
+
})))))), /*#__PURE__*/ h(More, null, /*#__PURE__*/ h(More.Summary, null, 'Speed'), /*#__PURE__*/ h(More.Body, null, choices('voice-speed', 'Speed', 'voice_speed', paces, setup.pace))));
|
|
36
|
+
/** Where the host's admin picks how every persona's calls are answered: the
|
|
37
|
+
* model that answers, who takes a hard request it hands off, and the model
|
|
38
|
+
* that says the answers aloud where several could, each named by its id over
|
|
39
|
+
* what choosing it means. It posts `voice_model`, `voice_backend` and, where
|
|
40
|
+
* any are offered, `voice_speaker`. */ export let CallsCard = ({ offer: { setup, ways, backends, speakers } })=>/*#__PURE__*/ h(Card, null, /*#__PURE__*/ h(Card.Head, null, /*#__PURE__*/ h(Card.Title, null, 'Calls')), /*#__PURE__*/ h('p', null, 'How every Operator answers a call. Each person picks only the voice and its speed.'), choices('voice-answers', 'Answers', 'voice_model', ways.map((w)=>({
|
|
41
|
+
id: w.model,
|
|
42
|
+
name: w.model,
|
|
43
|
+
about: w.about
|
|
44
|
+
})), setup.model), choices('voice-backend', 'Hard requests', 'voice_backend', backends.map((b)=>({
|
|
45
|
+
...b,
|
|
46
|
+
name: b.id
|
|
47
|
+
})), setup.backend), speakers.length ? choices('voice-speaker', 'Spoken by', 'voice_speaker', speakers.map((s)=>({
|
|
48
|
+
id: s.model,
|
|
49
|
+
name: s.model,
|
|
50
|
+
about: s.about
|
|
51
|
+
})), setup.speaker) : null);
|
|
52
|
+
//# sourceMappingURL=ui.js.map
|
package/ui.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sources":["./ui.ts"],"names":[],"mappings":"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"}
|
package/ui.ts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// The `@yaks/speech/ui` facet: where a persona's people pick how it speaks
|
|
2
|
+
// on a call (`speech{}`, ./vocab.json), and where the host's admin picks the
|
|
3
|
+
// model that answers every call, drawn from the kit's parts. What each offers
|
|
4
|
+
// is its host's, which knows the providers it has keys for, and so is where
|
|
5
|
+
// its fields and its samples are sent.
|
|
6
|
+
/* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h, type JSX } from 'react'
|
|
7
|
+
import { Button, Card, Check, Form, Icon, More, Rows } from '@yaks/ui/parts'
|
|
8
|
+
// @ts-types="@yaks/ui/lucide"
|
|
9
|
+
import Play from 'lucide/dist/esm/icons/play.mjs'
|
|
10
|
+
import type { Voice } from './mod.ts'
|
|
11
|
+
|
|
12
|
+
/** One of a few to pick, in the words a person reads it in. */
|
|
13
|
+
export type Choice = { id: string; name: string; about: string }
|
|
14
|
+
|
|
15
|
+
/** A voice offered, and what it is like, said beside its name. */
|
|
16
|
+
export type Offered = Voice & { like?: string }
|
|
17
|
+
|
|
18
|
+
/** How a call may be answered: the model, and what choosing it means. */
|
|
19
|
+
export type Way = { model: string; about: string }
|
|
20
|
+
|
|
21
|
+
/** Who takes a hard request a call's model hands off, and what choosing it
|
|
22
|
+
* means. */
|
|
23
|
+
export type Backend = { id: string; about: string }
|
|
24
|
+
|
|
25
|
+
/** What a voice card offers, each list holding the one picked now (`setup`),
|
|
26
|
+
* by the ids `speech{voice, pace}` holds. */
|
|
27
|
+
export type Offer = {
|
|
28
|
+
setup: { voice: string; pace: string }
|
|
29
|
+
voices: Offered[]
|
|
30
|
+
paces: Choice[]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** What the calls card offers, each list holding the one picked now
|
|
34
|
+
* (`setup`), by the ids `speech{model, backend, speaker}` holds: `speakers`
|
|
35
|
+
* are the models that say a model's answers aloud, where a voice's provider
|
|
36
|
+
* has several, and none where no provider does. */
|
|
37
|
+
export type Calls = {
|
|
38
|
+
setup: { model: string; backend: string; speaker: string }
|
|
39
|
+
ways: Way[]
|
|
40
|
+
backends: Backend[]
|
|
41
|
+
speakers: Way[]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// One of a few to pick, as a radio: its name in bold, what it means beside
|
|
45
|
+
// it, `also` on its input.
|
|
46
|
+
let choice = (
|
|
47
|
+
name: string,
|
|
48
|
+
o: Choice,
|
|
49
|
+
checked: boolean,
|
|
50
|
+
also: Record<string, unknown> = {},
|
|
51
|
+
more = '',
|
|
52
|
+
) =>
|
|
53
|
+
h(
|
|
54
|
+
Check,
|
|
55
|
+
null,
|
|
56
|
+
h(Check.Input, { type: 'radio', name, value: o.id, checked, ...also }),
|
|
57
|
+
h(
|
|
58
|
+
'span',
|
|
59
|
+
null,
|
|
60
|
+
h('b', null, o.name),
|
|
61
|
+
more,
|
|
62
|
+
' ',
|
|
63
|
+
h(Check.Note, null, o.about),
|
|
64
|
+
),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
// A field of few to pick one from, its label over them.
|
|
68
|
+
let choices = (
|
|
69
|
+
id: string,
|
|
70
|
+
label: string,
|
|
71
|
+
name: string,
|
|
72
|
+
offers: Choice[],
|
|
73
|
+
picked: string,
|
|
74
|
+
) =>
|
|
75
|
+
h(
|
|
76
|
+
Form.Field,
|
|
77
|
+
{ role: 'radiogroup', 'aria-labelledby': id },
|
|
78
|
+
h(Form.Label, { id }, label),
|
|
79
|
+
offers.map((o) => choice(name, o, o.id == picked)),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
/** Where the people of `name` pick its voice from those offered, each played
|
|
83
|
+
* from `sample(id)`, and, folded under one line, how fast it speaks. It posts
|
|
84
|
+
* `voice` and `voice_speed`. */
|
|
85
|
+
export let VoiceCard = (
|
|
86
|
+
{ name, offer: { setup, voices, paces }, sample }: {
|
|
87
|
+
name: string
|
|
88
|
+
offer: Offer
|
|
89
|
+
sample: (voice: string) => string
|
|
90
|
+
},
|
|
91
|
+
): JSX.Element =>
|
|
92
|
+
h(
|
|
93
|
+
Card,
|
|
94
|
+
null,
|
|
95
|
+
h(Card.Head, null, h(Card.Title, null, 'Voice')),
|
|
96
|
+
h(
|
|
97
|
+
'p',
|
|
98
|
+
null,
|
|
99
|
+
`How ${name} sounds when you call. Play a few voices, pick one, and save.`,
|
|
100
|
+
),
|
|
101
|
+
h(
|
|
102
|
+
Rows,
|
|
103
|
+
null,
|
|
104
|
+
voices.map((v) =>
|
|
105
|
+
h(
|
|
106
|
+
Rows.Item,
|
|
107
|
+
null,
|
|
108
|
+
choice(
|
|
109
|
+
'voice',
|
|
110
|
+
v,
|
|
111
|
+
v.id == setup.voice,
|
|
112
|
+
{},
|
|
113
|
+
v.like ? ` (like ${v.like})` : '',
|
|
114
|
+
),
|
|
115
|
+
h(
|
|
116
|
+
Rows.Actions,
|
|
117
|
+
null,
|
|
118
|
+
h(Button, {
|
|
119
|
+
type: 'button',
|
|
120
|
+
'data-sample': sample(v.id),
|
|
121
|
+
'aria-label': `Play ${v.name}`,
|
|
122
|
+
'data-tip': `Play ${v.name}`,
|
|
123
|
+
}, h(Icon, { of: Play })),
|
|
124
|
+
),
|
|
125
|
+
)
|
|
126
|
+
),
|
|
127
|
+
),
|
|
128
|
+
h(
|
|
129
|
+
More,
|
|
130
|
+
null,
|
|
131
|
+
h(More.Summary, null, 'Speed'),
|
|
132
|
+
h(
|
|
133
|
+
More.Body,
|
|
134
|
+
null,
|
|
135
|
+
choices('voice-speed', 'Speed', 'voice_speed', paces, setup.pace),
|
|
136
|
+
),
|
|
137
|
+
),
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
/** Where the host's admin picks how every persona's calls are answered: the
|
|
141
|
+
* model that answers, who takes a hard request it hands off, and the model
|
|
142
|
+
* that says the answers aloud where several could, each named by its id over
|
|
143
|
+
* what choosing it means. It posts `voice_model`, `voice_backend` and, where
|
|
144
|
+
* any are offered, `voice_speaker`. */
|
|
145
|
+
export let CallsCard = (
|
|
146
|
+
{ offer: { setup, ways, backends, speakers } }: { offer: Calls },
|
|
147
|
+
): JSX.Element =>
|
|
148
|
+
h(
|
|
149
|
+
Card,
|
|
150
|
+
null,
|
|
151
|
+
h(Card.Head, null, h(Card.Title, null, 'Calls')),
|
|
152
|
+
h(
|
|
153
|
+
'p',
|
|
154
|
+
null,
|
|
155
|
+
'How every Operator answers a call. Each person picks only the voice and its speed.',
|
|
156
|
+
),
|
|
157
|
+
choices(
|
|
158
|
+
'voice-answers',
|
|
159
|
+
'Answers',
|
|
160
|
+
'voice_model',
|
|
161
|
+
ways.map((w) => ({ id: w.model, name: w.model, about: w.about })),
|
|
162
|
+
setup.model,
|
|
163
|
+
),
|
|
164
|
+
choices(
|
|
165
|
+
'voice-backend',
|
|
166
|
+
'Hard requests',
|
|
167
|
+
'voice_backend',
|
|
168
|
+
backends.map((b) => ({ ...b, name: b.id })),
|
|
169
|
+
setup.backend,
|
|
170
|
+
),
|
|
171
|
+
speakers.length
|
|
172
|
+
? choices(
|
|
173
|
+
'voice-speaker',
|
|
174
|
+
'Spoken by',
|
|
175
|
+
'voice_speaker',
|
|
176
|
+
speakers.map((s) => ({ id: s.model, name: s.model, about: s.about })),
|
|
177
|
+
setup.speaker,
|
|
178
|
+
)
|
|
179
|
+
: null,
|
|
180
|
+
)
|
package/vocab.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The component declarations, and nothing else: the module a server or a
|
|
2
|
+
// browser page imports at `@yaks/speech/vocab`. It reaches no storage, no SQL
|
|
3
|
+
// and no runtime, so a browser tab loading this vocabulary loads nothing else.
|
|
4
|
+
import doc from './vocab.json' with {
|
|
5
|
+
type: 'json'
|
|
6
|
+
};
|
|
7
|
+
import manifest from './package.json' with {
|
|
8
|
+
type: 'json'
|
|
9
|
+
};
|
|
10
|
+
/** The speech vocabulary, in the form `loadVocab` accepts. */ export let speechDoc = doc;
|
|
11
|
+
/** What this package is: its manifest's description, the one place it is
|
|
12
|
+
* written, which a host stamps on each document here. */ export let description = manifest.description;
|
|
13
|
+
/** Every document this plugin declares. */ export let docs = [
|
|
14
|
+
speechDoc
|
|
15
|
+
];
|
|
16
|
+
//# sourceMappingURL=vocab.js.map
|
package/vocab.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocab.js","sources":["./vocab.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,+EAA+E;AAG/E,OAAO,SAAS,oBAAoB;EAAE,MAAM;AAAO,EAAC;AACpD,OAAO,cAAc,sBAAsB;EAAE,MAAM;AAAO,EAAC;AAE3D,4DAA4D,GAC5D,OAAO,IAAI,YAAsB,IAAe;AAEhD;uDACuD,GACvD,OAAO,IAAI,cAAsB,SAAS,WAAW,CAAA;AAErD,yCAAyC,GACzC,OAAO,IAAI,OAAmB;EAAC;CAAU,CAAA"}
|
package/vocab.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "urn:uuid:0a95cf11-7886-4f5a-8043-ef0b4091e74c",
|
|
3
|
+
"$vocabulary": {
|
|
4
|
+
"https://yak.sh/vocab/core": true
|
|
5
|
+
},
|
|
6
|
+
"title": "speech",
|
|
7
|
+
"$defs": {
|
|
8
|
+
"speech": {
|
|
9
|
+
"$id": "urn:uuid:a9069972-af45-4c9e-b53d-c42bd37d7d2e",
|
|
10
|
+
"component": true,
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"voice": {
|
|
14
|
+
"$id": "urn:uuid:5f0140f0-851d-449d-8e63-24c6fe5e8dee",
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "the voice it speaks in, by id; the id names its provider"
|
|
17
|
+
},
|
|
18
|
+
"pace": {
|
|
19
|
+
"$id": "urn:uuid:3a5074fd-ba88-4de2-b0cb-ed7a78ee205d",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "how fast it speaks, by the host's name for a pace"
|
|
22
|
+
},
|
|
23
|
+
"model": {
|
|
24
|
+
"$id": "urn:uuid:92e1f685-b36b-4256-9664-e3637dc78ed9",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "the model that answers it on a call"
|
|
27
|
+
},
|
|
28
|
+
"backend": {
|
|
29
|
+
"$id": "urn:uuid:5e354cdb-d03e-4538-8436-a1bf99b627e8",
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "the larger model the talking model hands a hard request to on its provider's side"
|
|
32
|
+
},
|
|
33
|
+
"speaker": {
|
|
34
|
+
"$id": "urn:uuid:b068a052-e19a-4c25-8c05-bd97543354ed",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "the model that says its answers aloud where the model that answers does not talk, one of its voice's provider's"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"description": "how a persona speaks aloud: a property it lacks is its base persona's, then the host's"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/vocab.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The component declarations, and nothing else: the module a server or a
|
|
2
|
+
// browser page imports at `@yaks/speech/vocab`. It reaches no storage, no SQL
|
|
3
|
+
// and no runtime, so a browser tab loading this vocabulary loads nothing else.
|
|
4
|
+
|
|
5
|
+
import type { VocabDoc } from 'jsr:@yaks/vocab@0.2.36'
|
|
6
|
+
import doc from './vocab.json' with { type: 'json' }
|
|
7
|
+
import manifest from './package.json' with { type: 'json' }
|
|
8
|
+
|
|
9
|
+
/** The speech vocabulary, in the form `loadVocab` accepts. */
|
|
10
|
+
export let speechDoc: VocabDoc = doc as VocabDoc
|
|
11
|
+
|
|
12
|
+
/** What this package is: its manifest's description, the one place it is
|
|
13
|
+
* written, which a host stamps on each document here. */
|
|
14
|
+
export let description: string = manifest.description
|
|
15
|
+
|
|
16
|
+
/** Every document this plugin declares. */
|
|
17
|
+
export let docs: VocabDoc[] = [speechDoc]
|