Spaces:
Sleeping
Sleeping
support system messages in code snippets
Browse filesFiles changed (2)
39 unmodified lines4041424344454647484950111 unmodified lines16216316416516616716839 unmodified lineslet waitForNonStreaming = true;$: systemPromptSupported = isSystemPromptSupported(conversation.model);$: {if (!systemPromptSupported) {conversation.systemMessage = { role: "system", content: "" };}}function addMessage() {conversation.messages = [111 unmodified linesplaceholder={systemPromptSupported? "Enter a custom prompt": "System prompt is not supported with the chosen model."}bind:value={conversation.systemMessage.content}class="absolute inset-x-0 bottom-0 h-full resize-none bg-transparent px-3 pt-10 text-sm outline-none"></textarea></div>39 unmodified lines404142434445111 unmodified lines15715815916016116216316439 unmodified lineslet waitForNonStreaming = true;$: systemPromptSupported = isSystemPromptSupported(conversation.model);function addMessage() {conversation.messages = [111 unmodified linesplaceholder={systemPromptSupported? "Enter a custom prompt": "System prompt is not supported with the chosen model."}value={systemPromptSupported ? conversation.systemMessage.content : ""}on:input={e => (conversation.systemMessage.content = e.currentTarget.value)}class="absolute inset-x-0 bottom-0 h-full resize-none bg-transparent px-3 pt-10 text-sm outline-none"></textarea></div>
7 unmodified lines891011121332 unmodified lines464748495051525354557 unmodified linesimport http from "highlight.js/lib/languages/http";import IconCopyCode from "../Icons/IconCopyCode.svelte";hljs.registerLanguage("javascript", javascript);hljs.registerLanguage("python", python);32 unmodified linesfunction getMessages() {const placeholder = [{ role: "user", content: "Tell me a story" }];let messages = conversation.messages;if (messages.length === 1 && messages[0].role === "user" && !messages[0].content) {messages = placeholder;}return messages;}7 unmodified lines89101112131432 unmodified lines47484950515253545556575859606162637 unmodified linesimport http from "highlight.js/lib/languages/http";import IconCopyCode from "../Icons/IconCopyCode.svelte";import { isSystemPromptSupported } from "./inferencePlaygroundUtils";hljs.registerLanguage("javascript", javascript);hljs.registerLanguage("python", python);32 unmodified linesfunction getMessages() {const placeholder = [{ role: "user", content: "Tell me a story" }];let messages = [...conversation.messages];if (messages.length === 1 && messages[0].role === "user" && !messages[0].content) {messages = placeholder;}const { model, systemMessage } = conversation;if (isSystemPromptSupported(model) && systemMessage.content?.length) {messages.unshift(systemMessage);}return messages;}
src/lib/components/InferencePlayground/InferencePlayground.svelte+2-6
src/lib/components/InferencePlayground/InferencePlaygroundCodeSnippets.svelte+9-1