|
import { c as create_ssr_component, v as validate_component, s as setContext, a as subscribe, b as createEventDispatcher, e as escape, d as add_attribute, f as spread, g as escape_object, m as missing_component, h as each, i as split_css_unit } from './ssr-6MZFlfLu.js'; |
|
import { computePosition, autoUpdate, offset, shift, flip, arrow } from '@floating-ui/dom'; |
|
import { w as writable } from './index2-f61NAEsz.js'; |
|
import { i as initializeModalStore, g as getModalStore } from './stores-0qksNY90.js'; |
|
import { i as initializeToastStore, g as getToastStore, M as ModalPromptEditor } from './ModalPromptEditor-isPsJANV.js'; |
|
import { p as prefersReducedMotionStore } from './ProgressBar.svelte_svelte_type_style_lang-H22V2Yrx.js'; |
|
|
|
const Header = create_ssr_component(($$result, $$props, $$bindings, slots) => { |
|
return ``; |
|
}); |
|
const storePopup = writable(void 0); |
|
const DRAWER_STORE_KEY = "drawerStore"; |
|
function initializeDrawerStore() { |
|
const drawerStore = drawerService(); |
|
return setContext(DRAWER_STORE_KEY, drawerStore); |
|
} |
|
function drawerService() { |
|
const { subscribe: subscribe2, set, update } = writable({}); |
|
return { |
|
subscribe: subscribe2, |
|
set, |
|
update, |
|
|
|
open: (newSettings) => update(() => { |
|
return { open: true, ...newSettings }; |
|
}), |
|
|
|
close: () => update((d) => { |
|
d.open = false; |
|
return d; |
|
}) |
|
}; |
|
} |
|
function initializeStores() { |
|
initializeModalStore(); |
|
initializeToastStore(); |
|
initializeDrawerStore(); |
|
} |
|
function cubicOut(t) { |
|
const f = t - 1; |
|
return f * f * f + 1; |
|
} |
|
function fly(node, { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0 } = {}) { |
|
const style = getComputedStyle(node); |
|
const target_opacity = +style.opacity; |
|
const transform = style.transform === "none" ? "" : style.transform; |
|
const od = target_opacity * (1 - opacity); |
|
const [xValue, xUnit] = split_css_unit(x); |
|
const [yValue, yUnit] = split_css_unit(y); |
|
return { |
|
delay, |
|
duration, |
|
easing, |
|
css: (t, u) => ` |
|
transform: ${transform} translate(${(1 - t) * xValue}${xUnit}, ${(1 - t) * yValue}${yUnit}); |
|
opacity: ${target_opacity - od * u}` |
|
}; |
|
} |
|
const cBackdrop = "fixed top-0 left-0 right-0 bottom-0 bg-surface-backdrop-token p-4"; |
|
const cTransitionLayer = "w-full h-fit min-h-full overflow-y-auto flex justify-center"; |
|
const cModal = "block overflow-y-auto"; |
|
const cModalImage = "w-full h-auto"; |
|
const Modal = create_ssr_component(($$result, $$props, $$bindings, slots) => { |
|
let cPosition; |
|
let classesBackdrop; |
|
let classesTransitionLayer; |
|
let classesModal; |
|
let parent; |
|
let $modalStore, $$unsubscribe_modalStore; |
|
let $prefersReducedMotionStore, $$unsubscribe_prefersReducedMotionStore; |
|
$$unsubscribe_prefersReducedMotionStore = subscribe(prefersReducedMotionStore, (value) => $prefersReducedMotionStore = value); |
|
createEventDispatcher(); |
|
let { components = {} } = $$props; |
|
let { position = "items-center" } = $$props; |
|
let { background = "bg-surface-100-800-token" } = $$props; |
|
let { width = "w-modal" } = $$props; |
|
let { height = "h-auto" } = $$props; |
|
let { padding = "p-4" } = $$props; |
|
let { spacing = "space-y-4" } = $$props; |
|
let { rounded = "rounded-container-token" } = $$props; |
|
let { shadow = "shadow-xl" } = $$props; |
|
let { zIndex = "z-[999]" } = $$props; |
|
let { buttonNeutral = "variant-ghost-surface" } = $$props; |
|
let { buttonPositive = "variant-filled" } = $$props; |
|
let { buttonTextCancel = "Cancel" } = $$props; |
|
let { buttonTextConfirm = "Confirm" } = $$props; |
|
let { buttonTextSubmit = "Submit" } = $$props; |
|
let { regionBackdrop = "" } = $$props; |
|
let { regionHeader = "text-2xl font-bold" } = $$props; |
|
let { regionBody = "max-h-[200px] overflow-hidden" } = $$props; |
|
let { regionFooter = "flex justify-end space-x-2" } = $$props; |
|
let { transitions = !$prefersReducedMotionStore } = $$props; |
|
let { transitionIn = fly } = $$props; |
|
let { transitionInParams = { duration: 150, opacity: 0, x: 0, y: 100 } } = $$props; |
|
let { transitionOut = fly } = $$props; |
|
let { transitionOutParams = { duration: 150, opacity: 0, x: 0, y: 100 } } = $$props; |
|
let promptValue; |
|
const buttonTextDefaults = { |
|
buttonTextCancel, |
|
buttonTextConfirm, |
|
buttonTextSubmit |
|
}; |
|
let currentComponent; |
|
let modalElement; |
|
let windowHeight; |
|
let backdropOverflow = "overflow-y-hidden"; |
|
const modalStore = getModalStore(); |
|
$$unsubscribe_modalStore = subscribe(modalStore, (value) => $modalStore = value); |
|
function handleModals(modals) { |
|
if (modals[0].type === "prompt") |
|
promptValue = modals[0].value; |
|
buttonTextCancel = modals[0].buttonTextCancel || buttonTextDefaults.buttonTextCancel; |
|
buttonTextConfirm = modals[0].buttonTextConfirm || buttonTextDefaults.buttonTextConfirm; |
|
buttonTextSubmit = modals[0].buttonTextSubmit || buttonTextDefaults.buttonTextSubmit; |
|
currentComponent = typeof modals[0].component === "string" ? components[modals[0].component] : modals[0].component; |
|
} |
|
function onModalHeightChange(modal) { |
|
let modalHeight = modal?.clientHeight; |
|
if (!modalHeight) |
|
modalHeight = modal?.firstChild?.clientHeight; |
|
if (!modalHeight) |
|
return; |
|
if (modalHeight > windowHeight) { |
|
backdropOverflow = "overflow-y-auto"; |
|
} else { |
|
backdropOverflow = "overflow-y-hidden"; |
|
} |
|
} |
|
function onClose() { |
|
if ($modalStore[0].response) |
|
$modalStore[0].response(false); |
|
modalStore.close(); |
|
} |
|
if ($$props.components === void 0 && $$bindings.components && components !== void 0) |
|
$$bindings.components(components); |
|
if ($$props.position === void 0 && $$bindings.position && position !== void 0) |
|
$$bindings.position(position); |
|
if ($$props.background === void 0 && $$bindings.background && background !== void 0) |
|
$$bindings.background(background); |
|
if ($$props.width === void 0 && $$bindings.width && width !== void 0) |
|
$$bindings.width(width); |
|
if ($$props.height === void 0 && $$bindings.height && height !== void 0) |
|
$$bindings.height(height); |
|
if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0) |
|
$$bindings.padding(padding); |
|
if ($$props.spacing === void 0 && $$bindings.spacing && spacing !== void 0) |
|
$$bindings.spacing(spacing); |
|
if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0) |
|
$$bindings.rounded(rounded); |
|
if ($$props.shadow === void 0 && $$bindings.shadow && shadow !== void 0) |
|
$$bindings.shadow(shadow); |
|
if ($$props.zIndex === void 0 && $$bindings.zIndex && zIndex !== void 0) |
|
$$bindings.zIndex(zIndex); |
|
if ($$props.buttonNeutral === void 0 && $$bindings.buttonNeutral && buttonNeutral !== void 0) |
|
$$bindings.buttonNeutral(buttonNeutral); |
|
if ($$props.buttonPositive === void 0 && $$bindings.buttonPositive && buttonPositive !== void 0) |
|
$$bindings.buttonPositive(buttonPositive); |
|
if ($$props.buttonTextCancel === void 0 && $$bindings.buttonTextCancel && buttonTextCancel !== void 0) |
|
$$bindings.buttonTextCancel(buttonTextCancel); |
|
if ($$props.buttonTextConfirm === void 0 && $$bindings.buttonTextConfirm && buttonTextConfirm !== void 0) |
|
$$bindings.buttonTextConfirm(buttonTextConfirm); |
|
if ($$props.buttonTextSubmit === void 0 && $$bindings.buttonTextSubmit && buttonTextSubmit !== void 0) |
|
$$bindings.buttonTextSubmit(buttonTextSubmit); |
|
if ($$props.regionBackdrop === void 0 && $$bindings.regionBackdrop && regionBackdrop !== void 0) |
|
$$bindings.regionBackdrop(regionBackdrop); |
|
if ($$props.regionHeader === void 0 && $$bindings.regionHeader && regionHeader !== void 0) |
|
$$bindings.regionHeader(regionHeader); |
|
if ($$props.regionBody === void 0 && $$bindings.regionBody && regionBody !== void 0) |
|
$$bindings.regionBody(regionBody); |
|
if ($$props.regionFooter === void 0 && $$bindings.regionFooter && regionFooter !== void 0) |
|
$$bindings.regionFooter(regionFooter); |
|
if ($$props.transitions === void 0 && $$bindings.transitions && transitions !== void 0) |
|
$$bindings.transitions(transitions); |
|
if ($$props.transitionIn === void 0 && $$bindings.transitionIn && transitionIn !== void 0) |
|
$$bindings.transitionIn(transitionIn); |
|
if ($$props.transitionInParams === void 0 && $$bindings.transitionInParams && transitionInParams !== void 0) |
|
$$bindings.transitionInParams(transitionInParams); |
|
if ($$props.transitionOut === void 0 && $$bindings.transitionOut && transitionOut !== void 0) |
|
$$bindings.transitionOut(transitionOut); |
|
if ($$props.transitionOutParams === void 0 && $$bindings.transitionOutParams && transitionOutParams !== void 0) |
|
$$bindings.transitionOutParams(transitionOutParams); |
|
{ |
|
if ($modalStore.length) |
|
handleModals($modalStore); |
|
} |
|
{ |
|
onModalHeightChange(modalElement); |
|
} |
|
cPosition = $modalStore[0]?.position ?? position; |
|
classesBackdrop = `${cBackdrop} ${regionBackdrop} ${zIndex} ${$$props.class ?? ""} ${$modalStore[0]?.backdropClasses ?? ""}`; |
|
classesTransitionLayer = `${cTransitionLayer} ${cPosition ?? ""}`; |
|
classesModal = `${cModal} ${background} ${width} ${height} ${padding} ${spacing} ${rounded} ${shadow} ${$modalStore[0]?.modalClasses ?? ""}`; |
|
parent = { |
|
position, |
|
|
|
background, |
|
width, |
|
height, |
|
padding, |
|
spacing, |
|
rounded, |
|
shadow, |
|
|
|
buttonNeutral, |
|
buttonPositive, |
|
buttonTextCancel, |
|
buttonTextConfirm, |
|
buttonTextSubmit, |
|
|
|
regionBackdrop, |
|
regionHeader, |
|
regionBody, |
|
regionFooter, |
|
|
|
onClose |
|
}; |
|
$$unsubscribe_modalStore(); |
|
$$unsubscribe_prefersReducedMotionStore(); |
|
return ` ${$modalStore.length > 0 ? ` <div class="${"modal-backdrop " + escape(classesBackdrop, true) + " " + escape(backdropOverflow, true)}" data-testid="modal-backdrop"> <div class="${"modal-transition " + escape(classesTransitionLayer, true)}">${$modalStore[0].type !== "component" ? ` <div class="${"modal " + escape(classesModal, true)}" data-testid="modal" role="dialog" aria-modal="true"${add_attribute("aria-label", $modalStore[0].title ?? "", 0)}${add_attribute("this", modalElement, 0)}> ${$modalStore[0]?.title ? `<header class="${"modal-header " + escape(regionHeader, true)}"><!-- HTML_TAG_START -->${$modalStore[0].title}<!-- HTML_TAG_END --></header>` : ``} ${$modalStore[0]?.body ? `<article class="${"modal-body " + escape(regionBody, true)}"><!-- HTML_TAG_START -->${$modalStore[0].body}<!-- HTML_TAG_END --></article>` : ``} ${$modalStore[0]?.image && typeof $modalStore[0]?.image === "string" ? `<img class="${"modal-image " + escape(cModalImage, true)}"${add_attribute("src", $modalStore[0]?.image, 0)} alt="Modal">` : ``} ${$modalStore[0].type === "alert" ? ` <footer class="${"modal-footer " + escape(regionFooter, true)}"><button type="button" class="${"btn " + escape(buttonNeutral, true)}">${escape(buttonTextCancel)}</button></footer>` : `${$modalStore[0].type === "confirm" ? ` <footer class="${"modal-footer " + escape(regionFooter, true)}"><button type="button" class="${"btn " + escape(buttonNeutral, true)}">${escape(buttonTextCancel)}</button> <button type="button" class="${"btn " + escape(buttonPositive, true)}">${escape(buttonTextConfirm)}</button></footer>` : `${$modalStore[0].type === "prompt" ? ` <form class="space-y-4"><input${spread( |
|
[ |
|
{ class: "modal-prompt-input input" }, |
|
{ name: "prompt" }, |
|
{ type: "text" }, |
|
escape_object($modalStore[0].valueAttr) |
|
], |
|
{} |
|
)}${add_attribute("value", promptValue, 0)}> <footer class="${"modal-footer " + escape(regionFooter, true)}"><button type="button" class="${"btn " + escape(buttonNeutral, true)}">${escape(buttonTextCancel)}</button> <button type="submit" class="${"btn " + escape(buttonPositive, true)}">${escape(buttonTextSubmit)}</button></footer></form>` : ``}`}`}</div>` : ` <div class="${"modal contents " + escape($modalStore[0]?.modalClasses ?? "", true)}" data-testid="modal-component" role="dialog" aria-modal="true"${add_attribute("aria-label", $modalStore[0].title ?? "", 0)}${add_attribute("this", modalElement, 0)}>${currentComponent?.slot ? `${validate_component(currentComponent?.ref || missing_component, "svelte:component").$$render($$result, Object.assign({}, currentComponent?.props, { parent }), {}, { |
|
default: () => { |
|
return `<!-- HTML_TAG_START -->${currentComponent?.slot}<!-- HTML_TAG_END -->`; |
|
} |
|
})}` : `${validate_component(currentComponent?.ref || missing_component, "svelte:component").$$render($$result, Object.assign({}, currentComponent?.props, { parent }), {}, {})}`}</div>`}</div></div>` : ``}`; |
|
}); |
|
const cWrapper = "flex fixed top-0 left-0 right-0 bottom-0 pointer-events-none"; |
|
const cSnackbar = "flex flex-col gap-y-2"; |
|
const cToast = "flex justify-between items-center pointer-events-auto"; |
|
const cToastActions = "flex items-center space-x-2"; |
|
const Toast = create_ssr_component(($$result, $$props, $$bindings, slots) => { |
|
let classesWrapper; |
|
let classesSnackbar; |
|
let classesToast; |
|
let filteredToasts; |
|
let $toastStore, $$unsubscribe_toastStore; |
|
let $prefersReducedMotionStore, $$unsubscribe_prefersReducedMotionStore; |
|
$$unsubscribe_prefersReducedMotionStore = subscribe(prefersReducedMotionStore, (value) => $prefersReducedMotionStore = value); |
|
const toastStore = getToastStore(); |
|
$$unsubscribe_toastStore = subscribe(toastStore, (value) => $toastStore = value); |
|
let { position = "b" } = $$props; |
|
let { max = 3 } = $$props; |
|
let { background = "variant-filled-secondary" } = $$props; |
|
let { width = "max-w-[640px]" } = $$props; |
|
let { color = "" } = $$props; |
|
let { padding = "p-4" } = $$props; |
|
let { spacing = "space-x-4" } = $$props; |
|
let { rounded = "rounded-container-token" } = $$props; |
|
let { shadow = "shadow-lg" } = $$props; |
|
let { zIndex = "z-[888]" } = $$props; |
|
let { buttonAction = "btn variant-filled" } = $$props; |
|
let { buttonDismiss = "btn-icon btn-icon-sm variant-filled" } = $$props; |
|
let { buttonDismissLabel = "✕" } = $$props; |
|
let { transitions = !$prefersReducedMotionStore } = $$props; |
|
let { transitionIn = fly } = $$props; |
|
let { transitionInParams = { duration: 250 } } = $$props; |
|
let { transitionOut = fly } = $$props; |
|
let { transitionOutParams = { duration: 250 } } = $$props; |
|
let cPosition; |
|
let cAlign; |
|
switch (position) { |
|
case "t": |
|
cPosition = "justify-center items-start"; |
|
cAlign = "items-center"; |
|
break; |
|
case "b": |
|
cPosition = "justify-center items-end"; |
|
cAlign = "items-center"; |
|
break; |
|
case "l": |
|
cPosition = "justify-start items-center"; |
|
cAlign = "items-start"; |
|
break; |
|
case "r": |
|
cPosition = "justify-end items-center"; |
|
cAlign = "items-end"; |
|
break; |
|
case "tl": |
|
cPosition = "justify-start items-start"; |
|
cAlign = "items-start"; |
|
break; |
|
case "tr": |
|
cPosition = "justify-end items-start"; |
|
cAlign = "items-end"; |
|
break; |
|
case "bl": |
|
cPosition = "justify-start items-end"; |
|
cAlign = "items-start"; |
|
break; |
|
case "br": |
|
cPosition = "justify-end items-end"; |
|
cAlign = "items-end"; |
|
break; |
|
} |
|
if ($$props.position === void 0 && $$bindings.position && position !== void 0) |
|
$$bindings.position(position); |
|
if ($$props.max === void 0 && $$bindings.max && max !== void 0) |
|
$$bindings.max(max); |
|
if ($$props.background === void 0 && $$bindings.background && background !== void 0) |
|
$$bindings.background(background); |
|
if ($$props.width === void 0 && $$bindings.width && width !== void 0) |
|
$$bindings.width(width); |
|
if ($$props.color === void 0 && $$bindings.color && color !== void 0) |
|
$$bindings.color(color); |
|
if ($$props.padding === void 0 && $$bindings.padding && padding !== void 0) |
|
$$bindings.padding(padding); |
|
if ($$props.spacing === void 0 && $$bindings.spacing && spacing !== void 0) |
|
$$bindings.spacing(spacing); |
|
if ($$props.rounded === void 0 && $$bindings.rounded && rounded !== void 0) |
|
$$bindings.rounded(rounded); |
|
if ($$props.shadow === void 0 && $$bindings.shadow && shadow !== void 0) |
|
$$bindings.shadow(shadow); |
|
if ($$props.zIndex === void 0 && $$bindings.zIndex && zIndex !== void 0) |
|
$$bindings.zIndex(zIndex); |
|
if ($$props.buttonAction === void 0 && $$bindings.buttonAction && buttonAction !== void 0) |
|
$$bindings.buttonAction(buttonAction); |
|
if ($$props.buttonDismiss === void 0 && $$bindings.buttonDismiss && buttonDismiss !== void 0) |
|
$$bindings.buttonDismiss(buttonDismiss); |
|
if ($$props.buttonDismissLabel === void 0 && $$bindings.buttonDismissLabel && buttonDismissLabel !== void 0) |
|
$$bindings.buttonDismissLabel(buttonDismissLabel); |
|
if ($$props.transitions === void 0 && $$bindings.transitions && transitions !== void 0) |
|
$$bindings.transitions(transitions); |
|
if ($$props.transitionIn === void 0 && $$bindings.transitionIn && transitionIn !== void 0) |
|
$$bindings.transitionIn(transitionIn); |
|
if ($$props.transitionInParams === void 0 && $$bindings.transitionInParams && transitionInParams !== void 0) |
|
$$bindings.transitionInParams(transitionInParams); |
|
if ($$props.transitionOut === void 0 && $$bindings.transitionOut && transitionOut !== void 0) |
|
$$bindings.transitionOut(transitionOut); |
|
if ($$props.transitionOutParams === void 0 && $$bindings.transitionOutParams && transitionOutParams !== void 0) |
|
$$bindings.transitionOutParams(transitionOutParams); |
|
classesWrapper = `${cWrapper} ${cPosition} ${zIndex} ${$$props.class || ""}`; |
|
classesSnackbar = `${cSnackbar} ${cAlign} ${padding}`; |
|
classesToast = `${cToast} ${width} ${color} ${padding} ${spacing} ${rounded} ${shadow}`; |
|
filteredToasts = Array.from($toastStore).slice(0, max); |
|
$$unsubscribe_toastStore(); |
|
$$unsubscribe_prefersReducedMotionStore(); |
|
return `${$toastStore.length ? ` <div class="${"snackbar-wrapper " + escape(classesWrapper, true)}" data-testid="snackbar-wrapper"> <div class="${"snackbar " + escape(classesSnackbar, true)}">${each(filteredToasts, (t, i) => { |
|
return `<div${add_attribute("role", t.hideDismiss ? "alert" : "alertdialog", 0)} aria-live="polite"> <div class="${"toast " + escape(classesToast, true) + " " + escape(t.background ?? background, true) + " " + escape(t.classes ?? "", true)}" data-testid="toast"><div class="text-base"><!-- HTML_TAG_START -->${t.message}<!-- HTML_TAG_END --></div> ${t.action || !t.hideDismiss ? `<div class="${"toast-actions " + escape(cToastActions, true)}">${t.action ? `<button${add_attribute("class", buttonAction, 0)}><!-- HTML_TAG_START -->${t.action.label}<!-- HTML_TAG_END --></button>` : ``} ${!t.hideDismiss ? `<button${add_attribute("class", buttonDismiss, 0)} aria-label="Dismiss toast">${escape(buttonDismissLabel)}</button>` : ``} </div>` : ``}</div> </div>`; |
|
})}</div></div>` : ``}`; |
|
}); |
|
const cBase$2 = "card p-4 shadow-xl space-y-4 w-3/4"; |
|
const LlmSettingsModal = create_ssr_component(($$result, $$props, $$bindings, slots) => { |
|
let $modalStore, $$unsubscribe_modalStore; |
|
let { parent } = $$props; |
|
const modalStore = getModalStore(); |
|
$$unsubscribe_modalStore = subscribe(modalStore, (value) => $modalStore = value); |
|
let localLlmParams; |
|
let stop = ""; |
|
if ($modalStore[0].meta) { |
|
localLlmParams = structuredClone($modalStore[0].meta); |
|
if (localLlmParams.predict_params == void 0) { |
|
localLlmParams.predict_params = {}; |
|
} |
|
stop = localLlmParams?.predict_params && localLlmParams.predict_params.stop ? localLlmParams.predict_params.stop.join("; ") : ""; |
|
} |
|
if ($$props.parent === void 0 && $$bindings.parent && parent !== void 0) |
|
$$bindings.parent(parent); |
|
$$unsubscribe_modalStore(); |
|
return ` ${$modalStore[0] ? `<div${add_attribute("class", cBase$2, 0)}><form class="space-y-4"><div class="grid grid-cols-3 gap-4"><div> <div class="form-control"><label class="label" data-svelte-h="svelte-1iuzjaf">Название</label> <input type="text" readonly class="input input-bordered w-full"${add_attribute("value", localLlmParams.name, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-11uwj0a">URL</label> <input type="text" readonly class="input input-bordered w-full"${add_attribute("value", localLlmParams.url, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-17yflt8">Тип</label> <input type="text" readonly class="input input-bordered w-full"${add_attribute("value", localLlmParams.type, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-mg5e2a">Контекст</label> <input type="number" readonly class="input input-bordered w-full"${add_attribute("value", localLlmParams.context, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-iadtw0">Шаблон</label> <textarea class="textarea textarea-bordered w-full">${escape(localLlmParams.template || "")}</textarea></div></div> ${localLlmParams?.predict_params ? `<input type="hidden"${add_attribute("value", localLlmParams.predict_params.retry_if_text_not_present, 0)}> <input type="hidden"${add_attribute("value", localLlmParams.predict_params.retry_count, 0)}> <div><div class="form-control"><label class="label" data-svelte-h="svelte-1kr1z63">n_predict</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.n_predict, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1na66r1">temperature</label> <input type="number" step="0.1" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.temperature, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-8vj08y">top_k</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.top_k, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-fypyrb">top_p</label> <input type="number" step="0.1" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.top_p, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1jkuvbg">min_p</label> <input type="number" step="0.1" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.min_p, 0)}></div></div> <div><div class="form-control"><label class="label" data-svelte-h="svelte-1rdvqbw">seed</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.seed, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1v8pi60">repeat_penalty</label> <input type="number" step="0.1" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.repeat_penalty, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1pm76em">repeat_last_n</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.repeat_last_n, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-r3dewv">frequency_penalty</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.frequency_penalty, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1nurpeq">presence_penalty</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.presence_penalty, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-16nkph1">n_keep</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.n_keep, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-4hbiic">cache_prompt</label> <input type="checkbox" class="checkbox"${add_attribute("checked", localLlmParams.predict_params.cache_prompt, 1)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-dixh5v">stop (разделённые ;)</label> <input type="text" class="input input-bordered w-full"${add_attribute("value", stop, 0)}></div></div>` : ``}</div> ${localLlmParams?.predict_params ? `<button class="btn variant-outline-tertiary">${escape("Показать")} системный промпт</button> <textarea class="${["w-full min-h-96", "hidden"].join(" ").trim()}">${escape(localLlmParams.predict_params.system_prompt || "")}</textarea> <button class="btn variant-outline-tertiary">${escape("Показать")} главный промпт</button> <textarea class="${["w-full min-h-96", "hidden"].join(" ").trim()}">${escape(localLlmParams.predict_params.user_prompt || "")}</textarea>` : ``}</form> <footer class="${"modal-footer " + escape(parent.regionFooter, true)}"><button class="${[ |
|
"btn " + escape(parent.buttonNeutral, true), |
|
!localLlmParams.name.endsWith("(изменено)") ? "hidden" : "" |
|
].join(" ").trim()}">Удалить</button> <button class="${"btn " + escape(parent.buttonNeutral, true)}">Отмена</button> <button class="${"btn " + escape(parent.buttonPositive, true)}">Сохранить</button></footer></div>` : ``}`; |
|
}); |
|
const cBase$1 = "card p-4 shadow-xl space-y-4 w-3/4"; |
|
const SearchSettingsModal = create_ssr_component(($$result, $$props, $$bindings, slots) => { |
|
let $modalStore, $$unsubscribe_modalStore; |
|
let { parent } = $$props; |
|
const modalStore = getModalStore(); |
|
$$unsubscribe_modalStore = subscribe(modalStore, (value) => $modalStore = value); |
|
let localLlmParams; |
|
let stop = ""; |
|
if ($modalStore[0].meta) { |
|
localLlmParams = structuredClone($modalStore[0].meta); |
|
console.log("searchLlmParams", localLlmParams); |
|
stop = localLlmParams?.predict_params && localLlmParams.predict_params.stop ? localLlmParams.predict_params.stop.join("; ") : ""; |
|
} |
|
if ($$props.parent === void 0 && $$bindings.parent && parent !== void 0) |
|
$$bindings.parent(parent); |
|
let $$settled; |
|
let $$rendered; |
|
let previous_head = $$result.head; |
|
do { |
|
$$settled = true; |
|
$$result.head = previous_head; |
|
$$rendered = ` ${$modalStore[0] ? `<div${add_attribute("class", cBase$1, 0)}><form class="space-y-4"><div class="grid grid-cols-3 gap-4"><div> <div class="form-control"><label class="label" data-svelte-h="svelte-11uwj0a">URL</label> <input type="text" readonly class="input input-bordered w-full"${add_attribute("value", localLlmParams.url, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-iadtw0">Шаблон</label> <textarea class="textarea textarea-bordered w-full">${escape(localLlmParams.template || "")}</textarea></div></div> ${localLlmParams?.predict_params ? `<input type="hidden"${add_attribute("value", localLlmParams.predict_params.retry_if_text_not_present, 0)}> <input type="hidden"${add_attribute("value", localLlmParams.predict_params.retry_count, 0)}> <div><div class="form-control"><label class="label" data-svelte-h="svelte-1kr1z63">n_predict</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.n_predict, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1na66r1">temperature</label> <input type="number" step="0.1" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.temperature, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-8vj08y">top_k</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.top_k, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-fypyrb">top_p</label> <input type="number" step="0.1" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.top_p, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1jkuvbg">min_p</label> <input type="number" step="0.1" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.min_p, 0)}></div></div> <div><div class="form-control"><label class="label" data-svelte-h="svelte-1rdvqbw">seed</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.seed, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1v8pi60">repeat_penalty</label> <input type="number" step="0.1" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.repeat_penalty, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1pm76em">repeat_last_n</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.repeat_last_n, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-r3dewv">frequency_penalty</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.frequency_penalty, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-1nurpeq">presence_penalty</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.presence_penalty, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-16nkph1">n_keep</label> <input type="number" class="input input-bordered w-full"${add_attribute("value", localLlmParams.predict_params.n_keep, 0)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-4hbiic">cache_prompt</label> <input type="checkbox" class="checkbox"${add_attribute("checked", localLlmParams.predict_params.cache_prompt, 1)}></div> <div class="form-control"><label class="label" data-svelte-h="svelte-dixh5v">stop (разделённые ;)</label> <input type="text" class="input input-bordered w-full"${add_attribute("value", stop, 0)}></div></div>` : ``}</div> ${``}</form> <footer class="${"modal-footer " + escape(parent.regionFooter, true)}"><button class="${"btn " + escape(parent.buttonNeutral, true)}">Отмена</button> <button class="${"btn " + escape(parent.buttonPositive, true)}">Сохранить</button></footer></div>` : ``}`; |
|
} while (!$$settled); |
|
$$unsubscribe_modalStore(); |
|
return $$rendered; |
|
}); |
|
const cBase = "card p-4 shadow-xl space-y-4 w-3/4"; |
|
const InvestigatorSettingsModal = create_ssr_component(($$result, $$props, $$bindings, slots) => { |
|
let $modalStore, $$unsubscribe_modalStore; |
|
let { parent } = $$props; |
|
const modalStore = getModalStore(); |
|
$$unsubscribe_modalStore = subscribe(modalStore, (value) => $modalStore = value); |
|
let localSettings; |
|
if ($modalStore[0].meta) { |
|
localSettings = structuredClone($modalStore[0].meta); |
|
console.log("investigator settings", localSettings); |
|
} |
|
if ($$props.parent === void 0 && $$bindings.parent && parent !== void 0) |
|
$$bindings.parent(parent); |
|
let $$settled; |
|
let $$rendered; |
|
let previous_head = $$result.head; |
|
do { |
|
$$settled = true; |
|
$$result.head = previous_head; |
|
$$rendered = ` ${$modalStore[0] && localSettings !== null ? `<div${add_attribute("class", cBase, 0)}><form class="space-y-4"><div class="grid grid-cols-3 gap-4"><div> <div class="form-control"><label class="label">Количество потоков для этапа ответов на вопросы |
|
<input type="number" class="input input-bordered w-full" max="30" min="1"${add_attribute("value", localSettings.maxThreads, 0)}></label></div></div></div> ${localSettings !== null ? `<div><div data-svelte-h="svelte-zzrwnb">Генерация вопросов</div> ${validate_component(ModalPromptEditor, "ModalPromptEditor").$$render( |
|
$$result, |
|
{ |
|
label: "system промпт", |
|
prompt: localSettings.prompts.createQuestions[0] |
|
}, |
|
{ |
|
prompt: ($$value) => { |
|
localSettings.prompts.createQuestions[0] = $$value; |
|
$$settled = false; |
|
} |
|
}, |
|
{} |
|
)} ${validate_component(ModalPromptEditor, "ModalPromptEditor").$$render( |
|
$$result, |
|
{ |
|
label: "user промпт", |
|
prompt: localSettings.prompts.createQuestions[1] |
|
}, |
|
{ |
|
prompt: ($$value) => { |
|
localSettings.prompts.createQuestions[1] = $$value; |
|
$$settled = false; |
|
} |
|
}, |
|
{} |
|
)}</div> <div><div data-svelte-h="svelte-k26452">Ответы на вопросы</div> ${validate_component(ModalPromptEditor, "ModalPromptEditor").$$render( |
|
$$result, |
|
{ |
|
label: "system промпт", |
|
prompt: localSettings.prompts.answerQuestion[0] |
|
}, |
|
{ |
|
prompt: ($$value) => { |
|
localSettings.prompts.answerQuestion[0] = $$value; |
|
$$settled = false; |
|
} |
|
}, |
|
{} |
|
)} ${validate_component(ModalPromptEditor, "ModalPromptEditor").$$render( |
|
$$result, |
|
{ |
|
label: "user промпт", |
|
prompt: localSettings.prompts.answerQuestion[1] |
|
}, |
|
{ |
|
prompt: ($$value) => { |
|
localSettings.prompts.answerQuestion[1] = $$value; |
|
$$settled = false; |
|
} |
|
}, |
|
{} |
|
)}</div> <div><div data-svelte-h="svelte-bu8rgi">Финальный ответ</div> ${validate_component(ModalPromptEditor, "ModalPromptEditor").$$render( |
|
$$result, |
|
{ |
|
label: "system промпт", |
|
prompt: localSettings.prompts.generateFinalAnswer[0] |
|
}, |
|
{ |
|
prompt: ($$value) => { |
|
localSettings.prompts.generateFinalAnswer[0] = $$value; |
|
$$settled = false; |
|
} |
|
}, |
|
{} |
|
)} ${validate_component(ModalPromptEditor, "ModalPromptEditor").$$render( |
|
$$result, |
|
{ |
|
label: "user промпт", |
|
prompt: localSettings.prompts.generateFinalAnswer[1] |
|
}, |
|
{ |
|
prompt: ($$value) => { |
|
localSettings.prompts.generateFinalAnswer[1] = $$value; |
|
$$settled = false; |
|
} |
|
}, |
|
{} |
|
)}</div>` : ``}</form> <footer class="${"modal-footer " + escape(parent.regionFooter, true)}"><button class="${"btn " + escape(parent.buttonNeutral, true)}">Отмена</button> <button class="${"btn " + escape(parent.buttonPositive, true)}">Сохранить</button></footer></div>` : ``}`; |
|
} while (!$$settled); |
|
$$unsubscribe_modalStore(); |
|
return $$rendered; |
|
}); |
|
const css = { |
|
code: ".app.svelte-1w2a1im{display:flex;flex-direction:column;min-height:100vh}main.svelte-1w2a1im{flex:1;display:flex;flex-direction:column;width:100%;max-width:100rem;margin:0 auto;box-sizing:border-box;justify-content:center;height:100vh}@media(min-width: 480px){}", |
|
map: null |
|
}; |
|
const Layout = create_ssr_component(($$result, $$props, $$bindings, slots) => { |
|
storePopup.set({ |
|
computePosition, |
|
autoUpdate, |
|
offset, |
|
shift, |
|
flip, |
|
arrow |
|
}); |
|
initializeStores(); |
|
const modalComponentRegistry = { |
|
llmSettingsModal: { ref: LlmSettingsModal }, |
|
searchSettingsModal: { ref: SearchSettingsModal }, |
|
investigatorSettingsModal: { ref: InvestigatorSettingsModal } |
|
}; |
|
$$result.css.add(css); |
|
return `${$$result.head += `<!-- HEAD_svelte-1wpbm1r_START -->${$$result.title = `<title>LLM demo app</title>`, ""}<meta name="description" content="LLM demo app"><!-- HEAD_svelte-1wpbm1r_END -->`, ""} <div class="app svelte-1w2a1im">${validate_component(Header, "Header").$$render($$result, {}, {}, {})} ${validate_component(Toast, "Toast").$$render($$result, {}, {}, {})} ${validate_component(Modal, "Modal").$$render($$result, { components: modalComponentRegistry }, {}, {})} <main class="svelte-1w2a1im">${slots.default ? slots.default({}) : ``}</main> </div>`; |
|
}); |
|
|
|
export { Layout as default }; |
|
|
|
|