@columenlabs/lumen-ui 0.1.230 → 0.1.231
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/assistant/settings.js +28 -17
- package/package.json +2 -2
|
@@ -121,7 +121,8 @@ const mark = (label) => _jsx(ConnectionLogo, { text: label.charAt(0) });
|
|
|
121
121
|
function OwnProviderKey({ client, p }) {
|
|
122
122
|
const { apply, refresh } = useApply(client);
|
|
123
123
|
const ways = [];
|
|
124
|
-
|
|
124
|
+
const may = (w) => !p.own_ways || p.own_ways.includes(w);
|
|
125
|
+
if (p.signin === 'chatgpt' && (may('plan') || p.plan?.set))
|
|
125
126
|
ways.push({
|
|
126
127
|
id: 'plan',
|
|
127
128
|
label: 'ChatGPT plan',
|
|
@@ -138,27 +139,37 @@ function OwnProviderKey({ client, p }) {
|
|
|
138
139
|
removeText: 'Your API key, if you set one, runs from then on.',
|
|
139
140
|
removeLabel: 'Sign out',
|
|
140
141
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
142
|
+
if (may('key') || p.own.set)
|
|
143
|
+
ways.push({
|
|
144
|
+
id: 'key',
|
|
145
|
+
label: 'API key',
|
|
146
|
+
icon: KeyRoundIcon,
|
|
147
|
+
info: `Your own ${p.label} key, billed by ${p.label}.`,
|
|
148
|
+
set: p.own.set,
|
|
149
|
+
ident: p.own.hint,
|
|
150
|
+
test: wayTest(p.own),
|
|
151
|
+
fields: [{ id: 'key', label: `${p.label} API key`, secret: true, prefix: p.prefix }],
|
|
152
|
+
getUrl: p.keys_url,
|
|
153
|
+
onSave: (v) => apply(`own:${p.id}`, () => client.ownKey(p.id, v.key ?? ''), 'Key saved'),
|
|
154
|
+
onTest: () => client.testOwnKey(p.id, 'key').finally(refresh),
|
|
155
|
+
onRemove: () => apply(`own:${p.id}`, () => client.ownKey(p.id, null), 'Key removed'),
|
|
156
|
+
removeTitle: `Remove your ${p.label} key?`,
|
|
157
|
+
});
|
|
156
158
|
return (_jsx(LumenConnection, { id: p.id, name: p.label, logo: mark(p.label), ways: ways, use: p.use, onUse: (use) => apply(`use:${p.id}`, () => client.settings({ own_use: { [p.id]: use } })) }));
|
|
157
159
|
}
|
|
158
160
|
/** A person's own keys, one row a provider, and what they may spend on them. */
|
|
159
161
|
function Providers({ client }) {
|
|
160
162
|
const { apply } = useApply(client);
|
|
161
|
-
return (_jsx(WithStatus, { client: client, children: (s) =>
|
|
163
|
+
return (_jsx(WithStatus, { client: client, children: (s) => {
|
|
164
|
+
// A provider the app gives this person no way of their own on shows no row, unless one is
|
|
165
|
+
// still set (so it can be removed).
|
|
166
|
+
const rows = s.providers.filter((p) => !p.own_ways || p.own_ways.length > 0 || p.own.set || p.plan?.set);
|
|
167
|
+
const ownSet = rows.some((p) => p.own.set || p.plan?.set);
|
|
168
|
+
return (_jsxs("div", { className: "flex flex-col", children: [_jsx(LumenExpandList, { children: rows.map((p) => (_jsx(OwnProviderKey, { client: client, p: p }, p.id))) }), ownSet && (_jsx(Row, { label: "Answers run on", info: "Your own key or plan first, with the shared credits behind it; or the shared credits first.", children: _jsx(LumenSelector, { label: "Answers run on", size: "sm", className: "w-44", value: s.pay, options: [
|
|
169
|
+
{ value: 'own', label: 'Your own first' },
|
|
170
|
+
{ value: 'app', label: 'Shared credits first' },
|
|
171
|
+
], onChange: (pay) => void apply('pay', () => client.settings({ pay: pay })) }) })), ownSet && (_jsx(Row, { label: "Your keys may spend", info: "On your keys, every provider together.", children: _jsx(CapInput, { label: "Your monthly cap", value: s.caps.own, onSave: (n) => void apply('own', () => client.ownCap(n)) }) }))] }));
|
|
172
|
+
} }));
|
|
162
173
|
}
|
|
163
174
|
/** One provider's shared key, which an admin sets for everyone. */
|
|
164
175
|
function SharedProviderKey({ client, p }) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@columenlabs/lumen-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.231",
|
|
4
4
|
"description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@codemirror/lang-javascript": "6.2.5",
|
|
50
50
|
"@codemirror/lang-json": "6.0.2",
|
|
51
51
|
"@codemirror/lang-sql": "6.10.0",
|
|
52
|
-
"@columenlabs/lumen-ui-types": "0.1.
|
|
52
|
+
"@columenlabs/lumen-ui-types": "0.1.231",
|
|
53
53
|
"@dnd-kit/core": "6.3.1",
|
|
54
54
|
"@dnd-kit/sortable": "10.0.0",
|
|
55
55
|
"@dnd-kit/utilities": "3.2.2",
|