Spaces:
Runtime error
Runtime error
more typing
Browse files28 unmodified lines29303132333435363738394017 unmodified lines5859605561626364656667626869707152 unmodified lines12412512612112712812913013113213312813413513613746 unmodified lines18418518618118718818919019119219318819419519619728 unmodified lines language?: Language; }
interface MessagesJoiner { sep: string; start: string; end: string; }
$: snippetsByLanguage = { javascript: getJavascriptSnippets(conversation), python: getPythonSnippets(conversation),17 unmodified lines }
function getJavascriptSnippets(conversation: Conversation) { const formattedMessages = ({ sep, start, end }) => const formattedMessages = ({ sep, start, end }: MessagesJoiner) => start + getMessages() .map(({ role, content }) => `{ role: "${role}", content: "${content}" }`) .join(sep) + end;
const formattedConfig = ({ sep, start, end }) => const formattedConfig = ({ sep, start, end }: MessagesJoiner) => start + Object.entries(conversation.config) .map(([key, val]) => `${key}: ${val}`)52 unmodified lines }
function getPythonSnippets(conversation: Conversation) { const formattedMessages = ({ sep, start, end }) => const formattedMessages = ({ sep, start, end }: MessagesJoiner) => start + getMessages() .map(({ role, content }) => `{ "role": "${role}", "content": "${content}" }`) .join(sep) + end;
const formattedConfig = ({ sep, start, end }) => const formattedConfig = ({ sep, start, end }: MessagesJoiner) => start + Object.entries(conversation.config) .map(([key, val]) => `${key}: ${val}`)46 unmodified lines }
function getHttpSnippets(conversation: Conversation) { const formattedMessages = ({ sep, start, end }) => const formattedMessages = ({ sep, start, end }: MessagesJoiner) => start + getMessages() .map(({ role, content }) => `{ "role": "${role}", "content": "${content}" }`) .join(sep) + end;
const formattedConfig = ({ sep, start, end }) => const formattedConfig = ({ sep, start, end }: MessagesJoiner) => start + Object.entries(conversation.config) .map(([key, val]) => `"${key}": ${val}`)src/lib/components/InferencePlayground/InferencePlaygroundCodeSnippets.svelte+12-6