@hanzo/browser-extension 1.9.54 → 1.9.55

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,118 +0,0 @@
1
- import React, { useEffect, useMemo, useRef, useState } from 'react';
2
- import { AUTO_MODEL, type ChatModel, type ModelGroup } from './model-catalog.js';
3
-
4
- /**
5
- * The model picker: a filterable menu over the grouped catalog, with Auto — the
6
- * router — pinned at the top as the one entry that is always valid.
7
- *
8
- * Presentational: the catalog and the choice are both injected. It never fetches.
9
- */
10
-
11
- // Tiers mirror @hanzo/plans (the pricing SoT); shown in the upgrade banner.
12
- // Full plan detail lives at console.hanzo.ai/pricing.
13
- const TIERS = [
14
- { name: 'Pro', price: '$20' },
15
- { name: 'Max', price: '$100' },
16
- { name: 'Ultra', price: '$200' },
17
- ];
18
-
19
- export interface ModelsProps {
20
- groups: ModelGroup[];
21
- current: ChatModel;
22
- onPick: (model: ChatModel) => void;
23
- }
24
-
25
- export function Models({ groups, current, onPick }: ModelsProps) {
26
- const [open, setOpen] = useState(false);
27
- const [filter, setFilter] = useState('');
28
- const ref = useRef<HTMLDivElement>(null);
29
-
30
- useEffect(() => {
31
- if (!open) return;
32
- const onDoc = (e: MouseEvent) => {
33
- if (ref.current && !ref.current.contains(e.target as Node)) setOpen(false);
34
- };
35
- document.addEventListener('mousedown', onDoc);
36
- return () => document.removeEventListener('mousedown', onDoc);
37
- }, [open]);
38
-
39
- const q = filter.trim().toLowerCase();
40
- const shown = useMemo(
41
- () =>
42
- groups
43
- .map((g) => ({
44
- ...g,
45
- models: g.models.filter(
46
- (m) => !q || m.name.toLowerCase().includes(q) || m.id.toLowerCase().includes(q),
47
- ),
48
- }))
49
- .filter((g) => g.models.length),
50
- [groups, q],
51
- );
52
-
53
- return (
54
- <div className="ae-picker" ref={ref}>
55
- <button className="ae-picker-btn" onClick={() => setOpen((v) => !v)} title="Choose model">
56
- <span className="ae-dot" />
57
- {current.name}
58
- <svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true">
59
- <path d="M4 6l4 4 4-4" fill="none" stroke="currentColor" strokeWidth="1.5" />
60
- </svg>
61
- </button>
62
- {open && (
63
- <div className="ae-picker-menu">
64
- <input
65
- className="ae-picker-filter"
66
- placeholder="Search models…"
67
- value={filter}
68
- autoFocus
69
- onChange={(e) => setFilter(e.target.value)}
70
- />
71
- <div className="ae-picker-list">
72
- <button
73
- className={'ae-model-row' + (current.id === AUTO_MODEL.id ? ' active' : '')}
74
- onClick={() => {
75
- onPick(AUTO_MODEL);
76
- setOpen(false);
77
- }}
78
- >
79
- <span className="ae-model-name">Auto</span>
80
- <span className="ae-model-desc">Routes to the best model</span>
81
- </button>
82
- {shown.map((g) => (
83
- <div key={g.family} className="ae-model-group">
84
- <div className="ae-model-group-label">{g.label}</div>
85
- {g.models.map((m) => (
86
- <button
87
- key={m.id}
88
- className={'ae-model-row' + (current.id === m.id ? ' active' : '')}
89
- onClick={() => {
90
- onPick(m);
91
- setOpen(false);
92
- }}
93
- >
94
- <span className="ae-model-name">
95
- {m.name}
96
- {m.tier && <span className="ae-badge">{m.tier}</span>}
97
- </span>
98
- {m.description && <span className="ae-model-desc">{m.description}</span>}
99
- </button>
100
- ))}
101
- </div>
102
- ))}
103
- </div>
104
- <a className="ae-plan-banner" href="https://console.hanzo.ai/pricing" target="_blank" rel="noreferrer">
105
- <span>Unlock every model</span>
106
- <span className="ae-plan-tiers">
107
- {TIERS.map((t) => (
108
- <span key={t.name} className="ae-plan-tier">
109
- {t.name} <b>{t.price}</b>
110
- </span>
111
- ))}
112
- </span>
113
- </a>
114
- </div>
115
- )}
116
- </div>
117
- );
118
- }
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import type { SearchSource } from '@hanzo/ai';
3
-
4
- /**
5
- * One cited source, numbered to match its marker in the answer body.
6
- * Falls back to the raw URL when the host will not parse, and to a dot when the
7
- * site serves no favicon — a citation always renders.
8
- */
9
- export function Source({ source, index }: { source: SearchSource; index: number }) {
10
- let host: string;
11
- try {
12
- host = new URL(source.url).hostname.replace(/^www\./, '');
13
- } catch {
14
- host = source.url;
15
- }
16
- return (
17
- <a className="ae-source" href={source.url} target="_blank" rel="noreferrer" title={source.title}>
18
- <span className="ae-source-head">
19
- <span className="ae-source-idx">{index + 1}</span>
20
- {source.favicon ? <img src={source.favicon} alt="" width="14" height="14" /> : <span className="ae-dot" />}
21
- <span className="ae-source-host">{host}</span>
22
- </span>
23
- <span className="ae-source-title">{source.title}</span>
24
- </a>
25
- );
26
- }