Elffuss BraidHub

kikocis/continue public

3ff29c567dd0 · 7.2 KiBRawPermalink
1export const ModelRecommendations = ({ role = "all" }) => {
2 const parseMarkdownLinks = (text) => {
3 const regex = /\[([^\]]+)\]\(([^)]+)\)/g;
4 const parts = [];
5 let lastIndex = 0;
6 let match;
7 let key = 0;
8
9 while ((match = regex.exec(text)) !== null) {
10 if (match.index > lastIndex) {
11 const beforeText = text.slice(lastIndex, match.index);
12 if (beforeText) {
13 parts.push(<span key={key++}>{beforeText}</span>);
14 }
15 }
16
17 const [, linkText, url] = match;
18 parts.push(
19 <a
20 key={key++}
21 href={url}
22 target="_blank"
23 rel="noopener noreferrer"
24 style={{ color: "#0066cc", textDecoration: "underline" }}
25 >
26 {linkText}
27 </a>,
28 );
29
30 lastIndex = regex.lastIndex;
31 }
32
33 if (lastIndex < text.length) {
34 const remainingText = text.slice(lastIndex);
35 if (remainingText) {
36 parts.push(<span key={key++}>{remainingText}</span>);
37 }
38 }
39
40 return parts.length > 0 ? parts : text;
41 };
42
43 // Model recommendations data inside component scope
44 const modelRecs = {
45 agent_plan: {
46 open: [
47 "[Qwen3 Coder (480B)](https://hub.continue.dev/openrouter/qwen3-coder)",
48 "[Qwen3 Coder (30B)](https://hub.continue.dev/ollama/qwen3-coder-30b)",
49 "[Devstral (27B)](https://hub.continue.dev/ollama/devstral)",
50 "[Kimi K2 (1T)](https://hub.continue.dev/openrouter/kimi-k2)",
51 "[gpt-oss (120B)](https://hub.continue.dev/openrouter/gpt-oss-120b)",
52 "[gpt-oss (20B)](https://hub.continue.dev/ollama/gpt-oss-20b)",
53 "[GLM 4.5 (355B)](https://hub.continue.dev/openrouter/glm-4-5)",
54 "[GLM 4.5 Air (106B)](https://hub.continue.dev/openrouter/glm-4-5-air)",
55 ],
56 closed: [
57 "[Claude Opus 4.1](https://hub.continue.dev/anthropic/claude-4-1-opus)",
58 "[Claude Sonnet 4](https://hub.continue.dev/anthropic/claude-4-sonnet)",
59 "[GPT-5](https://hub.continue.dev/openai/gpt-5)",
60 "[Gemini 2.5 Pro](https://hub.continue.dev/google/gemini-2.5-pro)",
61 ],
62 notes: "Closed models are slightly better than open models",
63 },
64 chat_edit: {
65 open: [
66 "[Qwen3 Coder (480B)](https://hub.continue.dev/openrouter/qwen3-coder)",
67 "[Qwen3 Coder (30B)](https://hub.continue.dev/ollama/qwen3-coder-30b)",
68 "[gpt-oss (120B)](https://hub.continue.dev/openrouter/gpt-oss-120b)",
69 "[gpt-oss (20B)](https://hub.continue.dev/ollama/gpt-oss-20b)",
70 ],
71 closed: [
72 "[Claude Opus 4.1](https://hub.continue.dev/anthropic/claude-4-1-opus)",
73 "[Claude Sonnet 4](https://hub.continue.dev/anthropic/claude-4-sonnet)",
74 "[GPT-5](https://hub.continue.dev/openai/gpt-5)",
75 "[Gemini 2.5 Pro](https://hub.continue.dev/google/gemini-2.5-pro)",
76 ],
77 notes: "Closed and open models have pretty similar performance",
78 },
79 autocomplete: {
80 open: [
81 "[QwenCoder2.5 (1.5B)](https://hub.continue.dev/ollama/qwen2.5-coder-1.5b)",
82 "[QwenCoder2.5 (7B)](https://hub.continue.dev/ollama/qwen2.5-coder-7b)",
83 ],
84 closed: [
85 "[Codestral](https://hub.continue.dev/mistral/codestral)",
86 "[Mercury Coder](https://hub.continue.dev/inception/mercury-coder)",
87 ],
88 notes: "Closed models are slightly better than open models",
89 },
90 apply: {
91 open: ["N/A"],
92 closed: [
93 "[Relace Instant Apply](https://hub.continue.dev/relace/instant-apply)",
94 "[Morph Fast Apply](https://hub.continue.dev/morphllm/morph-v2)",
95 ],
96 notes: "Open models are not good enough for this model role",
97 },
98 embed: {
99 open: [
100 "[Nomic Embed Text](https://hub.continue.dev/ollama/nomic-embed-text-latest)",
101 "Qwen3 Embedding",
102 ],
103 closed: [
104 "[Voyage Code 3](https://hub.continue.dev/voyageai/voyage-code-3)",
105 "[Morph Embeddings](https://hub.continue.dev/morphllm/morph-embedding-v2)",
106 "Codestral Embed",
107 ],
108 notes: "Closed models are slightly better than open models",
109 },
110 rerank: {
111 open: ["zerank-1", "zerank-1-small", "Qwen3 Reranker"],
112 closed: [
113 "[Voyage Rerank 2.5](https://hub.continue.dev/voyageai/rerank-2-5)",
114 "Relace Code Rerank",
115 "[Morph Rerank](https://hub.continue.dev/morphllm/morph-rerank-v2)",
116 ],
117 notes: "Open models are beginning to emerge for this model role",
118 },
119 next_edit: {
120 open: ["[Instinct](https://hub.continue.dev/continuedev/instinct)"],
121 closed: [
122 "[Mercury Coder](https://hub.continue.dev/inception/mercury-coder)",
123 ],
124 notes: "Closed models are better than open models",
125 },
126 };
127
128 let rolesToShow = [];
129
130 if (!role || role === "all") {
131 rolesToShow = Object.keys(modelRecs);
132 } else {
133 const key = role.toLowerCase().replace(/\s|\//g, "_").replace(/-/g, "_");
134 if (modelRecs[key]) {
135 rolesToShow = [key];
136 }
137 }
138
139 if (rolesToShow.length === 0) {
140 return <div>No recommendations found for role: {role}</div>;
141 }
142
143 return (
144 <table
145 style={{ width: "100%", borderCollapse: "collapse", marginTop: "1rem" }}
146 >
147 <thead>
148 <tr>
149 <th
150 style={{
151 textAlign: "left",
152 borderBottom: "1px solid #ddd",
153 padding: "8px",
154 }}
155 >
156 Model role
157 </th>
158 <th
159 style={{
160 textAlign: "left",
161 borderBottom: "1px solid #ddd",
162 padding: "8px",
163 }}
164 >
165 Best open models
166 </th>
167 <th
168 style={{
169 textAlign: "left",
170 borderBottom: "1px solid #ddd",
171 padding: "8px",
172 }}
173 >
174 Best closed models
175 </th>
176 <th
177 style={{
178 textAlign: "left",
179 borderBottom: "1px solid #ddd",
180 padding: "8px",
181 }}
182 >
183 Notes
184 </th>
185 </tr>
186 </thead>
187 <tbody>
188 {rolesToShow.map((roleKey) => {
189 const rec = modelRecs[roleKey];
190 if (!rec) return null;
191
192 return (
193 <tr key={roleKey}>
194 <td
195 style={{
196 fontWeight: 600,
197 verticalAlign: "top",
198 padding: "8px",
199 }}
200 >
201 {roleKey
202 .replace(/_/g, " ")
203 .replace(/\b\w/g, (l) => l.toUpperCase())}
204 </td>
205 <td style={{ padding: "8px", verticalAlign: "top" }}>
206 {rec.open.map((m, i) => (
207 <div key={i} style={{ marginBottom: "4px" }}>
208 {parseMarkdownLinks(m)}
209 </div>
210 ))}
211 </td>
212 <td style={{ padding: "8px", verticalAlign: "top" }}>
213 {rec.closed.map((m, i) => (
214 <div key={i} style={{ marginBottom: "4px" }}>
215 {parseMarkdownLinks(m)}
216 </div>
217 ))}
218 </td>
219 <td style={{ padding: "8px", verticalAlign: "top" }}>
220 {rec.notes}
221 </td>
222 </tr>
223 );
224 })}
225 </tbody>
226 </table>
227 );
228};