From 370e2cb2621985c5e5f1c1204d1aaea4e2f404a3 Mon Sep 17 00:00:00 2001 From: Arash Ashra Date: Thu, 11 Apr 2024 10:02:52 -0400 Subject: [PATCH] api key updated --- r2r_python_ide/assets/index-z7_E-COP.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r2r_python_ide/assets/index-z7_E-COP.js b/r2r_python_ide/assets/index-z7_E-COP.js index b475aac..c3a838d 100644 --- a/r2r_python_ide/assets/index-z7_E-COP.js +++ b/r2r_python_ide/assets/index-z7_E-COP.js @@ -124,7 +124,7 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g., new OpenAI({ apiKey, dangerouslyAllowBrowser: true }); https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety -`);super({baseURL:O.baseURL,timeout:O.timeout??6e5,httpAgent:O.httpAgent,maxRetries:O.maxRetries,fetch:O.fetch}),this.completions=new UQ(this),this.chat=new $Q(this),this.embeddings=new RQ(this),this.files=new BQ(this),this.images=new CQ(this),this.audio=new mQ(this),this.moderations=new YQ(this),this.models=new WQ(this),this.fineTuning=new EQ(this),this.beta=new _Q(this),this._options=O,this.apiKey=n,this.organization=i}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),"OpenAI-Organization":this.organization,...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}}q7=sn;sn.OpenAI=q7;sn.OpenAIError=Ue;sn.APIError=Pn;sn.APIConnectionError=fm;sn.APIConnectionTimeoutError=y1;sn.APIUserAbortError=Ui;sn.NotFoundError=$7;sn.ConflictError=p7;sn.RateLimitError=g7;sn.BadRequestError=f7;sn.AuthenticationError=d7;sn.InternalServerError=m7;sn.PermissionDeniedError=h7;sn.UnprocessableEntityError=Q7;(function(t){t.toFile=b7,t.fileFromPath=c7,t.Page=b1,t.CursorPage=ro,t.Completions=UQ,t.Chat=$Q,t.Embeddings=RQ,t.Files=BQ,t.FileObjectsPage=U1,t.Images=CQ,t.Audio=mQ,t.Moderations=YQ,t.Models=WQ,t.ModelsPage=q1,t.FineTuning=EQ,t.Beta=_Q})(sn||(sn={}));const C5e=sn,W5e="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",Y5e=new C5e({apiKey:W5e,dangerouslyAllowBrowser:!0}),Z5e=async(t,e)=>(console.log("prev new messages ",t,e),(await Y5e.chat.completions.create({model:"gpt-4-vision-preview",messages:[...t,e]})).choices[0]),z5e=()=>{const{messages:t,dispatchMessages:e}=I.useContext(Gf),{uiData:n,dispatchUiData:i}=I.useContext(io);return b.jsxs("div",{className:"text-white",children:[t.messageList.map((r,O)=>{var o;return b.jsxs("div",{children:[r.role==="user"&&b.jsx(G5e,{prompt:`${(o=r==null?void 0:r.content[0])==null?void 0:o.text.split(" Here's whole code.")[0]}`}),r.role==="assistant"?n.chatScreenStatus!="followUpReviewAction"&&t.messageList.length-1==O?b.jsx(F5e,{prompt:`${r==null?void 0:r.content}`}):b.jsx(V5e,{prompt:`${r==null?void 0:r.content}`}):""]},O)}),t.takeScreenshot&&b.jsx(D5e,{image:t.image}),n.chatScreenStatus==="followUpAskQuestion"&&b.jsx(j5e,{}),n.chatScreenStatus==="followUpReviewAction"&&b.jsx(I5e,{})]})},G5e=({prompt:t})=>b.jsx("div",{className:"chat-prompt-user-message-container",children:b.jsx("div",{className:"chat-prompt-user-message-text-container",children:b.jsxs("div",{children:[b.jsx("div",{className:"chat-prompt-user-message-container-header-text-container",children:b.jsxs("h3",{className:"chat-prompt-user-message-container-header-text",children:[b.jsx("strong",{children:"You"})," asked:"]})}),b.jsx("div",{className:"chat-prompt-user-message-container-footer-text-container",children:b.jsx("pre",{className:"chat-prompt-user-message-container-footer-text",children:t})})]})})}),V5e=({prompt:t})=>b.jsx("div",{className:"chat-prompt-assistant-message-container",children:b.jsx("div",{className:"chat-prompt-assistant-message-text-container",children:b.jsxs("div",{children:[b.jsx("div",{className:"chat-prompt-assistant-message-container-header-text-container",children:b.jsxs("h3",{className:"chat-prompt-assistant-message-container-header-text",children:[b.jsx("strong",{children:"Rigorous Raven"})," says:"]})}),b.jsx("div",{className:"chat-prompt-assistant-message-container-text-box",children:b.jsx("pre",{className:"chat-prompt-assistant-message-container-text",children:t})})]})})}),F5e=({prompt:t})=>{const{uiData:e,dispatchUiData:n}=I.useContext(io);return b.jsxs("div",{className:"chat-prompt-assistant-message-follow-up-container",children:[b.jsx("img",{className:"chat-prompt-assistant-message-follow-up-container-avater",src:"./imoje-charecters/raven-prof.png",alt:"Avatar"}),b.jsxs("div",{className:"chat-prompt-assistant-message-follow-up-text-container",children:[b.jsxs("div",{className:"chat-prompt-assistant-message-follow-up-content",children:[b.jsxs("h3",{className:"chat-prompt-assistant-message-follow-up-container-header-text",children:[b.jsx("strong",{children:"Rigorous Raven"})," says:"]}),b.jsxs("div",{className:"chat-prompt-assistant-message-follow-up-text-box",children:[b.jsx("div",{className:"chat-prompt-assistant-message-follow-up-text-box-triangle"}),b.jsx("pre",{className:"chat-prompt-assistant-message-follow-up-assistant-text",children:t})]})]}),e.chatScreenStatus!=="followUpAskQuestion"&&b.jsx("div",{className:"follow-up-button-section",children:b.jsxs("div",{className:"buttons follow-up-buttons",children:[b.jsx("div",{className:"danger button-container",children:b.jsx("button",{className:"unclicked btn",children:"Report"})}),b.jsx("div",{className:"passive button-container",children:b.jsx("button",{className:"unclicked btn btn-big-x-padding",onClick:()=>n({type:"setChatScreenStatus",payload:"followUpReviewAction"}),children:"Thanks, That's all!"})}),b.jsx("div",{className:"progressive button-container",children:b.jsx("button",{className:"unclicked btn btn-big-x-padding",onClick:()=>n({type:"setChatScreenStatus",payload:"followUpAskQuestion"}),children:"Ask Follow-Up"})})]})})]})]})},j5e=()=>{const t=["What dose this do?","Teach me more!","Show an example?"],[e,n]=I.useState(""),{messages:i,dispatchMessages:r}=I.useContext(Gf),{uiData:O,dispatchUiData:o}=I.useContext(io),[a,l]=I.useState(""),[A,c]=I.useState(!1),u=async()=>{var h;c(!0);const f=i.messageList.length<=1?`Here's whole code. +`);super({baseURL:O.baseURL,timeout:O.timeout??6e5,httpAgent:O.httpAgent,maxRetries:O.maxRetries,fetch:O.fetch}),this.completions=new UQ(this),this.chat=new $Q(this),this.embeddings=new RQ(this),this.files=new BQ(this),this.images=new CQ(this),this.audio=new mQ(this),this.moderations=new YQ(this),this.models=new WQ(this),this.fineTuning=new EQ(this),this.beta=new _Q(this),this._options=O,this.apiKey=n,this.organization=i}defaultQuery(){return this._options.defaultQuery}defaultHeaders(e){return{...super.defaultHeaders(e),"OpenAI-Organization":this.organization,...this._options.defaultHeaders}}authHeaders(e){return{Authorization:`Bearer ${this.apiKey}`}}}q7=sn;sn.OpenAI=q7;sn.OpenAIError=Ue;sn.APIError=Pn;sn.APIConnectionError=fm;sn.APIConnectionTimeoutError=y1;sn.APIUserAbortError=Ui;sn.NotFoundError=$7;sn.ConflictError=p7;sn.RateLimitError=g7;sn.BadRequestError=f7;sn.AuthenticationError=d7;sn.InternalServerError=m7;sn.PermissionDeniedError=h7;sn.UnprocessableEntityError=Q7;(function(t){t.toFile=b7,t.fileFromPath=c7,t.Page=b1,t.CursorPage=ro,t.Completions=UQ,t.Chat=$Q,t.Embeddings=RQ,t.Files=BQ,t.FileObjectsPage=U1,t.Images=CQ,t.Audio=mQ,t.Moderations=YQ,t.Models=WQ,t.ModelsPage=q1,t.FineTuning=EQ,t.Beta=_Q})(sn||(sn={}));const C5e=sn,W5e="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",Y5e=new C5e({apiKey:W5e,dangerouslyAllowBrowser:!0}),Z5e=async(t,e)=>(console.log("prev new messages ",t,e),(await Y5e.chat.completions.create({model:"gpt-4-vision-preview",messages:[...t,e]})).choices[0]),z5e=()=>{const{messages:t,dispatchMessages:e}=I.useContext(Gf),{uiData:n,dispatchUiData:i}=I.useContext(io);return b.jsxs("div",{className:"text-white",children:[t.messageList.map((r,O)=>{var o;return b.jsxs("div",{children:[r.role==="user"&&b.jsx(G5e,{prompt:`${(o=r==null?void 0:r.content[0])==null?void 0:o.text.split(" Here's whole code.")[0]}`}),r.role==="assistant"?n.chatScreenStatus!="followUpReviewAction"&&t.messageList.length-1==O?b.jsx(F5e,{prompt:`${r==null?void 0:r.content}`}):b.jsx(V5e,{prompt:`${r==null?void 0:r.content}`}):""]},O)}),t.takeScreenshot&&b.jsx(D5e,{image:t.image}),n.chatScreenStatus==="followUpAskQuestion"&&b.jsx(j5e,{}),n.chatScreenStatus==="followUpReviewAction"&&b.jsx(I5e,{})]})},G5e=({prompt:t})=>b.jsx("div",{className:"chat-prompt-user-message-container",children:b.jsx("div",{className:"chat-prompt-user-message-text-container",children:b.jsxs("div",{children:[b.jsx("div",{className:"chat-prompt-user-message-container-header-text-container",children:b.jsxs("h3",{className:"chat-prompt-user-message-container-header-text",children:[b.jsx("strong",{children:"You"})," asked:"]})}),b.jsx("div",{className:"chat-prompt-user-message-container-footer-text-container",children:b.jsx("pre",{className:"chat-prompt-user-message-container-footer-text",children:t})})]})})}),V5e=({prompt:t})=>b.jsx("div",{className:"chat-prompt-assistant-message-container",children:b.jsx("div",{className:"chat-prompt-assistant-message-text-container",children:b.jsxs("div",{children:[b.jsx("div",{className:"chat-prompt-assistant-message-container-header-text-container",children:b.jsxs("h3",{className:"chat-prompt-assistant-message-container-header-text",children:[b.jsx("strong",{children:"Rigorous Raven"})," says:"]})}),b.jsx("div",{className:"chat-prompt-assistant-message-container-text-box",children:b.jsx("pre",{className:"chat-prompt-assistant-message-container-text",children:t})})]})})}),F5e=({prompt:t})=>{const{uiData:e,dispatchUiData:n}=I.useContext(io);return b.jsxs("div",{className:"chat-prompt-assistant-message-follow-up-container",children:[b.jsx("img",{className:"chat-prompt-assistant-message-follow-up-container-avater",src:"./imoje-charecters/raven-prof.png",alt:"Avatar"}),b.jsxs("div",{className:"chat-prompt-assistant-message-follow-up-text-container",children:[b.jsxs("div",{className:"chat-prompt-assistant-message-follow-up-content",children:[b.jsxs("h3",{className:"chat-prompt-assistant-message-follow-up-container-header-text",children:[b.jsx("strong",{children:"Rigorous Raven"})," says:"]}),b.jsxs("div",{className:"chat-prompt-assistant-message-follow-up-text-box",children:[b.jsx("div",{className:"chat-prompt-assistant-message-follow-up-text-box-triangle"}),b.jsx("pre",{className:"chat-prompt-assistant-message-follow-up-assistant-text",children:t})]})]}),e.chatScreenStatus!=="followUpAskQuestion"&&b.jsx("div",{className:"follow-up-button-section",children:b.jsxs("div",{className:"buttons follow-up-buttons",children:[b.jsx("div",{className:"danger button-container",children:b.jsx("button",{className:"unclicked btn",children:"Report"})}),b.jsx("div",{className:"passive button-container",children:b.jsx("button",{className:"unclicked btn btn-big-x-padding",onClick:()=>n({type:"setChatScreenStatus",payload:"followUpReviewAction"}),children:"Thanks, That's all!"})}),b.jsx("div",{className:"progressive button-container",children:b.jsx("button",{className:"unclicked btn btn-big-x-padding",onClick:()=>n({type:"setChatScreenStatus",payload:"followUpAskQuestion"}),children:"Ask Follow-Up"})})]})})]})]})},j5e=()=>{const t=["What dose this do?","Teach me more!","Show an example?"],[e,n]=I.useState(""),{messages:i,dispatchMessages:r}=I.useContext(Gf),{uiData:O,dispatchUiData:o}=I.useContext(io),[a,l]=I.useState(""),[A,c]=I.useState(!1),u=async()=>{var h;c(!0);const f=i.messageList.length<=1?`Here's whole code. `+i.code:"",d={role:"user",content:[{type:"text",text:e+` `+f},{type:"image_url",image_url:{url:i==null?void 0:i.image}}]};try{const $=await Z5e(i.messageList,d);l((h=$==null?void 0:$.message)==null?void 0:h.content),r({type:"setMessage",payload:[d,$.message]}),r({type:"setTakeScreenshot",payload:!1}),o({type:"setChatScreenStatus",payload:""}),console.log($),c(!1)}catch($){console.log($),c(!1)}};return b.jsxs("div",{className:"chat-prompt-ask-followup-question-container",children:[b.jsx("div",{className:"chat-prompt-ask-followup-question-container-triangle"}),b.jsx("div",{className:"chat-prompt-ask-followup-question-text-container",children:b.jsxs("div",{children:[b.jsxs("div",{className:"chat-prompt-ask-followup-premade-question-container",children:[b.jsx("button",{className:"premade-question-scroller-action-btn",children:b.jsx("img",{src:"./images/left-arrow.svg"})}),b.jsx("div",{className:"chat-prompt-ask-followup-premade-question-list-container",children:b.jsx("div",{className:"chat-prompt-ask-followup-premade-question-list",children:t.map((f,d)=>b.jsx("div",{className:"chat-prompt-ask-followup-premade-single-question",onClick:()=>{n(f)},children:b.jsx("button",{className:"chat-prompt-ask-followup-premade-question-btn",children:f})},d))})}),b.jsx("button",{className:"premade-question-scroller-action-btn",children:b.jsx("img",{src:"./images/right-arrow.svg"})})]}),b.jsx("div",{className:"chat-prompt-ask-followup-question-container-input-text-container",children:b.jsx("input",{className:"chat-prompt-ask-followup-question-container-text-input",type:"text",value:e,onChange:f=>n(f.target.value)})}),b.jsx("div",{className:"buttons ask-followup-action-container",children:b.jsx("div",{className:"progressive",children:b.jsx("button",{className:"unclicked ask-followup-button",onClick:u,children:"Ask Regorous Raven"})})})]})})]})},I5e=()=>{const{uiData:t,dispatchUiData:e}=I.useContext(io),n=()=>{e({type:"setScreen",payload:"editor"})},i=()=>{e({type:"setScreen",payload:"editor"})};return b.jsx("div",{className:"chat-prompt-user-review-action-container",children:b.jsx("div",{className:"chat-prompt-user-review-action-text-container",children:b.jsxs("div",{children:[b.jsx("div",{className:"chat-prompt-user-review-action-container-header-text-container",children:b.jsxs("h3",{className:"chat-prompt-user-review-action-container-header-text",children:[b.jsx("strong",{children:"Thank you for asking for help!"})," Did you find this useful?"]})}),b.jsxs("div",{className:"chat-prompt-user-review-action-container-buttons",children:[b.jsx("button",{onClick:i,children:b.jsx("img",{src:"./imoje-charecters/un-like-image.png"})}),b.jsx("button",{onClick:n,children:b.jsx("img",{src:"./imoje-charecters/like-image.png"})})]})]})})})},D5e=({image:t})=>b.jsx("div",{className:"chat-prompt-user-screenshot-container",children:b.jsx("div",{className:"chat-prompt-user-screenshot-image",children:b.jsx("img",{src:t,alt:"screenshot"})})}),H5e=()=>b.jsxs("div",{children:[b.jsx(O7,{}),b.jsx(z5e,{})]}),N5e=()=>{const{uiData:t,dispatchUiData:e}=I.useContext(io);return b.jsxs("div",{children:[b.jsx("div",{style:{display:`${t.screen==="editor"?"block":"none"}`},children:b.jsx(o5e,{})}),b.jsx("div",{style:{display:`${t.screen==="chat"?"block":"none"}`},children:b.jsx(H5e,{})})]})},L5e=ae.createContext(),M5e=({children:t})=>{function e(r,O){switch(O.type){case"login":return{...r,userInfo:O.userInfo};case"checkLogin":{const o=localStorage.getItem("auth-user");if(o)return{...r,userInfo:JSON.parse(o)}}case"logout":return localStorage.removeItem("auth-user"),{...r,userInfo:null};default:return r}}const[n,i]=ae.useReducer(e,{userInfo:null});return b.jsx(L5e.Provider,{value:{userData:n,dispatchUserData:i},children:t})},K5e=({children:t})=>b.jsx(M5e,{children:b.jsx(pve,{children:b.jsx(x6,{children:t})})});function J5e(){return b.jsx("div",{className:"overflow-x-hidden max-h-max pb-2",children:b.jsx(K5e,{children:b.jsx("div",{className:"flex justify-center",children:b.jsxs("div",{className:"annotation max-w-[750px]",children:[b.jsx(N5e,{}),b.jsx(Kb,{})]})})})})}Oy.createRoot(document.getElementById("r2r_lm_final_commitment")).render(b.jsx(I.StrictMode,{children:b.jsx(J5e,{})}));export{gs as C,K as E,Ye as L,Ce as a,zn as b,Re as c,or as d,Pt as f,Bt as i,Ze as s,s as t}; function __vite__mapDeps(indexes) {