Spaces:
Sleeping
Sleeping
support system messages in code snippets
Browse filesFiles changed (2)
39 unmodified lines4041424344454647434445111 unmodified lines15715815916516016116216316439 unmodified lines let waitForNonStreaming = true;
$: systemPromptSupported = isSystemPromptSupported(conversation.model); $: { if (!systemPromptSupported) { conversation.systemMessage = { role: "system", content: "" }; } }
function addMessage() { conversation.messages = [111 unmodified lines placeholder={systemPromptSupported ? "Enter a custom prompt" : "System prompt is not supported with the chosen model."} bind:value={conversation.systemMessage.content} 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 lines89101112131432 unmodified lines4748494950515253545556575859606162637 unmodified lines import 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 lines
function getMessages() { const placeholder = [{ role: "user", content: "Tell me a story" }]; let messages = conversation.messages;
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