PageSourceSearch

https://www.projectread.ai/_next/static/chunks/pages/dev/playground/prompting-e5a4ef85aa962149.js

js projectread.ai collected 2026-09-24 10:36:33 UTC 14,097 bytes, 1 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6e182860-6cdf-4d2b-9003-e939f72fb0ed",e._sentryDebugIdIdentifier="sentry-dbid-6e182860-6cdf-4d2b-9003-e939f72fb0ed")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([["3003"],{31169:function(e,t,i){e=i.nmd(e),(window.__NEXT_P=window.__NEXT_P||[]).push(["/dev/playground/prompting",function(){return i(74082)}]),e.hot&&e.hot.dispose(function(){window.__NEXT_P.push(["/dev/playground/prompting"])})},31780:function(e,t,i){"use strict";i.d(t,{V:()=>d});var n=i(95931),r=i(78694);let d=(e,t)=>{let[i,d]=(0,n.useState)(t),[l,a]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let t=window.localStorage.getItem(e),i=t?r.n9.parse(t):void 0;void 0!==i&&d(i),a(!0);let n=t=>{t.key===e&&t.newValue&&d(r.n9.parse(t.newValue))};return window.addEventListener("storage",n),()=>{window.removeEventListener("storage",n)}},[e]),[i,(0,n.useCallback)(t=>{d(i=>{let n=window.localStorage.getItem(e),d="function"==typeof t?t(i):t,l=r.n9.stringify(d);return window.localStorage.setItem(e,l),window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:l,oldValue:n,storageArea:window.localStorage,url:window.location.href})),d})},[e]),l]}},74082:function(e,t,i){"use strict";i.r(t),i.d(t,{default:()=>I,__N_SSP:()=>S});var n=i(97496),r=i(40006),d=i(20178),l=i.n(d),a=i(95931),o=i(99168),c=i(16258),s=i(94892),u=i(51976),p=i(25791),h=i(76846),g=i(31780),m=i(97451),v=i(46128),y=i(11823);i(49677).Km(["claude-opus-4-5","claude-sonnet-4-5","claude-haiku-4-5","claude-3-sonnet-20240229","claude-3-opus-20240229","claude-3-haiku-20240307","claude-3-5-haiku-20241022","claude-3-5-sonnet-20241022"]);let f={haiku:{name:"Claude Haiku 4.5",identifier:"claude-haiku-4-5"},sonnet:{name:"Claude Sonnet 4.5",identifier:"claude-sonnet-4-5"},opus:{name:"Claude Opus 4.5",identifier:"claude-opus-4-5"}};var Z=i(17574);let b=e=>{var t;let{curriculumId:i,objectiveId:r,prompt:d}=e,[l,u]=(0,a.useState)(d),[h,m]=(0,a.useState)(f.haiku.identifier),[v,y]=(0,g.V)("claude-temperature",1),[Z,b]=(0,a.useState)(!1),[w,X]=(0,a.useState)();return(0,n.BX)(n.HY,{children:[(0,n.BX)(p.Z,{title:"Claude Prompt",pad:!0,children:[(0,n.BX)("div",{css:{width:"100%"},children:[(0,n.BX)("div",{css:{display:"flex",justifyContent:"space-between"},children:[(0,n.tZ)("label",{htmlFor:"claude-prompt-input",children:"Prompt"}),(0,n.BX)("div",{children:[null!=(t=l.tokens)?t:"??"," tokens"]})]}),(0,n.tZ)("textarea",{id:"claude-prompt-input",css:{display:"block",padding:"0.5em",width:"100%",minHeight:300,resize:"vertical"},value:l.text,onChange:e=>{u(t=>({...t,text:e.target.value,tokens:void 0}))}})]}),(0,n.BX)("div",{css:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:24,marginBottom:16},children:[(0,n.tZ)(c.yt,{label:"Model",identifier:"claudeModel",children:(0,n.tZ)(s.l,{id:"claudeModel",onChange:e=>{m(e.target.value)},value:h,children:Object.values(f).map(e=>{let{name:t,identifier:i}=e;return(0,n.tZ)("option",{value:i,children:t},i)})})}),(0,n.tZ)(c.yt,{label:"Temperature",identifier:"temperature",children:(0,n.BX)("div",{css:{display:"flex",gap:16,fontSize:14,alignItems:"center"},children:[(0,n.tZ)("input",{id:"temperature",type:"range",min:0,max:1,step:.05,value:v,onChange:e=>{y(Number.parseFloat(e.target.value))},css:{width:"100%",height:30}}),(0,n.tZ)("div",{css:{flex:"0 0 60px"},children:v.toFixed(2)})]})})]}),(0,n.tZ)("div",{css:{display:"flex",gap:24},children:(0,n.tZ)(o.zx,{onClick:()=>{b(!0),x({service:"claude",curriculumId:i,objectiveId:r,model:h,prompt:l.text,temperature:v}).then(X).finally(()=>{b(!1)})},loading:Z,loadingLabel:"Generating story",disabled:!l.text,css:!l.text||Z?{opacity:.5,cursor:"not-allowed"}:{},children:"Generate Story"})})]}),w&&(0,n.tZ)(B,{story:w})]})},w=e=>{let{curriculumId:t,objectiveId:i,prompt:r}=e,[d,l]=(0,a.useState)(r.messages.system),[u,h]=(0,a.useState)(r.messages.user),[m,v]=(0,g.V)("playground-openai-model",Z.Vc.at(-1)),[y,f]=(0,g.V)("openai-temperature",1),[b,w]=(0,g.V)("openai-frequency-penalty",0),[X,C]=(0,g.V)("openai-reasoning-effort","medium"),[S,I]=(0,g.V)("openai-verbosity","medium"),[k,_]=(0,a.useState)(!1),[P,j]=(0,a.useState)(),E=!Z.Vc.includes(m),F=/gpt-5/i.test(m);return(0,n.BX)(n.HY,{children:[(0,n.BX)(p.Z,{title:"OpenAI Prompt",pad:!0,children:[(0,n.tZ)(c.yt,{label:"System prompt",identifier:"systemPrompt",children:(0,n.tZ)("textarea",{id:"systemPrompt",css:{display:"block",padding:"0.5em",width:"100%",minHeight:60,resize:"vertical"},value:d,onChange:e=>{l(e.target.value)}})}),(0,n.tZ)(c.yt,{label:"User prompt",identifier:"userPrompt",children:(0,n.tZ)("textarea",{id:"userPrompt",css:{display:"block",padding:"0.5em",width:"100%",minHeight:300,resize:"vertical"},value:u,onChange:e=>{h(e.target.value)}})}),(0,n.BX)("div",{css:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 24px",marginBottom:16},children:[(0,n.BX)(c.yt,{label:"Model",identifier:"openAiModel",css:{gridColumn:"1 / -1",margin:0},children:[(0,n.BX)(s.l,{id:"openAiModel",onChange:e=>{v(e.target.value)},value:E?"other":m,children:[Z.Vc.map(e=>(0,n.tZ)("option",{value:e,children:e},e)),(0,n.tZ)("option",{value:"other",children:"Other"})]}),E&&(0,n.tZ)("input",{type:"text",value:m,onChange:e=>{v(e.target.value)},css:{marginTop:8,width:"100%",padding:"0.5em",borderRadius:6,border:"1px solid #ccc"}})]}),(0,n.tZ)(c.yt,{label:"Temperature",identifier:"temperature",children:(0,n.BX)("div",{css:{display:"flex",gap:16,fontSize:14,alignItems:"center"},children:[(0,n.tZ)("input",{id:"temperature",type:"range",min:0,max:2,step:.05,value:y,onChange:e=>{f(Number.parseFloat(e.target.value))},css:{width:"100%",height:30}}),(0,n.tZ)("div",{css:{flex:"0 0 60px"},children:y.toFixed(2)})]})}),(0,n.tZ)(c.yt,{label:"Frequency Penalty",identifier:"frequencyPenalty",children:(0,n.BX)("div",{css:{display:"flex",gap:16,fontSize:14,alignItems:"center"},children:[(0,n.tZ)("input",{id:"frequencyPenalty",type:"range",min:-2,max:2,step:.1,value:b,onChange:e=>{w(Number.parseFloat(e.target.value))},css:{width:"100%",height:30}}),(0,n.tZ)("div",{css:{flex:"0 0 60px"},children:b.toFixed(1)})]})}),F&&(0,n.BX)(n.HY,{children:[(0,n.tZ)(c.yt,{label:"Reasoning Effort",identifier:"reasoningEffort",children:(0,n.BX)(s.l,{id:"reasoningEffort",value:X,onChange:e=>{C(e.target.value)},children:[(0,n.tZ)("option",{value:"minimal",children:"minimal"}),(0,n.tZ)("option",{value:"low",children:"low"}),(0,n.tZ)("option",{value:"medium",children:"medium"}),(0,n.tZ)("option",{value:"high",children:"high"})]})}),(0,n.tZ)(c.yt,{label:"Verbosity",identifier:"verbosity",children:(0,n.BX)(s.l,{id:"verbosity",value:S,onChange:e=>{I(e.target.value)},children:[(0,n.tZ)("option",{value:"low",children:"low"}),(0,n.tZ)("option",{value:"medium",children:"medium"}),(0,n.tZ)("option",{value:"high",children:"high"})]})})]})]}),(0,n.tZ)("div",{css:{display:"flex",gap:24},children:(0,n.tZ)(o.zx,{loading:k,loadingLabel:"Generating story",onClick:()=>{_(!0),x({service:"openai",model:m,temperature:y,frequency_penalty:b,reasoning_effort:F?X:void 0,verbosity:F?S:void 0,curriculumId:t,objectiveId:i,messages:{system:d,user:u}}).then(j).finally(()=>{_(!1)})},disabled:!u||!d||k,children:"Generate Story"})})]}),P&&(0,n.tZ)(B,{story:P})]})},x=async e=>fetch("/api/playground/prompting?action=generate-completion",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{if(e.success)return e;throw alert(e.error),Error(e.error)}),B=e=>{let{story:t}=e;return(0,n.tZ)(p.Z,{title:"Generated Story",pad:!0,css:{marginTop:24},children:(0,n.BX)("div",{css:{display:"flex",flexDirection:"column",gap:20},children:[(0,n.tZ)("div",{css:{...y.r.bodyL,lineHeight:1.8,padding:"1em",minHeight:50,background:y.r.colors.n0,borderRadius:8},children:(0,n.tZ)(h.y,{story:t.gpcEvaluation.story})}),(0,n.BX)("div",{css:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:20},children:[(0,n.tZ)(C,{data:t.gpcEvaluation}),(0,n.tZ)(X,{story:t.text,data:t.evaluation,gpcData:t.gpcEvaluation})]})]})})},X=e=>{let{data:{wordCount:t,uniqueWordCount:i,lines:r,focusWordsAvailable:d,focusWordCount:l,focusWordsUsed:a,expectedWordCount:o,disallowedWords:c,disallowedWordCount:s},gpcData:u,data:p}=e,g=u.story.reduce((e,t)=>
1("word"!==t.type||!t.evaluation.mappable||t.evaluation.decodable||e.some(e=>e.word===t.word)||e.push(t),e),[]).sort((e,t)=>t.evaluation.count-e.evaluation.count);return(0,n.BX)("div",{children:[(0,n.tZ)("h3",{children:"Stats"}),(0,n.BX)("dl",{css:{dt:{fontWeight:600},dd:{marginLeft:0,fontSize:14},"dd + dt":{marginTop:16},"dd + dd":{marginTop:8}},children:[(0,n.tZ)("dt",{children:"Lines"}),(0,n.tZ)("dd",{children:r}),(0,n.tZ)("dt",{children:"Word Count / Expected Count (%)"}),(0,n.BX)("dd",{children:[t," / ",o," (",(100*t/o).toFixed(1),"%)"]}),(0,n.BX)("dd",{children:["(",i," unique words)"]}),(0,n.BX)("dt",{children:["Disallowed Words (",s," / ",t,")"]}),(0,n.BX)("dd",{children:["Ratio: ",(s/t*100).toFixed(1),"%"]}),(0,n.tZ)("dd",{children:c.join(", ")}),(0,n.tZ)("dt",{children:"Unmapped Words"}),(0,n.tZ)("dd",{children:[...new Set(u.story.filter(e=>"word"===e.type&&!e.evaluation.mappable).map(e=>e.display))].join(", ")}),(0,n.BX)("dt",{children:["Non-Decodable Words (",g.length," / ",t,")"]}),(0,n.BX)("dd",{children:["Ratio: ",(g.length/t*100).toFixed(1),"%"]}),(0,n.tZ)("dd",{children:(0,n.BX)("table",{css:{borderCollapse:"collapse",marginTop:8,"th, td":{padding:"4px 8px",border:"1px solid #ddd",textAlign:"center"}},children:[(0,n.tZ)("thead",{children:(0,n.BX)("tr",{children:[(0,n.tZ)("th",{children:"Word"}),(0,n.tZ)("th",{children:"Min. Obj."}),(0,n.tZ)("th",{children:"Qty"})]})}),(0,n.tZ)("tbody",{children:g.map((e,t)=>{var i;return(0,n.BX)("tr",{children:[(0,n.tZ)("td",{children:(0,n.tZ)(h.k,{word:e})}),(0,n.tZ)("td",{children:null!=(i=e.evaluation.minObjective)?i:"Out of scope"}),(0,n.tZ)("td",{children:e.evaluation.count})]},t)})})]})}),(0,n.tZ)("dt",{children:"Focus Words"}),(0,n.BX)("dd",{children:[d," focus words for objective"]}),(0,n.BX)("dd",{children:[(l/t*100).toFixed(1),"% focus words (",l," of ",t,")"]}),(0,n.tZ)("dd",{children:(0,n.tZ)("ul",{children:a.toSorted().map((e,t)=>(0,n.tZ)("li",{children:e},t))})})]}),(0,n.BX)("details",{children:[(0,n.tZ)("summary",{css:{cursor:"pointer"},children:"Full JSON evaluation"}),(0,n.tZ)("pre",{css:{overflowX:"auto"},children:JSON.stringify(p,null,2)})]})]})},C=e=>{let{data:t}=e;return(0,n.BX)("div",{children:[(0,n.tZ)("h3",{children:"GPC Frequency (beta)"}),(0,n.BX)("small",{children:["Note: this does not take into account words that are not in the"," ",(0,n.tZ)("code",{children:"gpc_words"})," table yet."]}),(0,n.BX)("table",{css:{borderCollapse:"collapse",marginTop:8,"th, td":{padding:"4px 8px",border:"1px solid #ddd",textAlign:"center"}},children:[(0,n.tZ)("thead",{children:(0,n.BX)("tr",{children:[(0,n.tZ)("th",{children:"GPC"}),(0,n.tZ)("th",{children:"Decodable?"}),(0,n.tZ)("th",{children:"Frequency"})]})}),(0,n.tZ)("tbody",{children:Object.entries(t.gpcs).map(e=>{let[t,{count:i,decodable:r}]=e;return(0,n.BX)("tr",{children:[(0,n.tZ)("td",{children:t}),(0,n.tZ)("td",{children:r?"Yes":"No"}),(0,n.tZ)("td",{children:i})]},t)})})]})]})};var S=!0;let I=(0,r.j5)(e=>{let{curricula:t}=e,[i,r]=(0,a.useState)("claude"),[d,h]=(0,g.V)("playground-curriculum",1),[y,f]=(0,g.V)("playground-objective",1),[Z,x]=(0,a.useState)(""),[B,X]=(0,a.useState)(null),[C,S]=(0,a.useState)(!1),I=t.get(d).objectives;return(0,n.BX)(n.HY,{children:[(0,n.tZ)(m.d,{title:"Prompting Playground",noIndex:!0}),(0,n.tZ)("div",{css:{maxWidth:720,margin:"50px auto 8px"},children:(0,n.BX)(l(),{href:"/dev/playground",css:{transition:"transform 0.2s ease-out",":hover":{transform:"translateY(-1px)"}},children:["← ",(0,n.tZ)("small",{children:"Back to the playground"})]})}),(0,n.BX)(p.Z,{title:"Prompting Playground",pad:!0,css:{marginBottom:24},children:[(0,n.tZ)(c.yt,{label:"Curriculum",identifier:"objectiveIdInput",css:{margin:"0 0 16px 0"},children:(0,n.tZ)(s.l,{value:d,id:"curriculumIdInput",onChange:e=>{let i=t.get(Number.parseInt(e.target.value));h(i.id),f(i.settings.defaultObjective),X(null)},children:[...t.values()].map(e=>{let{id:t,name:i}=e;return(0,n.tZ)("option",{value:t,children:i},t)})})}),(0,n.tZ)(c.yt,{label:"Objective ID",identifier:"objectiveIdInput",css:{margin:0},children:(0,n.tZ)(s.l,{value:y,id:"objectiveIdInput",onChange:e=>{f(Number.parseInt(e.target.value)),X(null)},children:I.map(e=>{let{objectiveId:t,label:i,concept:r}=e;return(0,n.BX)("option",{value:t,children:[i,": ",r]},t)}
1)})}),(0,n.tZ)(c.yt,{label:"Service",identifier:"promptInput",children:(0,n.BX)("div",{css:{display:"flex",gap:24,label:{cursor:"pointer"}},children:[(0,n.BX)("label",{htmlFor:"claude",css:{display:"flex",gap:8},children:[(0,n.tZ)("input",{type:"radio",id:"claude",name:"service",value:"Claude",checked:"claude"===i,onChange:()=>{r("claude"),X(null)}}),"Claude"]}),(0,n.BX)("label",{htmlFor:"openai",css:{display:"flex",gap:8},children:[(0,n.tZ)("input",{type:"radio",id:"openai",name:"service",value:"OpenAI",checked:"openai"===i,onChange:()=>{r("openai"),X(null)}})," ","OpenAI"]})]})}),"openai"===i&&(0,n.tZ)(c.yt,{label:"Custom Words",identifier:"customWords",children:(0,n.tZ)(u.o,{value:Z,onChange:e=>{x(e.target.value)}})}),(0,n.tZ)("div",{css:{display:"flex",gap:24},children:(0,n.tZ)(o.zx,{loading:C,loadingLabel:"Generating prompt",onClick:()=>{S(!0),v.L.post("/api/playground/prompting?action=generate-prompt",{body:{curriculumId:d,objectiveId:y,service:i,customWords:Z.trim()?Z.trim().split(/ *, */):void 0}}).then(e=>{"service"in e?X(e):alert(e.error)}).finally(()=>{S(!1)})},css:{flex:"0 0 auto"},children:"Generate Prompt"})})]}),!C&&B&&("claude"===B.service?(0,n.tZ)(b,{curriculumId:d,objectiveId:y,prompt:B}):(0,n.tZ)(w,{curriculumId:d,objectiveId:y,prompt:B}))]})})}},function(e){e.O(0,["2203","344","6909","8624","8808","9174"],function(){return e(e.s=31169)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.