@parallelworks/ui 0.86.0 → 0.86.1

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.
@@ -1,6 +1,6 @@
1
1
  import type { BoundSetting } from '../types.js';
2
2
  /** Which allocation an organization model bills, with its spend so far. Shows
3
- * only for an organization model, and picks the first allocation for it. */
3
+ * only for an organization model, and picks the first allocation it can charge. */
4
4
  export default function AllocationSelector({ model, allocation, }?: {
5
5
  /** The model a session owns, which decides whether it bills an allocation. */
6
6
  model?: string | null | undefined;
@@ -14,7 +14,7 @@ var dollars = new Intl.NumberFormat(void 0, {
14
14
  });
15
15
  var money = (amount) => dollars.format(amount);
16
16
  /** Which allocation an organization model bills, with its spend so far. Shows
17
- * only for an organization model, and picks the first allocation for it. */
17
+ * only for an organization model, and picks the first allocation it can charge. */
18
18
  function AllocationSelector({ model, allocation } = {}) {
19
19
  const chat = useChat();
20
20
  const t = useChatConfig().strings.allocationPicker;
@@ -25,7 +25,7 @@ function AllocationSelector({ model, allocation } = {}) {
25
25
  const isOrgProvider = isOrgModel(selectedProvider);
26
26
  const allocationsAdapter = adapter.allocations;
27
27
  const { data: allocations } = useSWR(isOrgProvider && allocationsAdapter ? ["ai-chat-allocations"] : null, () => allocationsAdapter?.list());
28
- const first = allocations?.[0];
28
+ const first = allocations?.find((a) => !a.disabled);
29
29
  useEffect(() => {
30
30
  if (bound) return;
31
31
  if (!isOrgProvider) {
@@ -46,7 +46,9 @@ function AllocationSelector({ model, allocation } = {}) {
46
46
  "aria-label": t.choose,
47
47
  items: allocations.map((a) => ({
48
48
  value: a.name,
49
- label: a.name
49
+ label: a.name,
50
+ description: a.description,
51
+ disabled: a.disabled
50
52
  })),
51
53
  value: selectedAllocation,
52
54
  disabled: !!allocation?.disabled,
@@ -268,6 +268,8 @@ export interface Allocation {
268
268
  name: string;
269
269
  total: number;
270
270
  used?: number;
271
+ description?: string | undefined;
272
+ disabled?: boolean | undefined;
271
273
  }
272
274
  export interface ChatNavigation {
273
275
  toConversation(id: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/ui",
3
- "version": "0.86.0",
3
+ "version": "0.86.1",
4
4
  "description": "React UI components: a theme contract, icons, brand logos, primitives, lists, forms, a job graph, a code editor, a log viewer, a file explorer and an AI chat, each on its own subpath",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {