PageSourceSearch

https://www.codechef.com/build/react2/assets/ContentGenerationLayout-BEiCW8kv.js

js codechef.com collected 2026-09-24 08:55:08 UTC 10,151 bytes, 4 lines download raw bytes

1import{r as a,a3 as l,Z as e,Y as Te}from"./vendor-mui-D5pLRgDb.js";import{U as Y,r as $,v as ve,M as S,A as I,e as X,C as Z,m as Ae,s as Ne,k as Ee,q as _e,z as ye,d as Ge,T as we}from"./index-BSFWpFMK.js";import{T as Ie}from"./TwoColumnLayout-CEOrMY6p.js";import{M as ke}from"./ManageTabs-CrKh4Y_n.js";import{a as Oe,b as xe}from"./Actions-CzYwivyg.js";import{S as G}from"./Select-BphtUsk_.js";import{S as T,T as d}from"./InputFields-BJUL-RVv.js";import{A as U}from"./Accordion-Ps8lDRna.js";import{S as Le}from"./CheckBox-Dkb41L1G.js";import{D as De}from"./DataTable-cROclEAW.js";import"./__commonjsHelpers__-BosuxZz1.js";import"./vendor-sweetalert2-CokzRhbv.js";import"./TopBanner-C3LORJp2.js";import"./vendor-react-csv-Uy1MYOCL.js";import"./BreadCrumbs-Ce1rw5PH.js";import"./TopBanner.module--qQpYJq9.js";import"./TwoColumnBox-gHXb3Blm.js";import"./vendor-mui-datatables-CtAfvKRw.js";import"./index.es-CLmToPHp.js";const Re="AICONTEST01",Me="anthropic",We="deepseek",Be="openai",je="gemini-3.1-pro-preview",ee="gemini-3-flash-preview",w="::",qe=[{data:{id:"concept",title:"Concept Problem",problemCode:"AIPROB01"},checked:!0},{data:{id:"visualizer",title:"Visualizer",problemCode:"AIPROB02"},checked:!0},{data:{id:"workedOutExample",title:"Worked Out Example",problemCode:"AIPROB03"},checked:!0},{data:{id:"practiceProblem1",title:"Practice Problem 1",problemCode:"AIPROB04"},checked:!0},{data:{id:"practiceProblem2",title:"Practice Problem 2",problemCode:"AIPROB05"},checked:!0},{data:{id:"mcqProblem",title:"MCQ Problem",problemCode:"AIPROB06"},checked:!0},{data:{id:"shortAnswerProblem",title:"Short Answer Problem",problemCode:"AIPROB07"},checked:!0}],Ke=[{id:"default",name:"Default"}],Fe=[{id:Be,name:"ChatGPT"},{id:Me,name:"Claude"},{id:We,name:"DeepSeek"},{id:je,name:"Gemini Pro Preview"},{id:ee,name:"Gemini Flash"}],He="_form_e8p7p_1",Je="_formGroup_e8p7p_5",ze="_submit_e8p7p_12",Qe="_inputGroup_e8p7p_16",Ue="_promptsAccordian_e8p7p_27",Ve="_problemTypesTable_e8p7p_32",Ye="_kpComponentSelection_e8p7p_47",$e="_select_e8p7p_52",t={form:He,formGroup:Je,submit:ze,inputGroup:Qe,promptsAccordian:Ue,problemTypesTable:Ve,kpComponentSelection:Ye,select:$e};function Xe(){const{dispatch:n}=a.useContext(C),{dispatch:r}=a.useContext(Y),{setRefreshJobs:h}=a.useContext(C),[A,N]=a.useState(""),[P,E]=a.useState(""),[f,_]=a.useState(""),[g,b]=a.useState(""),[m,y]=a.useState(""),[k,oe]=a.useState("PYTH 3"),[O,x]=a.useState(""),[L,D]=a.useState(""),[R,M]=a.useState(""),[W,B]=a.useState(""),[j,q]=a.useState(""),[K,F]=a.useState(""),[H,re]=a.useState(Re),[J,ne]=a.useState("default"),[z,se]=a.useState(ee),[u,Q]=a.useState(qe),[le,ie]=a.useState({}),ce=$();a.useEffect(()=>{(async()=>{try{r(S(!0));const s=await I.get("api/ai/content/generate"),{defaultConceptPrompt:p,defaultWorkedOutExamplePrompt:i,defaultPracticeProblem1Prompt:c,defaultPracticeProblem2Prompt:Pe,defaultMcqProblemPrompt:fe,defaultShortAnswerProblemPrompt:ge}=s.data,Se=s.data.supportedLanguages;x(p),D(i),M(c),B(Pe),q(fe),F(ge),ie(Se)}catch(s){r(X(s))}finally{r(S(!1))}})()},[]);const pe=async o=>{o.preventDefault();try{r(S(!0));const s={topicName:A,kps:P.split(`
2`).join(w),preTopics:f.split(`
3`).join(w),postTopics:g.split(`
4`).join(w),language:m,solutionTemplateLanguage:k,conceptPrompt:O,workedOutExamplePrompt:L,practiceProblem1Prompt:R,practiceProblem2Prompt:W,mcqProblemPrompt:j,shortAnswerProblemPrompt:K,contestCode:H,problemTypes:u.map(c=>({type:c.data.id,problemCode:c.data.problemCode,selected:c.checked})),mode:J,aiAgent:z},p=await I.post("api/ai/content/generate",s),i=Z(v,{tab:"tablist"});ce({pathname:"/ai/content-generation",search:`?tab=${i}`}),n(Oe(i)),h(c=>!c),Ae(p.data.message)}catch(s){Ne(s)}finally{r(S(!1))}},de=(o,s)=>{const p=u.map((i,c)=>c===o?{...i,checked:s}:i);Q(p)},me=o=>s=>{const p=u.map((i,c)=>c===o?{...i,data:{...i.data,problemCode:s}}:i);Q(p)},ue=()=>l("div",{className:t.kpComponentSelection,children:[e("label",{children:"Select Components in KP"}),l("table",{className:t.problemTypesTable,children:[e("thead",{children:e("tr",{children:u.map(o=>e("th",{children:o.data.title},o.data.id))})}),l("tbody",{children:[e("tr",{children:u.map((o,s)=>e("td",{children:e(Le,{checked:o.checked,handleChange:p=>{de(s,p)},style:{}})},o.data.id))}),e("tr",{children:u.map((o,s)=>e("td",{children:e(T,{value:o.data.problemCode,handleChange:me(s),required:!0,placeholder:"Enter the problem code to clone the Concept Problem from:",type:"text",props:{}})},o.data.id))})]})]})]}),he=()=>l("div",{children:[e("label",{className:t.inputGroup,children:" Concept Prompt "}),e(d,{placeholder:"Enter the concept prompt here",value:O,handleChange:x,rows:20,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}}),e("label",{className:t.inputGroup,children:" Worked Out Example Prompt "}),e(d,{placeholder:"Enter the worked out example prompt here",value:L,handleChange:D,rows:20,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}}),e("label",{className:t.inputGroup,children:" Practice Problem 1 Prompt "}),e(d,{placeholder:"Enter the practice problem 1 prompt here",value:R,handleChange:M,rows:20,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}}),e("label",{className:t.inputGroup,children:" Practice Problem 2 Prompt "}),e(d,{placeholder:"Enter the practice problem 2 prompt here",value:W,handleChange:B,rows:20,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}}),e("label",{className:t.inputGroup,children:" MCQ Problem Prompt "}),e(d,{placeholder:"Enter the MCQ problem prompt here",value:j,handleChange:q,rows:20,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}}),e("label",{className:t.inputGroup,children:" Short Answer Problem Prompt "}),e(d,{placeholder:"Enter the short answer problem prompt here",value:K,handleChange:F,rows:20,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}})]}),be=()=>e("div",{className:t.promptsAccordian,children:e(U,{elements:[{title:"AI Prompts",details:he()}]})}),Ce=()=>l("div",{children:[e("label",{className:t.inputGroup,children:" Sources to Clone from:"}),l("div",{className:t.formGroup,children:[e("label",{className:t.inputGroup,children:" Contest Code:(Note: Make sure this contest doesn't have any problems added)"}),e(T,{value:H,handleChange:re,required:!0,placeholder:"Enter the contest code to clone:",type:"text",props:{}})]}),ue(),be()]});return l("form",{onSubmit:pe,className:t.form,children:[l("div",{className:t.formGroup,children:[e("label",{className:t.inputGroup,children:" Topic Name: "}),e(T,{value:A,handleChange:N,required:!0,placeholder:"Enter topic name",type:"text",props:{}})]}),l("div",{className:t.formGroup,children:[e("label",{className:t.inputGroup,children:" Subtopic List (KPs): "}),e(d,{placeholder:"Enter KPs on separate lines",value:P,handleChange:E,rows:5,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}})]}),l("div",{className:t.formGroup,children:[e("label",{className:t.inputGroup,children:" Topics Covered Before: "}),e(d,{placeholder:"Enter topics covered before on separate lines",value:f,handleChange:_,rows:5,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}})]}),l("div",{className:t.formGroup,children:[e("label",{className:t.inputGroup,children:" Topics Covered After: "}),e(d,{placeholder:"Enter topics covered after on separate lines",value:g,handleChange:b,rows:5,defaultStyles:{height:"auto",float:"inherit",minWidth:"100%"}})]}),l("div",{className:t.formGroup,children:[e("label",{className:t.inputGroup,children:" Language(to tell AI): "}),e(T,{value:m,handleChange:y,required:!0,placeholder:"Enter language",type:"text",props:{}})]}),l("div",{className:t.formGroup,children:[e("label",{children:" Solution Template Language: "}
4),e("div",{className:t.select,children:e(G,{name:"solutionTemplateLanguage",options:Object.values(le).map(o=>({id:o.short_name,name:o.full_name})),required:!0,handleChange:oe,selectedKey:k})})]}),l("div",{className:t.formGroup,children:[e("label",{children:" AI Agent: "}),e("div",{className:t.select,children:e(G,{name:"aiAgent",options:Fe,handleChange:se,selectedKey:z})})]}),l("div",{className:t.formGroup,children:[e("label",{children:" Mode: "}),e("div",{className:t.select,children:e(G,{name:"mode",options:Ke,handleChange:ne,selectedKey:J})})]}),e("div",{children:e(U,{elements:[{title:"Advanced Settings",details:Ce()}]})}),e("div",{className:t.submit,children:e(ve,{title:"Start Creation",type:"primary"})})]})}function Ze(){const{state:n}=a.useContext(C);return e("div",{children:e(De,{title:"All Jobs",columns:[{label:"Contest Code",name:"code"},{label:"Topic Name",name:"topic_name"},{label:"Created By",name:"name"},{label:"Status",name:"status"},{label:"Created At",name:"created_at"}],data:n.jobs,noRecordsMessage:"No Jobs available"})})}const et=n=>{switch(n){case"joblist":return e(Ze,{});case"contentgen":return e(Xe,{});default:return e(Ee,{})}};function tt(){const n=a.useContext(C),{activeTab:r}=n.state;return et(r)}const te="SWITCH_TABS",at="FETCH_DATA",ae={activeTab:"joblist",jobs:[]},ot=(n,r)=>{switch(r.type){case te:return{...n,activeTab:r.payload};case at:return{...n,jobs:r.payload};default:return n}};function V(n){return{type:te,payload:n}}const C=Te.createContext({state:ae,dispatch:()=>{},setRefreshJobs:()=>{}}),v=[{id:"joblist",name:"Job List"},{id:"contentgen",name:"Generate Content"}];function At(){const[n,r]=a.useReducer(ot,ae),{dispatch:h,state:A}=a.useContext(Y),N=_e(),P=$(),E=ye.parse(N.search),[f,_]=a.useState(!1),g=()=>[{link:"/",name:"Home"},{link:null,name:"Ai-Content-Generation"}];return a.useEffect(()=>{(async()=>{try{const m=await I.get("api/ai/content/jobs"),{jobs:y}=m.data;r(xe(y)),h(Ge("Ai Content Generation")),v.length&&r(V(Z(v,E)))}catch(m){h(X(m))}finally{h(we(!1))}})()},[f]),e(C.Provider,{value:{state:n,dispatch:r,setRefreshJobs:_},children:e(Ie,{title:"AI Content Generation",navItems:[],breadCrumbData:g(),rightColumnData:e(tt,{}),leftMaxWidth:"240px",leftColumnData:e(ke,{fields:v,handleTabChange:b=>{P({pathname:"/ai/content-generation",search:`?tab=${b}`}),r(V(b))},activeTab:n.activeTab,name:"Ai Gen"})})})}export{C as AIContentGenContext,At as default,v as tabs};

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.