|
195 | 195 | /> |
196 | 196 | </div> |
197 | 197 |
|
198 | | -{#if floatingButtons && model} |
199 | | - <FloatingButtons |
200 | | - bind:this={floatingButtonsElement} |
201 | | - {id} |
202 | | - {messageId} |
203 | | - actions={$settings?.floatingActionButtons ?? []} |
204 | | - model={(selectedModels ?? []).includes(model?.id) |
205 | | - ? model?.id |
206 | | - : (selectedModels ?? []).length > 0 |
207 | | - ? selectedModels.at(0) |
208 | | - : model?.id} |
209 | | - messages={createMessagesList(history, messageId)} |
210 | | - onAdd={({ modelId, parentId, messages }) => { |
211 | | - console.log(modelId, parentId, messages); |
212 | | - onAddMessages({ modelId, parentId, messages }); |
213 | | - closeFloatingButtons(); |
214 | | - }} |
215 | | - /> |
216 | | -{/if} |
217 | | -
|
218 | | - } |
219 | | -
|
220 | | - const metadata = source.metadata?.[index]; |
221 | | - const id = metadata?.source ?? 'N/A'; |
222 | | -
|
223 | | - if (metadata?.name) { |
224 | | - ids.push(metadata.name); |
225 | | - return ids; |
226 | | - } |
227 | | -
|
228 | | - if (id.startsWith('http://') || id.startsWith('https://')) { |
229 | | - ids.push(id); |
230 | | - } else { |
231 | | - ids.push(source?.source?.name ?? id); |
232 | | - } |
233 | | -
|
234 | | - return ids; |
235 | | - }); |
236 | | -
|
237 | | - acc = [...acc, ...ids]; |
238 | | -
|
239 | | - // remove duplicates |
240 | | - return acc.filter((item, index) => acc.indexOf(item) === index); |
241 | | - }, [])} |
242 | | - {onSourceClick} |
243 | | - {onTaskClick} |
244 | | - {onSave} |
245 | | - onUpdate={async (token) => { |
246 | | - const { lang, text: code } = token; |
247 | | -
|
248 | | - if ( |
249 | | - ($settings?.detectArtifacts ?? true) && |
250 | | - (['html', 'svg'].includes(lang) || (lang === 'xml' && code.includes('svg'))) && |
251 | | - !$mobile && |
252 | | - $chatId |
253 | | - ) { |
254 | | - await tick(); |
255 | | - showArtifacts.set(true); |
256 | | - showControls.set(true); |
257 | | - } |
258 | | - }} |
259 | | - onPreview={async (value) => { |
260 | | - console.log('Preview', value); |
261 | | - await artifactCode.set(value); |
262 | | - await showControls.set(true); |
263 | | - await showArtifacts.set(true); |
264 | | - await showEmbeds.set(false); |
265 | | - }} |
266 | | - /> |
267 | | -</div> |
268 | | -
|
269 | 198 | {#if floatingButtons && model} |
270 | 199 | <FloatingButtons |
271 | 200 | bind:this={floatingButtonsElement} |
|
0 commit comments