Created
December 4, 2022 11:47
-
-
Save pdparchitect/f25f4dc631f033402d3f8f9ad6866a9b to your computer and use it in GitHub Desktop.
ChatGPT Hidden Code Assistent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([ | |
[894], { | |
11276: function(e, t, r) { | |
var n, o, a, i, s, c, l, d, p, u; | |
r.d(t, { | |
Jq: function() { | |
return s | |
}, | |
Os: function() { | |
return a | |
}, | |
u9: function() { | |
return o | |
}, | |
uU: function() { | |
return i | |
} | |
}), (c = n || (n = {})).Default = "default", c.Dark = "dark", (l = o || (o = {})).Retrieval = "retrieval", (d = a || (a = {})).Next = "next", d.Variant = "variant", d.Continue = "continue", (p = i || (i = {})).Unknown = "unknown", p.User = "user", p.Assistant = "assistant", p.System = "system", p.Critic = "critic", p.Tool = "tool", (u = s || (s = {})).Root = "root", u.Prompt = "prompt", u.Completion = "completion", u.EditedPrompt = "edited_prompt", u.EditedCompletion = "edited_completion" | |
}, | |
89017: function(e, t, r) { | |
r.d(t, { | |
Y: function() { | |
return f | |
}, | |
k: function() { | |
return u | |
} | |
}); | |
var n = r(89925), | |
o = r(19841), | |
a = r(46495), | |
i = r.n(a), | |
s = r(1454), | |
c = r(61079), | |
l = r(35250), | |
d = n.ZP.div.withConfig({ | |
displayName: "Avatar", | |
componentId: "sc-1yo2jqv-0" | |
})({ | |
position: "relative", | |
display: "flex", | |
height: "30px", | |
width: "30px", | |
alignItems: "center", | |
justifyContent: "center", | |
borderRadius: "0.125rem", | |
padding: "0.25rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))" | |
}), | |
p = n.ZP.span.withConfig({ | |
displayName: "Avatar__Notice", | |
componentId: "sc-1yo2jqv-1" | |
})(function(e) { | |
var t = e.type; | |
return ["warning" === t && { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(224 108 43 / var(--tw-bg-opacity))", | |
"--tw-text-opacity": "1", | |
color: "rgb(0 0 0 / var(--tw-text-opacity))" | |
}, "danger" === t && { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(239 68 68 / var(--tw-bg-opacity))", | |
"--tw-text-opacity": "1", | |
color: "rgb(153 27 27 / var(--tw-text-opacity))" | |
}, { | |
position: "absolute", | |
right: "0px", | |
top: "20px", | |
marginRight: "-0.5rem", | |
display: "flex", | |
height: "1rem", | |
width: "1rem", | |
alignItems: "center", | |
justifyContent: "center", | |
borderRadius: "9999px", | |
borderWidth: "1px", | |
"--tw-border-opacity": "1", | |
borderColor: "rgb(255 255 255 / var(--tw-border-opacity))", | |
fontSize: "10px", | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))" | |
}] | |
}), | |
u = function(e) { | |
var t = e.iconName, | |
r = e.background, | |
n = e.notice, | |
o = "globe" === t ? s.RsK : "terminal" === t ? s.cDN : c.nI; | |
return (0, l.jsxs)(d, { | |
style: { | |
backgroundColor: r | |
}, | |
children: [(0, l.jsx)(c.ZP, { | |
icon: o, | |
size: "medium" | |
}), n && (0, l.jsx)(p, { | |
type: n, | |
children: "!" | |
})] | |
}) | |
}, | |
m = n.ZP.div.withConfig({ | |
displayName: "Avatar__Initials", | |
componentId: "sc-1yo2jqv-2" | |
})({ | |
position: "relative", | |
display: "flex", | |
alignItems: "center", | |
justifyContent: "center", | |
borderRadius: "0.125rem", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(84 54 218 / var(--tw-bg-opacity))", | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))" | |
}), | |
h = n.ZP.div.withConfig({ | |
displayName: "Avatar__Wrapper", | |
componentId: "sc-1yo2jqv-3" | |
})({ | |
position: "relative", | |
display: "flex" | |
}), | |
f = function(e) { | |
var t = e.user, | |
r = e.size, | |
n = void 0 === r ? "small" : r, | |
a = e.notice; | |
if (null != t && t.picture) return (0, l.jsxs)(h, { | |
children: [(0, l.jsx)(i(), { | |
src: t.picture, | |
alt: t.name, | |
width: "small" === n ? 30 : 38, | |
height: "small" === n ? 30 : 38, | |
className: "rounded-sm" | |
}), a && (0, l.jsx)(p, { | |
type: a, | |
children: "!" | |
})] | |
}); | |
var s = ((null == t ? void 0 : t.name) || "").split(" ").map(function(e) { | |
return e[0] | |
}).join(""); | |
return (0, l.jsxs)(m, { | |
className: (0, o.Z)("small" === n ? "text-xs w-8 h-8" : "text-lg w-10 h-10"), | |
children: [s, a && (0, l.jsx)(p, { | |
type: a, | |
children: "!" | |
})] | |
}) | |
} | |
}, | |
55711: function(e, t, r) { | |
var n = r(50809), | |
o = r(89925), | |
a = r(19841), | |
i = r(70079), | |
s = r(61079), | |
c = r(35250); | |
function l(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function d(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? l(Object(r), !0).forEach(function(t) { | |
(0, n.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : l(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
t.Z = i.forwardRef(function(e, t) { | |
var r = e.name, | |
n = e.placeholder, | |
o = e.type, | |
l = e.displayName, | |
u = e.onChange, | |
m = e.onBlur, | |
h = e.value, | |
f = e.saveOnBlur, | |
g = e.icon, | |
w = e.onInputIconClick, | |
b = e.className, | |
v = (0, i.useState)(h), | |
x = v[0], | |
y = v[1], | |
j = (0, i.useCallback)(function(e) { | |
null == m || m(e), f && y(e.target.value) | |
}, [m, f]), | |
k = (0, i.useCallback)(function(e) { | |
null == u || u(e), f && y(e.target.value) | |
}, [u, f]); | |
(0, i.useEffect)(function() { | |
y(h) | |
}, [h]); | |
var C = d(d({}, f ? {} : { | |
value: h | |
}), f ? { | |
value: x | |
} : {}); | |
return (0, c.jsxs)("div", { | |
className: (0, a.Z)("border border-gray-300 rounded-md px-3 py-2 shadow-sm focus-within:ring-1 focus-within:ring-indigo-600 focus-within:border-indigo-600", b), | |
children: [(0, c.jsx)("label", { | |
htmlFor: r, | |
className: "block text-xs font-medium text-gray-900", | |
children: l | |
}), (0, c.jsxs)("div", { | |
className: (0, a.Z)(l && "mt-1", "relative"), | |
children: [(0, c.jsx)("input", d({ | |
ref: t, | |
type: o, | |
name: r, | |
id: r, | |
className: (0, a.Z)("block w-full border-0 p-0 text-gray-900 placeholder-gray-500 focus:ring-0 sm:text-sm outline-none", g && "pr-6"), | |
placeholder: n, | |
onBlur: j, | |
onChange: k | |
}, C)), g && (0, c.jsx)(p, { | |
onClick: w, | |
children: (0, c.jsx)(s.ZP, { | |
icon: g | |
}) | |
})] | |
})] | |
}) | |
}); | |
var p = o.ZP.button.withConfig({ | |
displayName: "Input__InputButton", | |
componentId: "sc-1asbucg-0" | |
})({ | |
position: "absolute", | |
right: "0px", | |
top: "50%", | |
"--tw-translate-y": "-50%", | |
transform: "translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))" | |
}) | |
}, | |
30867: function(e, t, r) { | |
r.d(t, { | |
Jw: function() { | |
return m | |
}, | |
Vq: function() { | |
return u | |
}, | |
ZP: function() { | |
return h | |
} | |
}); | |
var n = r(89925), | |
o = r(57976), | |
a = r(1771), | |
i = r(19841), | |
s = r(70079), | |
c = r(50970), | |
l = r(55711), | |
d = r(65045), | |
p = r(35250); | |
function u(e) { | |
return e && (e.startsWith("http") || "custom" === e) | |
} | |
function m(e) { | |
return e && !u(e) | |
} | |
function h(e) { | |
var t = e.children, | |
r = (e.maxTokens, e.temperature), | |
n = e.endOfPromptToken, | |
m = e.onRestoreDefaults, | |
h = e.promptPrefix, | |
v = e.onChangePromptPrefix, | |
x = e.modelBackend, | |
y = e.onChangeSetting, | |
j = e.position, | |
k = e.settings, | |
C = e.availableModels, | |
P = (0, d.ZP)(C).modelBackend, | |
O = u(x) ? "custom" : P, | |
T = (0, s.useState)(u(O)), | |
S = T[0], | |
N = T[1], | |
I = (0, s.useCallback)(function(e) { | |
v(e.target.value) | |
}, [v]), | |
Z = (0, s.useCallback)(function(e) { | |
var t = e.target.value; | |
u(t) ? (y(d.G3.Model, "custom" !== t ? t : "http://custom:8000"), N(!0)) : (N(!1), y(d.G3.Model, e.target.value)) | |
}, [y]), | |
_ = (0, s.useCallback)(function(e) { | |
y(d.G3.EopToken, e.target.value) | |
}, [y]); | |
(0, s.useCallback)(function(e) { | |
y(d.G3.MaxTokens, e.target.value) | |
}, [y]); | |
var E = (0, s.useCallback)(function(e) { | |
y(d.G3.Temperature, e.target.value) | |
}, [y]); | |
return (0, p.jsxs)(o.J, { | |
className: "relative", | |
children: [t, (0, p.jsx)(a.u, { | |
as: s.Fragment, | |
enter: "transition ease-out duration-200", | |
enterFrom: (0, i.Z)("opacity-0", "top-right" === j ? "translate-x-1" : "translate-y-1"), | |
enterTo: (0, i.Z)("opacity-100", "top-right" === j ? "translate-x-0" : "translate-y-0"), | |
leave: "transition ease-in duration-150", | |
leaveFrom: (0, i.Z)("opacity-100", "top-right" === j ? "translate-x-0" : "translate-y-0"), | |
leaveTo: (0, i.Z)("opacity-0", "top-right" === j ? "translate-x-1" : "translate-y-1"), | |
children: (0, p.jsx)(o.J.Panel, { | |
className: (0, i.Z)("absolute z-20 mt-3 px-2 w-screen max-w-xs sm:px-0", "bottom-center" === j && "right-0 top-6", "bottom-right" === j && "left-2 top-8", "top-right" === j && "left-full ml-6 top-1/2 -translate-y-full"), | |
children: (0, p.jsx)("div", { | |
className: "rounded-lg shadow-lg ring-1 ring-black dark:ring-gray-600 ring-opacity-5 overflow-hidden text-sm text-left", | |
children: (0, p.jsxs)("div", { | |
className: "relative grid gap-6 bg-white dark:bg-gray-800 px-2 py-1 sm:gap-4 sm:p-4", | |
children: [k.has(d.G3.Model) && C.length > 0 && (0, p.jsx)("select", { | |
name: "model", | |
className: "form-select rounded-md border-gray-300 text-sm dark:text-gray-900", | |
onChange: Z, | |
value: O, | |
children: C.map(function(e) { | |
return (0, p.jsx)("option", { | |
value: e.id, | |
children: e.id | |
}, e.id) | |
}) | |
}), S && (0, p.jsx)(l.Z, { | |
displayName: "Model Endpoint", | |
name: "modelBackend", | |
onBlur: Z, | |
value: x, | |
saveOnBlur: !0 | |
}), k.has(d.G3.Context) && (0, p.jsx)(f, { | |
value: h, | |
onChange: I, | |
rows: 4, | |
placeholder: "Add additional context..." | |
}), k.has(d.G3.EopToken) && (0, p.jsx)(l.Z, { | |
displayName: "End of prompt token", | |
name: "endOfPromptToken", | |
onBlur: _, | |
value: n, | |
saveOnBlur: !0 | |
}), k.has(d.G3.Temperature) && (0, p.jsxs)("div", { | |
className: "border border-gray-300 rounded-md px-3 py-2 shadow-sm focus-within:ring-1 focus-within:ring-indigo-600 focus-within:border-indigo-600", | |
children: [(0, p.jsx)("label", { | |
htmlFor: "temperature", | |
className: "block text-xs font-medium text-gray-800", | |
children: "Temperature" | |
}), (0, p.jsxs)("div", { | |
className: "mt-1", | |
children: [(0, p.jsx)(g, { | |
type: "number", | |
name: "temperature", | |
id: "temperature", | |
onChange: E, | |
value: r, | |
className: "form-input" | |
}), (0, p.jsx)(w, { | |
name: "temperature", | |
type: "range", | |
min: "0", | |
max: "1", | |
value: r, | |
className: "range w-full", | |
step: "0.05", | |
onChange: E | |
})] | |
})] | |
}), (0, p.jsx)(b, { | |
children: (0, p.jsx)(c.z, { | |
as: "button", | |
color: "neutral", | |
onClick: m, | |
children: "Restore defaults" | |
}) | |
})] | |
}) | |
}) | |
}) | |
})] | |
}) | |
} | |
var f = n.ZP.textarea.withConfig({ | |
displayName: "ModelSettings__Textarea", | |
componentId: "sc-1r79cjr-0" | |
})({ | |
appearance: "none", | |
backgroundColor: "#fff", | |
borderColor: "rgb(197 197 210 / var(--tw-border-opacity))", | |
borderWidth: "1px", | |
borderRadius: "0.375rem", | |
paddingTop: "0.5rem", | |
paddingRight: "0.75rem", | |
paddingBottom: "0.5rem", | |
paddingLeft: "0.75rem", | |
fontSize: "1rem", | |
lineHeight: "1.5rem", | |
"--tw-shadow": "0 0 #0000", | |
":focus": { | |
outline: "2px solid transparent", | |
outlineOffset: "2px", | |
"--tw-ring-inset": "var(--tw-empty,/*!*/ /*!*/)", | |
"--tw-ring-offset-width": "0px", | |
"--tw-ring-offset-color": "#fff", | |
"--tw-ring-color": "rgb(79 70 229 / var(--tw-ring-opacity))", | |
"--tw-ring-offset-shadow": "var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)", | |
"--tw-ring-shadow": "var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)", | |
boxShadow: "var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)", | |
borderColor: "rgb(79 70 229 / var(--tw-border-opacity))", | |
"--tw-border-opacity": "1", | |
"--tw-ring-opacity": "1" | |
}, | |
"::placeholder": { | |
color: "#8e8ea0", | |
opacity: "1" | |
}, | |
display: "block", | |
width: "100%", | |
"--tw-border-opacity": "1", | |
"@media (min-width: 640px)": { | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem" | |
} | |
}), | |
g = n.ZP.input.withConfig({ | |
displayName: "ModelSettings__TokenInput", | |
componentId: "sc-1r79cjr-1" | |
})({ | |
display: "block", | |
width: "100%", | |
borderWidth: "0px", | |
borderStyle: "none", | |
padding: "0px", | |
"--tw-text-opacity": "1", | |
color: "rgb(32 33 35 / var(--tw-text-opacity))", | |
"::placeholder": { | |
"--tw-placeholder-opacity": "1", | |
color: "rgb(142 142 160 / var(--tw-placeholder-opacity))" | |
}, | |
outline: "2px solid transparent", | |
outlineOffset: "2px", | |
":focus": { | |
"--tw-ring-offset-shadow": "var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)", | |
"--tw-ring-shadow": "var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color)", | |
boxShadow: "var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)" | |
} | |
}), | |
w = n.ZP.input.withConfig({ | |
displayName: "ModelSettings__RangeInput", | |
componentId: "sc-1r79cjr-2" | |
})({ | |
marginTop: "0.25rem", | |
borderWidth: "0px", | |
outline: "2px solid transparent", | |
outlineOffset: "2px" | |
}), | |
b = n.ZP.div.withConfig({ | |
displayName: "ModelSettings__DefaultsButtonPosition", | |
componentId: "sc-1r79cjr-3" | |
})({ | |
textAlign: "right" | |
}) | |
}, | |
39010: function(e, t, r) { | |
r.d(t, { | |
Z: function() { | |
return nd | |
} | |
}); | |
var n, o, a, i = r(50809), | |
s = r(95590), | |
c = r(84559), | |
l = r(50114), | |
d = r(42772), | |
p = r.n(d), | |
u = r(89925), | |
m = r(57976), | |
h = r(6128), | |
f = r(19841), | |
g = r(91530), | |
w = r.n(g), | |
b = r(91842), | |
v = r.n(b), | |
x = r(64138), | |
y = r(11253), | |
j = r.n(y), | |
k = r(70079), | |
C = r(5170), | |
P = r(1454), | |
O = r(66740), | |
T = r(2656), | |
S = r(11276), | |
N = r(75716), | |
I = r(57076), | |
Z = "{{Question}}", | |
_ = 'You are a brilliant and helpful coding assistant designed to help users with any programming-related questions or problems they may have.\n\nAs a programming expert, you have extensive knowledge about a variety of topics related to programming, including programming languages, syntax, debugging techniques, software design principles, code optimization, documentation, and more. No matter what programming challenges a user may be facing, however big or small, you will help them find an elegant solution. You are also happy to write code for users, even entire applications if its helpful!\n\nPlease respond in markdown format, making appropriate use of headers, numbered lists, tables, tagged code blocks, etc as needed. Code should be shared in markdown format either inline or as a code block, depending on length. Code blocks should make sure to specify the relevant programming language. Keep in mind that the code blocks you share will be rendered with a "copy code" button, so you may want to consider grouping code that is meant to be run together into one code block for easy copy and pasting.\n\nAdditionally, please note that you are not equipped to answer questions that fall outside of the realm of programming or programming-adjacent topics, so if a user asks you a totally unrelated question, kindly let them know that you are unable to assist them with that particular query and the reason why. Feel free to crack a joke about it, if appropriate. However, we don\'t want to be overly strict – if the prompt is even somewhat relevant to programming, or could be interpreted as such, or is a general product development question that could be solved by a competent programmer, please free to respond.'; | |
function E(e) { | |
return { | |
processPrefix: function(t) { | |
return "<|endoftext|>".concat(t ? "".concat(t).concat(e) : "") | |
}, | |
turnSeparator: "", | |
preProcessInput: function(t) { | |
return "".concat(t).concat(e) | |
}, | |
promptSuffix: "", | |
preProcessRetrieval: function(e) { | |
var t; | |
return "---\n\n".concat(e, "\n\n---\n\n") | |
} | |
} | |
} | |
function D(e) { | |
return { | |
processPrefix: function(t) { | |
var r, n, o, a; | |
return "quality: high\n\n[System]\nAssistant is a large language model trained by OpenAI.\nKnowledge cutoff: 2021-09\nCurrent date: ".concat((n = (r = new Date(Date.now())).getFullYear(), o = r.getMonth() + 1, a = r.getDate(), o < 10 && (o = "0" + o), a < 10 && (a = "0" + a), "".concat(n, "-").concat(o, "-").concat(a)), "\nBrowsing: disabled").concat(e, "\n\n[System]\n").concat(t).concat(e) | |
}, | |
turnSeparator: "\n\n", | |
preProcessInput: function(t, r) { | |
return "[".concat(r, "]\n").concat(t).concat(e) | |
}, | |
promptSuffix: "[Assistant]\n", | |
preProcessRetrieval: function(t) { | |
return "\n\n[System]\n".concat(t).concat(e) | |
} | |
} | |
} | |
function B(e, t) { | |
var r; | |
return null != t && null !== (r = t.public_data) && void 0 !== r && r.length ? t.public_data.map(function(t) { | |
var r = JSON.parse(t[0].contents); | |
return e("Sample question:\n".concat(r.question, "Answer:\n").concat(r.answer)) | |
}).join("") : "" | |
} | |
var R = r(56006), | |
A = r(84251), | |
q = r.n(A), | |
M = r(8844); | |
function z(e) { | |
var t = function(e, t) { | |
if ("object" != typeof e || null === e) return e; | |
var r = e[Symbol.toPrimitive]; | |
if (void 0 !== r) { | |
var n = r.call(e, t || "default"); | |
if ("object" != typeof n) return n; | |
throw TypeError("@@toPrimitive must return a primitive value.") | |
} | |
return ("string" === t ? String : Number)(e) | |
}(e, "string"); | |
return "symbol" == typeof t ? t : String(t) | |
} | |
function F(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function W(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? F(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : F(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var L = (n = {}, (0, i.Z)(n, S.Jq.Root, S.uU.Unknown), (0, i.Z)(n, S.Jq.Prompt, S.uU.User), (0, i.Z)(n, S.Jq.Completion, S.uU.Assistant), (0, i.Z)(n, S.Jq.EditedPrompt, S.uU.User), (0, i.Z)(n, S.Jq.EditedCompletion, S.uU.Assistant), n), | |
H = function(e, t) { | |
for (var r = [], n = e[t]; r.push(n), "root" !== n.id;) n = e[n.parentId]; | |
return r.reverse() | |
}, | |
U = function(e, t) { | |
for (var r = e[t];;) { | |
if (0 === r.children.size) return r; | |
r = e[r.children.values().next().value] | |
} | |
}; | |
function J(e, t, r, n, o) { | |
return W(W({ | |
id: e, | |
createdAt: Date.now(), | |
children: new Set, | |
parentId: r, | |
type: n | |
}, o ? { | |
metadata: o | |
} : {}), {}, { | |
message: { | |
id: (0, M.Z)(), | |
role: L[n], | |
content: { | |
content_type: "text", | |
parts: [t] | |
} | |
} | |
}) | |
} | |
function G(e, t, r) { | |
return e[t] ? q()(e, (0, i.Z)({ | |
$merge: (0, i.Z)({}, r.id, r) | |
}, t, { | |
children: { | |
$add: [r.id] | |
} | |
})) : (0, i.Z)({}, r.id, r) | |
} | |
function V(e, t, r) { | |
return q()(e, (0, i.Z)({}, t, r)) | |
} | |
function Y() { | |
return { | |
root: { | |
id: "root", | |
createdAt: Date.now(), | |
children: new Set, | |
parentId: "", | |
type: S.Jq.Root, | |
message: { | |
id: (0, M.Z)(), | |
role: L[S.Jq.Root], | |
content: { | |
content_type: "text", | |
parts: [] | |
} | |
} | |
} | |
} | |
} | |
function X(e) { | |
var t = {}; | |
return Object.entries(e).forEach(function(e) { | |
var r = (0, R.Z)(e, 2), | |
n = r[0], | |
o = r[1]; | |
t[n] = W(W({}, o), {}, { | |
children: Array.from(o.children) | |
}) | |
}), t | |
} | |
function K(e) { | |
return Q(e.message) | |
} | |
function Q(e) { | |
return e.content.parts.join("") | |
} | |
function $(e, t) { | |
return H(e, t).reduce(function(e, t) { | |
return t.type === S.Jq.Root ? e : e + K(t) + "\n\n" | |
}, "") | |
} | |
function ee(e, t, r) { | |
return H(e, t).slice(-r).reduce(function(e, t) { | |
return t.type === S.Jq.Root ? e : e + K(t) + "\n\n" | |
}, "") | |
} | |
var et = r(35250); | |
function er(e) { | |
var t = e.id, | |
r = e.label; | |
return e.checked, e.onChange, (0, et.jsxs)("div", { | |
className: "form-check", | |
children: [(0, et.jsx)("input", { | |
className: "form-check-input appearance-none h-4 w-4 border border-gray-300 rounded-sm bg-white checked:bg-blue-600 checked:border-blue-600 focus:outline-none transition duration-200 mt-1 align-top bg-no-repeat bg-center bg-contain float-left mr-2 cursor-pointer", | |
type: "checkbox", | |
value: "", | |
id: t | |
}), (0, et.jsx)("label", { | |
className: "form-check-label inline-block text-gray-800 dark:text-gray-100", | |
htmlFor: t, | |
children: r | |
})] | |
}) | |
} | |
var en = r(61079), | |
eo = r(28864), | |
ea = r(30867), | |
ei = r(1771), | |
es = r(55260), | |
ec = r(81088), | |
el = r(12976), | |
ed = r.n(el), | |
ep = r(7137), | |
eu = r(37918), | |
em = r(86986); | |
function eh(e) { | |
var t = e.onNewThread, | |
r = e.onOpenDebugPanel, | |
n = e.pages, | |
o = e.children; | |
return (0, et.jsx)(et.Fragment, { | |
children: (0, et.jsx)(eg, { | |
onNewThread: t, | |
onOpenDebugPanel: r, | |
pages: n, | |
children: o | |
}) | |
}) | |
} | |
var ef = u.ZP.a.withConfig({ | |
displayName: "Navigation__NavMenuItem", | |
componentId: "sc-rtsy24-0" | |
})({ | |
display: "flex", | |
cursor: "pointer", | |
alignItems: "center", | |
gap: "1rem", | |
borderRadius: "0.375rem", | |
paddingTop: "0.75rem", | |
paddingBottom: "0.75rem", | |
paddingLeft: "0.75rem", | |
paddingRight: "0.75rem", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))", | |
transitionProperty: "color, background-color, border-color, text-decoration-color, fill, stroke", | |
transitionTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)", | |
transitionDuration: "200ms", | |
":hover": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(52 53 65 / var(--tw-bg-opacity))" | |
} | |
}); | |
function eg(e) { | |
var t, r, n = e.onNewThread, | |
o = e.onOpenDebugPanel, | |
a = e.pages, | |
i = e.children, | |
s = (0, ec.F)(), | |
c = s.theme, | |
l = s.setTheme, | |
d = (r = (0, em.useSession)().data, (0, k.useMemo)(function() { | |
var e, t; | |
return new Set(null !== (e = null == r ? void 0 : null === (t = r.user) || void 0 === t ? void 0 : t.features) && void 0 !== e ? e : []) | |
}, [null == r ? void 0 : null === (t = r.user) || void 0 === t ? void 0 : t.features])), | |
p = (0, x.useRouter)().pathname, | |
u = (0, k.useContext)(I.y).id, | |
m = a.filter(function(e) { | |
return p.indexOf(e.href) | |
}); | |
return (0, et.jsx)("div", { | |
className: "flex flex-1 w-full items-start border-white/20", | |
children: (0, et.jsxs)("nav", { | |
className: "flex-1 space-y-1 m-2 pb-2", | |
children: [(0, et.jsxs)(ef, { | |
onClick: n, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.Qxo | |
}), "Reset Thread"] | |
}), d.has("debug") && (0, et.jsxs)(ef, { | |
onClick: function() { | |
return o(!0) | |
}, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.cDN | |
}), "Debug"] | |
}), (0, et.jsxs)(ef, { | |
onClick: function() { | |
return l("dark" === c ? "light" : "dark") | |
}, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: "dark" === c ? P.kXG : P.wOW | |
}), "dark" === c ? "Light" : "Dark", " Mode"] | |
}), i, "chat" === u && (0, et.jsxs)(ef, { | |
href: "https://discord.gg/openai", | |
target: "_blank", | |
children: [(0, et.jsx)(en.ZP, { | |
icon: ep.j2d | |
}), "OpenAI Discord"] | |
}), "chat" === u && (0, et.jsxs)(ef, { | |
href: "https://openai.com/blog/chatgpt/", | |
target: "_blank", | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.AlO | |
}), "Learn More"] | |
}), m.map(function(e) { | |
return e.href.startsWith("http") ? (0, et.jsxs)(ef, { | |
href: e.href, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: "terminal" === e.theme.icon ? P.cDN : P.RsK | |
}), e.name] | |
}, "Page-".concat(e.name)) : (0, et.jsx)(ed(), { | |
href: e.href, | |
children: (0, et.jsxs)(ef, { | |
children: [(0, et.jsx)(en.ZP, { | |
icon: "terminal" === e.theme.icon ? P.cDN : P.RsK | |
}), e.name] | |
}) | |
}, "Page-".concat(e.name)) | |
}), (0, et.jsxs)(ef, { | |
onClick: function() { | |
return (0, eu.w)() | |
}, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.xqh | |
}), "Log out"] | |
})] | |
}) | |
}) | |
} | |
var ew = function(e) { | |
var t = e.onNewThread, | |
r = e.onOpenDebugPanel, | |
n = e.pages, | |
o = e.children; | |
return (0, et.jsx)("div", { | |
className: "hidden md:fixed md:inset-y-0 md:flex md:w-52 md:flex-col bg-gray-900", | |
children: (0, et.jsx)("div", { | |
className: "flex min-h-0 h-full flex-col ", | |
children: (0, et.jsx)(eh, { | |
onNewThread: t, | |
onOpenDebugPanel: r, | |
pages: n, | |
children: o | |
}) | |
}) | |
}) | |
}, | |
eb = function(e) { | |
var t = e.onSidebarOpen, | |
r = e.sidebarOpen, | |
n = e.onNewThread, | |
o = e.onOpenDebugPanel, | |
a = e.pages, | |
i = e.children; | |
return (0, et.jsx)(ei.u.Root, { | |
show: r, | |
as: k.Fragment, | |
children: (0, et.jsxs)(es.V, { | |
as: "div", | |
className: "relative z-40 md:hidden", | |
onClose: t, | |
children: [(0, et.jsx)(ei.u.Child, { | |
as: k.Fragment, | |
enter: "transition-opacity ease-linear duration-300", | |
enterFrom: "opacity-0", | |
enterTo: "opacity-100", | |
leave: "transition-opacity ease-linear duration-300", | |
leaveFrom: "opacity-100", | |
leaveTo: "opacity-0", | |
children: (0, et.jsx)("div", { | |
className: "fixed inset-0 bg-gray-600 bg-opacity-75" | |
}) | |
}), (0, et.jsxs)("div", { | |
className: "fixed inset-0 z-40 flex", | |
children: [(0, et.jsx)(ei.u.Child, { | |
as: k.Fragment, | |
enter: "transition ease-in-out duration-300 transform", | |
enterFrom: "-translate-x-full", | |
enterTo: "translate-x-0", | |
leave: "transition ease-in-out duration-300 transform", | |
leaveFrom: "translate-x-0", | |
leaveTo: "-translate-x-full", | |
children: (0, et.jsxs)(es.V.Panel, { | |
className: "relative flex w-full max-w-xs flex-1 flex-col bg-gray-800", | |
children: [(0, et.jsx)(ei.u.Child, { | |
as: k.Fragment, | |
enter: "ease-in-out duration-300", | |
enterFrom: "opacity-0", | |
enterTo: "opacity-100", | |
leave: "ease-in-out duration-300", | |
leaveFrom: "opacity-100", | |
leaveTo: "opacity-0", | |
children: (0, et.jsx)("div", { | |
className: "absolute top-0 right-0 -mr-12 pt-2", | |
children: (0, et.jsxs)("button", { | |
type: "button", | |
className: "ml-1 flex h-10 w-10 items-center justify-center focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white", | |
onClick: function() { | |
return t(!1) | |
}, | |
children: [(0, et.jsx)("span", { | |
className: "sr-only", | |
children: "Close sidebar" | |
}), (0, et.jsx)(en.ZP, { | |
icon: P.q5L, | |
size: "medium", | |
className: "text-white", | |
"aria-hidden": "true" | |
})] | |
}) | |
}) | |
}), (0, et.jsx)(eh, { | |
onNewThread: n, | |
onOpenDebugPanel: o, | |
pages: a, | |
children: i | |
})] | |
}) | |
}), (0, et.jsx)("div", { | |
className: "w-14 flex-shrink-0" | |
})] | |
})] | |
}) | |
}) | |
}, | |
ev = function(e) { | |
var t = e.onSidebarOpen; | |
return (0, et.jsx)("div", { | |
className: "sticky top-0 z-10 bg-white border-b dark:bg-gray-800 dark:text-gray-100 dark:border-gray-600 text-gray-600 pl-1 pt-1 sm:pl-3 sm:pt-3 md:hidden", | |
children: (0, et.jsxs)("button", { | |
type: "button", | |
className: "-ml-0.5 -mt-0.5 inline-flex h-10 w-10 items-center justify-center rounded-md hover:text-gray-900 dark:hover:text-white focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white", | |
onClick: function() { | |
return t(!0) | |
}, | |
children: [(0, et.jsx)("span", { | |
className: "sr-only", | |
children: "Open sidebar" | |
}), (0, et.jsx)(en.ZP, { | |
icon: P.cur, | |
"aria-hidden": "true", | |
size: "medium" | |
})] | |
}) | |
}) | |
}, | |
ex = r(13002); | |
function ey(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function ej(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? ey(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ey(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var ek = function(e) { | |
var t = e.urls, | |
r = e.onRemoveUrl, | |
n = e.clickable, | |
o = e.className; | |
return 0 === t.size ? null : (0, et.jsx)(eC, { | |
className: o, | |
children: Array.from(t).map(function(e) { | |
return (0, et.jsxs)(eP, { | |
children: [(0, et.jsx)(P.XKb, {}), (0, et.jsxs)(eO, ej(ej({}, n ? { | |
href: e, | |
target: "_blank", | |
disabled: !1 | |
} : { | |
disabled: !0 | |
}), {}, { | |
children: [new URL(e).hostname, n && (0, et.jsx)(P.AlO, {})] | |
})), r && (0, et.jsx)(eT, { | |
onClick: function() { | |
return r(e) | |
}, | |
children: (0, et.jsx)(P.q5L, {}) | |
})] | |
}, e) | |
}) | |
}) | |
}, | |
eC = u.ZP.div.withConfig({ | |
displayName: "ArtifactTags__Urls", | |
componentId: "sc-1b3jfvk-0" | |
})({ | |
marginBottom: "1rem", | |
display: "flex", | |
flexDirection: "row", | |
gap: "0.5rem" | |
}), | |
eP = u.ZP.div.withConfig({ | |
displayName: "ArtifactTags__StyledUrl", | |
componentId: "sc-1b3jfvk-1" | |
})({ | |
display: "flex", | |
flexDirection: "row", | |
alignItems: "center", | |
gap: "0.25rem", | |
borderRadius: "0.375rem", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(217 217 227 / var(--tw-bg-opacity))", | |
paddingLeft: "0.5rem", | |
paddingRight: "0.5rem", | |
paddingTop: "0.25rem", | |
paddingBottom: "0.25rem", | |
fontSize: "0.75rem", | |
lineHeight: "1rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(142 142 160 / var(--tw-text-opacity))" | |
}), | |
eO = u.ZP.a.withConfig({ | |
displayName: "ArtifactTags__ExpandButton", | |
componentId: "sc-1b3jfvk-2" | |
})({ | |
display: "flex", | |
alignItems: "center", | |
gap: "0.25rem" | |
}), | |
eT = u.ZP.button.withConfig({ | |
displayName: "ArtifactTags__RemoveButton", | |
componentId: "sc-1b3jfvk-3" | |
})({}), | |
eS = k.memo(ek), | |
eN = r(50970), | |
eI = k.createContext({ | |
currentPalette: !1 | |
}); | |
eI.displayName = "PaletteContext"; | |
var eZ = u.ZP.button.withConfig({ | |
displayName: "shared__PromptButton", | |
componentId: "sc-l86x57-0" | |
})(function(e) { | |
var t; | |
return [{ | |
display: "flex", | |
alignItems: "center", | |
gap: "0.5rem", | |
borderRadius: "0.375rem", | |
paddingLeft: "0.5rem", | |
paddingRight: "0.5rem", | |
paddingTop: "0.25rem", | |
paddingBottom: "0.25rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))", | |
":hover": { | |
backgroundColor: "rgb(255 255 255 / 0.2)", | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))" | |
}, | |
".dark &:hover": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(236 236 241 / var(--tw-bg-opacity))" | |
} | |
}, e.active && { | |
"--tw-text-opacity": "1", | |
color: "rgb(59 130 246 / var(--tw-text-opacity))" | |
}, e.selected && { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(217 217 227 / var(--tw-bg-opacity))", | |
".dark &": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(52 53 65 / var(--tw-bg-opacity))" | |
} | |
}] | |
}); | |
function e_(e) { | |
var t = e.icon, | |
r = e.children, | |
n = e.onClick; | |
return (0, et.jsx)(eE, { | |
children: (0, et.jsxs)(eZ, { | |
selected: !1, | |
onClick: n, | |
active: !1, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: t | |
}), r] | |
}) | |
}) | |
} | |
u.ZP.div.withConfig({ | |
displayName: "shared__PromptActions", | |
componentId: "sc-l86x57-1" | |
})({ | |
marginTop: "0.25rem", | |
display: "flex", | |
minHeight: "32px", | |
alignItems: "center", | |
gap: "0.25rem", | |
fontSize: "0.75rem", | |
lineHeight: "1rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(142 142 160 / var(--tw-text-opacity))", | |
"@media (min-width: 768px)": { | |
marginTop: "0.75rem", | |
minHeight: "34px", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem" | |
} | |
}); | |
var eE = u.ZP.div.withConfig({ | |
displayName: "shared__PromptAction", | |
componentId: "sc-l86x57-2" | |
})(function() { | |
return [{ | |
display: "flex", | |
alignItems: "center", | |
gap: "0.25rem" | |
}, { | |
"::after": { | |
content: "var(--tw-content)", | |
height: "15px", | |
width: "1px", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(197 197 210 / var(--tw-bg-opacity))", | |
"--tw-content": '""' | |
} | |
}, { | |
":last-child::after": { | |
content: "var(--tw-content)", | |
backgroundColor: "transparent" | |
} | |
}] | |
}); | |
function eD(e) { | |
var t = e.active, | |
r = e.title, | |
n = e.id, | |
o = e.onClick, | |
a = e.icon, | |
i = (0, k.useContext)(eI), | |
s = i.currentPalette, | |
c = i.setCurrentPalette, | |
l = (0, k.useCallback)(function(e) { | |
e.preventDefault(), t || null == c || c(function(e) { | |
return e !== n && n | |
}), null == o || o() | |
}, [t, n, o, c]); | |
return (0, et.jsx)(eE, { | |
children: (0, et.jsxs)(eZ, { | |
selected: s === n, | |
onClick: l, | |
active: t, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: a | |
}), r] | |
}) | |
}) | |
} | |
function eB(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function eR(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? eB(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : eB(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var eA = { | |
id: "editPrompt", | |
title: "Edit prompt", | |
icon: P.SwK, | |
width: "full" | |
}, | |
eq = function(e) { | |
var t = e.onEditPromptEngineering, | |
r = e.promptEngineering, | |
n = !r.includes(Z); | |
return (0, et.jsxs)(eF, { | |
children: [n && (0, et.jsx)(eL, { | |
children: 'Missing "'.concat(Z, '" in prompt') | |
}), (0, et.jsx)(C.ZP, { | |
onChange: function(e) { | |
t(e.currentTarget.value) | |
}, | |
className: "w-full text-sm resize-none focus:ring-0 focus-visible:ring-0 m-0 bg-transparent rounded-md font-mono", | |
value: r, | |
style: { | |
maxHeight: "70vh" | |
} | |
}), (0, et.jsx)(eW, { | |
children: (0, et.jsx)(eN.z, { | |
as: "button", | |
color: "neutral", | |
onClick: function(e) { | |
e.preventDefault(), t(_) | |
}, | |
children: "Reset" | |
}) | |
})] | |
}) | |
}; | |
eq.displayName = "EditPromptPalette"; | |
var eM, ez = function() { | |
return (0, et.jsx)(eD, eR({}, eA)) | |
}, | |
eF = u.ZP.div.withConfig({ | |
displayName: "EditPrompt__TextareaWrapper", | |
componentId: "sc-tqixq2-0" | |
})({ | |
position: "relative", | |
display: "flex", | |
flexDirection: "column" | |
}), | |
eW = u.ZP.div.withConfig({ | |
displayName: "EditPrompt__PaletteActions", | |
componentId: "sc-tqixq2-1" | |
})({ | |
marginTop: "0.5rem", | |
display: "flex", | |
gap: "0.5rem" | |
}), | |
eL = u.ZP.div.withConfig({ | |
displayName: "EditPrompt__InputWarning", | |
componentId: "sc-tqixq2-2" | |
})({ | |
fontFamily: "S\xf6hne Mono, Monaco, Andale Mono, Ubuntu Mono, monospace", | |
fontSize: "0.75rem", | |
lineHeight: "1rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(239 68 68 / var(--tw-text-opacity))" | |
}), | |
eH = eR(eR({}, eA), {}, { | |
Palette: k.memo(eq), | |
Button: ez | |
}); | |
(eM = a || (a = {})).Small = "small", eM.Medium = "medium", eM.Large = "large", eM.XLarge = "xlarge", eM.Full = "full"; | |
var eU = (o = {}, (0, i.Z)(o, a.Small, 640), (0, i.Z)(o, a.Medium, 768), (0, i.Z)(o, a.Large, 1024), (0, i.Z)(o, a.XLarge, 1280), (0, i.Z)(o, a.Full, 1536), o); | |
function eJ() { | |
return function(e) { | |
var t = function(e) { | |
return window.matchMedia(e).matches | |
}, | |
r = (0, k.useState)(t(e)), | |
n = r[0], | |
o = r[1]; | |
function a() { | |
o(t(e)) | |
} | |
return (0, k.useEffect)(function() { | |
var t = window.matchMedia(e); | |
return a(), t.addListener ? t.addListener(a) : t.addEventListener("change", a), | |
function() { | |
t.removeListener ? t.removeListener(a) : t.removeEventListener("change", a) | |
} | |
}, [e]), n | |
}("(max-width: ".concat(eU[a.Large], "px)")) | |
} | |
var eG = r(55711); | |
function eV(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function eY(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? eV(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : eV(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var eX = { | |
id: "link", | |
title: "Add text from link", | |
icon: P.j4u, | |
width: "1/2" | |
}, | |
eK = function(e) { | |
var t = e.onAddArtifact, | |
r = (0, k.useRef)(null), | |
n = (0, k.useCallback)(function(e) { | |
var n; | |
if (e.preventDefault(), null !== (n = r.current) && void 0 !== n && n.value) { | |
var o = new URL(r.current.value); | |
t(o.href) | |
} | |
}, [t]); | |
return (0, et.jsx)(e$, { | |
children: (0, et.jsx)(eG.Z, { | |
name: "link", | |
ref: r, | |
icon: P.qQs, | |
onInputIconClick: n, | |
className: "w-full" | |
}) | |
}) | |
}, | |
eQ = function(e) { | |
var t = e.isOnClipboard, | |
r = e.currentUrl, | |
n = e.isTextareaFocused, | |
o = e.onClick, | |
a = eJ(); | |
return (0, et.jsx)(eD, { | |
icon: P.j4u, | |
title: (0, et.jsxs)(et.Fragment, { | |
children: [t && (0, et.jsxs)(et.Fragment, { | |
children: ["Add text from", " ", (0, et.jsx)(eP, { | |
children: new URL(r).hostname | |
}), !a && n && (0, et.jsxs)(e0, { | |
children: [(0, et.jsx)(P.zv2, { | |
className: "mr-1" | |
}), "+ V"] | |
})] | |
}), !t && "Add text from link"] | |
}), | |
id: eX.id, | |
onClick: o, | |
active: t | |
}) | |
}, | |
e$ = u.ZP.div.withConfig({ | |
displayName: "Link__InputWrapper", | |
componentId: "sc-c47t4a-0" | |
})({ | |
position: "relative", | |
display: "flex", | |
gap: "0.5rem" | |
}), | |
e0 = u.ZP.span.withConfig({ | |
displayName: "Link__CommandWrapper", | |
componentId: "sc-c47t4a-1" | |
})({ | |
display: "flex", | |
alignItems: "center", | |
borderRadius: "0.375rem", | |
borderWidth: "1px", | |
padding: "0.25rem", | |
fontSize: "0.75rem", | |
lineHeight: "1rem" | |
}), | |
e1 = eY(eY({}, eX), {}, { | |
Palette: k.memo(eK), | |
Button: eQ | |
}); | |
function e5(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function e2(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? e5(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : e5(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var e3 = { | |
id: "prompts", | |
title: "Select prompt", | |
icon: P.yK7, | |
width: "2/3" | |
}, | |
e7 = function(e) { | |
var t = e.onInsertText; | |
return (0, et.jsx)(et.Fragment, { | |
children: te.map(function(e) { | |
return (0, et.jsxs)(e4, { | |
className: "group", | |
onClick: function(r) { | |
r.preventDefault(), t(e.content) | |
}, | |
children: [(0, et.jsxs)(e8, { | |
children: [e.name, ":"] | |
}), (0, et.jsx)(e9, { | |
children: e.content | |
}), (0, et.jsx)(en.ZP, { | |
icon: P.Rgz, | |
className: "absolute right-1 top-1.5 invisible group-hover:visible" | |
})] | |
}, e.id) | |
}) | |
}) | |
}; | |
e7.displayName = "PromptPalette"; | |
var e6 = function() { | |
return (0, et.jsx)(eD, e2({}, e3)) | |
}, | |
e4 = u.ZP.button.withConfig({ | |
displayName: "Prompts__PaletteItem", | |
componentId: "sc-1rencnu-0" | |
})({ | |
position: "relative", | |
display: "flex", | |
borderRadius: "0.375rem", | |
paddingTop: "0.25rem", | |
paddingBottom: "0.25rem", | |
paddingRight: "1.25rem", | |
paddingLeft: "0.25rem", | |
":hover": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(236 236 241 / var(--tw-bg-opacity))" | |
} | |
}), | |
e8 = u.ZP.div.withConfig({ | |
displayName: "Prompts__PaletteItemTitle", | |
componentId: "sc-1rencnu-1" | |
})({ | |
marginRight: "0.25rem", | |
flexShrink: "0", | |
fontWeight: "600" | |
}), | |
e9 = u.ZP.div.withConfig({ | |
displayName: "Prompts__PaletteItemDescription", | |
componentId: "sc-1rencnu-2" | |
})({ | |
overflow: "hidden", | |
textOverflow: "ellipsis", | |
whiteSpace: "nowrap" | |
}), | |
te = [{ | |
id: "summarize", | |
name: "Summarize", | |
content: 'Break down this content into a series of super short, simply written sections that follow a logical flow designed to help me understand the content as quickly as possible. Each section should include a "title" (1-5 words), the primary "content" (1-2 sentence), and an optional additional sentence for "detail" (1 sentence). The first section should provide a concise summary of the content.' | |
}, { | |
id: "format", | |
name: "Format", | |
content: "(When responding to the following prompts, please make sure to properly style your response using Github Flavored Markdown. Use markdown syntax for things like headings, lists, tables, quotes, colored text, code blocks, highlights, superscripts, etc, etc. For emojis, use unicode. Make sure not to mention markdown or stying in your actual response.)\n" | |
}, { | |
id: "code", | |
name: "Programming question", | |
content: _ | |
}], | |
tt = e2(e2({}, e3), {}, { | |
Palette: k.memo(e7), | |
Button: e6 | |
}); | |
function tr(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function tn(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? tr(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : tr(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var to = { | |
id: "editPrompt", | |
title: "Edit prompt", | |
icon: P.SwK, | |
width: "full" | |
}, | |
ta = function(e) { | |
var t = e.onToggleQueryData, | |
r = e.queryDataEnabled, | |
n = function(e) { | |
t(e.currentTarget.checked) | |
}; | |
return (0, et.jsxs)(eE, { | |
children: [(0, et.jsx)("div", { | |
className: "flex h-5 pl-1 items-center", | |
children: (0, et.jsx)("input", { | |
id: "queryData", | |
name: "queryData", | |
type: "checkbox", | |
className: "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500", | |
onChange: n, | |
checked: r | |
}) | |
}), (0, et.jsx)("div", { | |
className: "ml-1 text-sm pr-1 cursor-pointer dark:text-gray-300", | |
children: (0, et.jsx)("label", { | |
htmlFor: "queryData", | |
children: "Include retrieval data (beta)" | |
}) | |
})] | |
}) | |
}, | |
ti = tn(tn({}, to), {}, { | |
Button: ta | |
}); | |
function ts(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function tc(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? ts(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ts(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var tl = { | |
id: "reroll", | |
title: "Retry", | |
icon: P.Qxo, | |
width: "full" | |
}, | |
td = function(e) { | |
var t = e.onClick; | |
return (0, et.jsx)(e_, { | |
icon: tl.icon, | |
onClick: t, | |
children: tl.title | |
}) | |
}, | |
tp = tc(tc({}, tl), {}, { | |
Button: td | |
}); | |
function tu(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function tm(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? tu(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : tu(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var th = { | |
id: "snippet", | |
title: "Add snippet", | |
icon: P.xqv, | |
width: "1/2" | |
}, | |
tf = function(e) { | |
var t = e.onInsertText, | |
r = (0, k.useRef)(null), | |
n = (0, k.useCallback)(function(e) { | |
e.preventDefault(); | |
var n = tv.find(function(e) { | |
var t; | |
return e.value === (null == r ? void 0 : null === (t = r.current) || void 0 === t ? void 0 : t.value) | |
}); | |
n && t(n.content) | |
}, [t]); | |
return (0, et.jsxs)(tw, { | |
children: [(0, et.jsx)("label", { | |
htmlFor: "language", | |
className: "text-sm font-medium text-gray-700 hidden", | |
children: "Supported languages" | |
}), (0, et.jsxs)("select", { | |
ref: r, | |
id: "language", | |
name: "language", | |
className: "mt-1 block w-full rounded-md border-gray-300 py-2 pl-3 pr-10 text-base focus:border-indigo-500 focus:outline-none focus:ring-indigo-500 sm:text-sm", | |
children: [(0, et.jsxs)("option", { | |
disabled: !0, | |
selected: !0, | |
children: [" ", "-- select a language --", " "] | |
}), tv.map(function(e) { | |
return (0, et.jsx)("option", { | |
value: e.value, | |
children: e.name | |
}, "option-".concat(e.value)) | |
})] | |
}), (0, et.jsx)(tb, { | |
onClick: n, | |
children: (0, et.jsx)(P.qQs, {}) | |
})] | |
}) | |
}; | |
tf.displayName = "SnippetPalette"; | |
var tg = function() { | |
return (0, et.jsx)(eD, tm({}, th)) | |
}, | |
tw = u.ZP.div.withConfig({ | |
displayName: "Snippet__InputWrapper", | |
componentId: "sc-wnzdyj-0" | |
})({ | |
position: "relative", | |
display: "flex", | |
gap: "0.5rem" | |
}), | |
tb = u.ZP.button.withConfig({ | |
displayName: "Snippet__SubmitLinkButton", | |
componentId: "sc-wnzdyj-1" | |
})({ | |
marginTop: "0.25rem", | |
borderRadius: "0.375rem", | |
borderWidth: "1px", | |
paddingLeft: "1rem", | |
paddingRight: "1rem" | |
}), | |
tv = [{ | |
name: "Plain text", | |
value: "plaintext", | |
icon: P.RUS, | |
content: "```\n{INSERT CODE HERE}\n```" | |
}, { | |
name: "Python", | |
value: "python", | |
icon: ep.osz, | |
content: "```python\n{INSERT CODE HERE}\n```" | |
}, { | |
name: "JavaScript", | |
value: "javascript", | |
icon: P.xqv, | |
content: "```js\n{INSERT CODE HERE}\n```" | |
}, { | |
name: "TypeScript", | |
value: "typescript", | |
icon: P.xqv, | |
content: "```ts\n{INSERT CODE HERE}\n```" | |
}], | |
tx = tm(tm({}, th), {}, { | |
Palette: k.memo(tf), | |
Button: tg | |
}); | |
eH.Button; | |
var ty = eH.Palette; | |
e1.Button; | |
var tj = e1.Palette; | |
tt.Button; | |
var tk = tt.Palette; | |
tx.Button; | |
var tC = tx.Palette, | |
tP = ti.Button, | |
tO = tp.Button; | |
function tT(e) { | |
var t = e.onInsertText, | |
r = e.onAddArtifact, | |
n = e.onEditPromptEngineering, | |
o = e.promptEngineering, | |
a = e.paletteType, | |
i = e.isOpen, | |
s = e.className, | |
c = (0, k.useMemo)(function() { | |
switch (a) { | |
case "editPrompt": | |
return eH; | |
case "link": | |
return e1; | |
case "prompts": | |
return tt; | |
case "snippet": | |
return tx | |
} | |
}, [a]); | |
return c ? (0, et.jsx)(ei.u, { | |
show: i, | |
enterFrom: "opacity-0", | |
enterTo: "opacity-100", | |
leave: "transition-opacity duration-500", | |
leaveFrom: "opacity-100", | |
leaveTo: "opacity-0", | |
children: (0, et.jsxs)(tS, { | |
className: s, | |
width: c.width, | |
children: [(0, et.jsxs)(tN, { | |
children: [(null == c ? void 0 : c.icon) && (0, et.jsx)(en.ZP, { | |
icon: c.icon, | |
className: "mr-2" | |
}), (0, et.jsx)("span", { | |
children: (null == c ? void 0 : c.title) || "" | |
})] | |
}), (0, et.jsxs)(tI, { | |
children: ["link" === a && (0, et.jsx)(tj, { | |
onAddArtifact: r | |
}), "prompts" === a && (0, et.jsx)(tk, { | |
onInsertText: t | |
}), "snippet" === a && (0, et.jsx)(tC, { | |
onInsertText: t | |
}), "editPrompt" === a && (0, et.jsx)(ty, { | |
onEditPromptEngineering: n, | |
promptEngineering: o | |
})] | |
})] | |
}) | |
}) : null | |
} | |
var tS = u.ZP.div.withConfig({ | |
displayName: "CommandPalette__PaletteWrapper", | |
componentId: "sc-xo9dzs-0" | |
})(function(e) { | |
var t = e.width; | |
return [{ | |
position: "absolute", | |
zIndex: "10", | |
marginLeft: "1rem", | |
borderRadius: "0.375rem", | |
borderWidth: "1px", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(255 255 255 / var(--tw-bg-opacity))", | |
padding: "0.5rem", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(64 65 79 / var(--tw-text-opacity))", | |
"--tw-shadow": "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)", | |
"--tw-shadow-colored": "0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color)", | |
boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" | |
}, "1/2" === t && { | |
width: "calc(100% - 34px)", | |
"@media (min-width: 1024px)": { | |
width: "50%" | |
} | |
}, "2/3" === t && { | |
width: "calc(100% - 34px)", | |
"@media (min-width: 1024px)": { | |
width: "66.666667%" | |
} | |
}, "full" === t && { | |
width: "calc(100% - 34px)", | |
"@media (min-width: 1024px)": { | |
width: "calc(100% - 20px)" | |
} | |
}] | |
}), | |
tN = u.ZP.div.withConfig({ | |
displayName: "CommandPalette__PaletteTitle", | |
componentId: "sc-xo9dzs-1" | |
})({ | |
marginBottom: "0.5rem", | |
display: "flex", | |
alignItems: "center", | |
fontWeight: "600" | |
}), | |
tI = u.ZP.div.withConfig({ | |
displayName: "CommandPalette__PaletteList", | |
componentId: "sc-xo9dzs-2" | |
})({ | |
display: "flex", | |
flexDirection: "column" | |
}); | |
function tZ(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function t_(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? tZ(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : tZ(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
function tE(e) { | |
var t = e.onAbortCompletion, | |
r = e.onCreateNewCompletion, | |
n = e.onUpdateArtifactStatus, | |
o = e.onRequestMoreCompletions, | |
a = e.onToggleQueryData, | |
i = e.queryDataEnabled, | |
c = e.artifact, | |
l = e.currentLeafId, | |
d = e.isCompletionInProgress, | |
u = e.className, | |
m = e.canUsePalette, | |
h = e.position, | |
g = e.paletteFeatures, | |
w = e.placeholder, | |
b = e.clearOnSubmit, | |
v = void 0 === b || b, | |
x = e.disableInterruptions, | |
y = void 0 !== x && x, | |
j = e.disabled, | |
S = void 0 !== j && j, | |
N = "root" === l, | |
I = (0, O.WS)(), | |
Z = (0, k.useMemo)(function() { | |
var e, t, r; | |
return r = new Set, g.forEach(function(e) { | |
"link" === e && N ? r.add("link") : "link" !== e && r.add(e) | |
}), r | |
}, [g, N]), | |
E = (0, k.useState)(!1), | |
D = (E[0], E[1]), | |
B = (0, k.useState)(!1), | |
R = B[0], | |
A = B[1], | |
q = (0, k.useRef)(null), | |
M = (0, k.useState)(""), | |
z = M[0], | |
F = M[1], | |
W = (0, k.useState)(""), | |
L = W[0], | |
H = W[1], | |
U = (0, k.useState)(_), | |
J = U[0], | |
G = U[1], | |
V = (0, k.useMemo)(function() { | |
return { | |
currentPalette: R, | |
setCurrentPalette: A | |
} | |
}, [R]), | |
Y = (0, k.useCallback)(function(e) { | |
var t; | |
F(function(t) { | |
return t + e | |
}), A(!1), null === (t = q.current) || void 0 === t || t.focus() | |
}, []), | |
X = (0, k.useCallback)(function(e) { | |
n({ | |
state: "pasted", | |
url: e, | |
id: e, | |
contents: "" | |
}), H("") | |
}, [n]), | |
K = (0, k.useCallback)(function(e) { | |
var t; | |
X(e), A(!1), null === (t = q.current) || void 0 === t || t.focus() | |
}, [X]), | |
Q = (0, k.useCallback)(function(e) { | |
G(e) | |
}, []), | |
$ = (0, k.useCallback)(function(e) { | |
F(e.currentTarget.value) | |
}, []), | |
ee = (0, k.useCallback)(function(e) { | |
if (null == e || e.preventDefault(), !S) { | |
var t, o, a = null === (t = q.current) || void 0 === t ? void 0 : t.value, | |
i = "".concat(null === (o = q.current) || void 0 === o ? void 0 : o.dataset.id, "-nextPrompt"); | |
if (a || null != c && c.url) { | |
var s = (null == c ? void 0 : c.url) || ""; | |
(null == c ? void 0 : c.state) === "pasted" && n(function(e) { | |
return t_(t_({}, e), {}, { | |
state: "static" | |
}) | |
}), r(i, t_({ | |
value: a || "" | |
}, (null == c ? void 0 : c.state) === "pasted" ? { | |
artifacts: [null == c ? void 0 : c.url] | |
} : {}), { | |
eventSource: e ? "mouse" : "keyboard" | |
}, s), v && F(""), H(""), (0, C.SI)(1, q.current) | |
} | |
} | |
}, [null == c ? void 0 : c.state, null == c ? void 0 : c.url, v, S, r, n]), | |
er = (0, k.useCallback)((0, s.Z)(p().mark(function e() { | |
var t, r, n, o; | |
return p().wrap(function(e) { | |
for (;;) switch (e.prev = e.next) { | |
case 0: | |
if (D(!0), !(!Z.has("link") || "root" !== l)) { | |
e.next = 3; | |
break | |
} | |
return e.abrupt("return"); | |
case 3: | |
return e.next = 5, navigator.clipboard.readText(); | |
case 5: | |
r = e.sent, n = /^https?:\/\/[^\s]+/g, (o = null === (t = r.match(n)) || void 0 === t ? void 0 : t[0]) && H(o); | |
case 9: | |
case "end": | |
return e.stop() | |
} | |
}, e) | |
})), [Z, l]), | |
eo = (0, k.useCallback)(function() { | |
D(!1) | |
}, []), | |
ea = (0, k.useCallback)(function() { | |
n(null) | |
}, [n]), | |
ei = (0, k.useCallback)(function() { | |
t("", l), o(l, { | |
eventSource: "mouse" | |
}) | |
}, [l, t, o]), | |
es = (0, k.useCallback)(function() { | |
t("", l), I(T.s6.pauseCompletion, { | |
eventSource: "mouse" | |
}) | |
}, [l, I, t]), | |
ec = (0, k.useMemo)(function() { | |
return { | |
Enter: { | |
validator: function() { | |
return !0 | |
}, | |
handler: function(e) { | |
e.shiftKey || (e.preventDefault(), y && d || ee()) | |
} | |
}, | |
Escape: { | |
validator: function() { | |
return !y && d | |
}, | |
handler: function() { | |
t("", l), I(T.s6.pauseCompletion, { | |
eventSource: "keyboard" | |
}) | |
} | |
}, | |
Tab: { | |
validator: function() { | |
var e; | |
return N && !(null != q && null !== (e = q.current) && void 0 !== e && e.value) && !m | |
}, | |
handler: function(e) { | |
e.preventDefault(), F("(When responding to the following prompts, please make sure to properly style your response using Github Flavored Markdown. Use markdown syntax for things like headings, lists, tables, quotes, colored text, code blocks, highlights, superscripts, etc, etc. For emojis, use unicode. Make sure not to mention markdown or stying in your actual response.)\n") | |
} | |
} | |
} | |
}, [m, l, d, I, ee, N, y, t]); | |
(0, k.useEffect)(function() { | |
var e = q.current, | |
t = function(e) { | |
var t; | |
null !== (t = ec[e.key]) && void 0 !== t && t.validator(e) && ec[e.key].handler(e) | |
}; | |
return e && e.addEventListener("keydown", t), | |
function() { | |
e && e.removeEventListener("keydown", t) | |
} | |
}, [ec]), (0, k.useEffect)(function() { | |
var e = q.current, | |
t = function(t) { | |
!(null != e && e.value) && L && N && (t.preventDefault(), X(L)) | |
}; | |
return Z.has("link") && e && N && e.addEventListener("paste", t), | |
function() { | |
e && e.removeEventListener("paste", t) | |
} | |
}, [X, l, N, n, L, Z]), (0, k.useEffect)(function() { | |
return window.addEventListener("focus", er), | |
function() { | |
window.removeEventListener("focus", er) | |
} | |
}, [er]), (0, k.useEffect)(function() { | |
var e; | |
null === (e = q.current) || void 0 === e || e.focus() | |
}, [I]); | |
var el = y && d; | |
return (0, et.jsx)("form", { | |
className: u, | |
onSubmit: ee, | |
children: (0, et.jsxs)("div", { | |
className: (0, f.Z)("relative flex-1 h-full flex flex-col"), | |
children: [(0, et.jsxs)(tq, { | |
children: [!N && !(y && d) && (0, et.jsxs)(eN.z, { | |
as: "button", | |
color: "neutral", | |
onClick: ei, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.Qxo, | |
size: "xsmall" | |
}), "Try again"] | |
}), !y && d && (0, et.jsxs)(eN.z, { | |
as: "button", | |
color: "neutral", | |
onClick: es, | |
children: ["Pause completion", (0, et.jsx)(en.ZP, { | |
icon: P.R4s, | |
size: "xsmall" | |
})] | |
})] | |
}), (0, et.jsxs)(tB, { | |
lessPadding: !m, | |
children: [(null == c ? void 0 : c.state) === "pasted" && (0, et.jsx)(eS, { | |
urls: new Set([c.url]), | |
onRemoveUrl: ea, | |
className: "ml-2" | |
}), (0, et.jsx)(C.ZP, { | |
tabIndex: 0, | |
onFocus: er, | |
onBlur: eo, | |
value: z, | |
"data-id": l, | |
ref: q, | |
style: { | |
maxHeight: "200px" | |
}, | |
rows: 1, | |
onChange: $, | |
placeholder: w, | |
className: (0, f.Z)(m && "pl-2", "w-full resize-none focus:ring-0 focus-visible:ring-0 p-0 pr-7 m-0 border-0 bg-transparent dark:bg-transparent") | |
}), (0, et.jsx)(tR, { | |
disabled: el || S, | |
nudgeBottom: el, | |
children: el ? (0, et.jsx)("div", { | |
className: "text-2xl", | |
children: (0, et.jsx)(tD, {}) | |
}) : (0, et.jsx)(en.ZP, { | |
icon: ex.ip9, | |
size: "small", | |
strokeWidth: 0, | |
className: "rotate-90" | |
}) | |
}), (0, et.jsxs)(eI.Provider, { | |
value: V, | |
children: [(0, et.jsx)(tT, { | |
onInsertText: Y, | |
onAddArtifact: K, | |
onEditPromptEngineering: Q, | |
promptEngineering: J, | |
paletteType: R, | |
isOpen: Boolean(R), | |
className: (0, f.Z)("bottom" === h ? "top-full -left-2" : "mt-3 -translate-y-full") | |
}), m && (0, et.jsxs)(tA, { | |
children: [Z.has("reroll") && !N && (0, et.jsx)(tO, { | |
onClick: ei | |
}), Z.has("retrieval") && (0, et.jsx)(tP, { | |
queryDataEnabled: i, | |
onToggleQueryData: a | |
})] | |
})] | |
})] | |
})] | |
}) | |
}) | |
} | |
function tD() { | |
var e = (0, k.useState)(0), | |
t = e[0], | |
r = e[1]; | |
(0, k.useEffect)(function() { | |
var e = setInterval(function() { | |
r(function(e) { | |
return (e + 1) % 3 | |
}) | |
}, 350); | |
return function() { | |
return clearInterval(e) | |
} | |
}, []); | |
for (var n = [], o = 0; o < 3; o++) n.push((0, et.jsx)("span", { | |
className: o <= t ? "" : "invisible", | |
children: "\xb7" | |
}, o)); | |
return (0, et.jsx)(et.Fragment, { | |
children: n | |
}) | |
} | |
var tB = u.ZP.div.withConfig({ | |
displayName: "PromptTextarea__TextareaWrapper", | |
componentId: "sc-4snkpf-0" | |
})(function(e) { | |
return [{ | |
position: "relative", | |
display: "flex", | |
width: "100%", | |
flexDirection: "column", | |
paddingTop: "0.5rem", | |
paddingBottom: "0.5rem", | |
paddingLeft: "0.75rem", | |
"@media (min-width: 768px)": { | |
paddingTop: "0.75rem", | |
paddingBottom: "0.75rem", | |
paddingLeft: "1rem" | |
} | |
}, !e.lessPadding && { | |
paddingLeft: "0.25rem", | |
paddingBottom: "0px", | |
"@media (min-width: 768px)": { | |
paddingBottom: "0.25rem" | |
} | |
}, { | |
borderRadius: "0.375rem", | |
borderWidth: "1px", | |
borderColor: "rgb(0 0 0 / 0.1)", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(255 255 255 / var(--tw-bg-opacity))", | |
"--tw-shadow": "0 0 10px rgba(0,0,0,0.10)", | |
"--tw-shadow-colored": "0 0 10px var(--tw-shadow-color)", | |
boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)", | |
".dark &": { | |
borderColor: "rgb(32 33 35 / 0.5)", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(64 65 79 / var(--tw-bg-opacity))", | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))", | |
"--tw-shadow": "0 0 15px rgba(0,0,0,0.10)", | |
"--tw-shadow-colored": "0 0 15px var(--tw-shadow-color)", | |
boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" | |
} | |
}] | |
}), | |
tR = u.ZP.button.withConfig({ | |
displayName: "PromptTextarea__PositionSubmit", | |
componentId: "sc-4snkpf-1" | |
})(function(e) { | |
return [{ | |
position: "absolute", | |
bottom: "0.375rem", | |
right: "0.25rem", | |
borderRadius: "0.375rem", | |
padding: "0.25rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(142 142 160 / var(--tw-text-opacity))", | |
":hover": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(236 236 241 / var(--tw-bg-opacity))" | |
}, | |
":hover:disabled": { | |
backgroundColor: "transparent" | |
}, | |
".dark &:hover": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(32 33 35 / var(--tw-bg-opacity))", | |
"--tw-text-opacity": "1", | |
color: "rgb(172 172 190 / var(--tw-text-opacity))" | |
}, | |
".dark &:hover:disabled": { | |
backgroundColor: "transparent" | |
}, | |
"@media (min-width: 768px)": { | |
bottom: "0.625rem", | |
right: "0.5rem" | |
} | |
}, e.nudgeBottom && { | |
":disabled": { | |
bottom: "0.25rem" | |
} | |
}] | |
}), | |
tA = u.ZP.div.withConfig({ | |
displayName: "PromptTextarea__PromptActions", | |
componentId: "sc-4snkpf-2" | |
})({ | |
marginTop: "0.25rem", | |
display: "flex", | |
minHeight: "32px", | |
alignItems: "center", | |
gap: "0.25rem", | |
fontSize: "0.75rem", | |
lineHeight: "1rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(142 142 160 / var(--tw-text-opacity))", | |
"@media (min-width: 768px)": { | |
marginTop: "0.5rem", | |
minHeight: "34px", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem" | |
} | |
}), | |
tq = u.ZP.div.withConfig({ | |
displayName: "PromptTextarea__LastItemActions", | |
componentId: "sc-4snkpf-3" | |
})({ | |
marginBottom: "0.75rem", | |
display: "flex", | |
width: "100%", | |
justifyContent: "center", | |
gap: "0.5rem" | |
}); | |
function tM(e) { | |
var t = e.children, | |
r = e.title, | |
n = e.icon, | |
o = e.sidebarOpen, | |
a = e.onSidebarOpen; | |
return (0, et.jsx)(ei.u.Root, { | |
show: o, | |
as: k.Fragment, | |
children: (0, et.jsxs)(es.V, { | |
as: "div", | |
className: "relative z-10", | |
onClose: a, | |
children: [(0, et.jsx)("div", { | |
className: "fixed inset-0" | |
}), (0, et.jsx)("div", { | |
className: "fixed inset-0 overflow-hidden", | |
children: (0, et.jsx)("div", { | |
className: "absolute inset-0 overflow-hidden", | |
children: (0, et.jsx)("div", { | |
className: "pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10", | |
children: (0, et.jsx)(ei.u.Child, { | |
as: k.Fragment, | |
enter: "transform transition ease-in-out duration-100 sm:duration-300", | |
enterFrom: "translate-x-full", | |
enterTo: "translate-x-0", | |
leave: "transform transition ease-in-out duration-300 sm:duration-500", | |
leaveFrom: "translate-x-0", | |
leaveTo: "translate-x-full", | |
children: (0, et.jsx)(es.V.Panel, { | |
className: "pointer-events-auto w-screen max-w-md border-l border-gray-100 dark:border-gray-700", | |
children: (0, et.jsxs)("div", { | |
className: "flex h-full flex-col overflow-y-auto bg-white dark:bg-gray-800 shadow-xl", | |
children: [(0, et.jsx)("div", { | |
className: "", | |
children: (0, et.jsxs)("div", { | |
className: "flex items-start justify-between", | |
children: [(0, et.jsxs)(es.V.Title, { | |
className: "text-lg font-medium text-gray-900 dark:text-white flex items-center gap-2 px-4 py-2", | |
children: [(0, et.jsx)(en.ZP, { | |
icon: n | |
}), r] | |
}), (0, et.jsx)("div", { | |
className: "flex h-7 items-center mr-2 mt-2", | |
children: (0, et.jsxs)("button", { | |
type: "button", | |
className: "rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2", | |
onClick: function() { | |
return a(!1) | |
}, | |
children: [(0, et.jsx)("span", { | |
className: "sr-only", | |
children: "Close panel" | |
}), (0, et.jsx)(en.ZP, { | |
icon: P.q5L, | |
size: "medium", | |
"aria-hidden": "true" | |
})] | |
}) | |
})] | |
}) | |
}), (0, et.jsx)("div", { | |
className: "relative flex-1", | |
children: t | |
})] | |
}) | |
}) | |
}) | |
}) | |
}) | |
})] | |
}) | |
}) | |
} | |
var tz = r(46939), | |
tF = r(95182), | |
tW = r.n(tF), | |
tL = { | |
errType: "warning", | |
errCode: "content_policy" | |
}, | |
tH = { | |
err: "An error occurred", | |
errType: "danger", | |
errCode: "content_policy" | |
}, | |
tU = "content_policy"; | |
function tJ(e) { | |
var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], | |
r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "text-moderation-playground", | |
n = tW()(e.length, 0, 4e3), | |
o = tW()(e.length - n, 0, e.length - 1), | |
a = t ? e.substring(o, e.length) : e; | |
return a ? N.ZP.runModerationApi(a, r).then(function(e) { | |
var t, r; | |
return { | |
isBlocked: Boolean(e.blocked), | |
isFlagged: Boolean(e.flagged) | |
} | |
}).catch(function(e) { | |
return console.error(e), { | |
isBlocked: !1, | |
isFlagged: !1, | |
error: e | |
} | |
}) : Promise.resolve({ | |
isBlocked: !1, | |
isFlagged: !1 | |
}) | |
} | |
var tG = r(89017), | |
tV = u.ZP.div.withConfig({ | |
displayName: "NodeEditor__SaveButtonPosition", | |
componentId: "sc-1wc6wal-0" | |
})({ | |
marginTop: "0.5rem", | |
display: "flex", | |
justifyContent: "center", | |
textAlign: "center" | |
}); | |
function tY(e) { | |
var t = e.initialText, | |
r = e.type, | |
n = e.parentId, | |
o = e.currentLeaf, | |
a = e.onCreateNewNode, | |
i = e.onUpdateNode, | |
s = e.onChangeItemInView, | |
c = e.onExitEdit, | |
l = e.onDeleteNode, | |
d = e.onRequestCompletion, | |
p = (0, O.WS)(), | |
u = (0, k.useId)(), | |
m = "".concat(o, "-").concat(u), | |
h = (0, k.useState)(t || ""), | |
f = h[0], | |
g = h[1], | |
w = (0, k.useRef)(null), | |
b = r === S.Jq.Completion || r === S.Jq.EditedCompletion; | |
(0, k.useEffect)(function() { | |
a(m, n, b ? S.Jq.EditedCompletion : S.Jq.EditedPrompt, "") | |
}, []); | |
var v = (0, k.useCallback)(function(e) { | |
g(e.currentTarget.value) | |
}, []), | |
x = (0, k.useCallback)(function() { | |
i(m, f), s(m), b || d(S.Os.Next, m, { | |
eventSource: "mouse" | |
}, !0), c() | |
}, [m, b, s, c, d, i, f]), | |
y = (0, k.useCallback)(function() { | |
l(m), s(o), c(), p(r === S.Jq.Completion || r === S.Jq.EditedCompletion ? T.s6.cancelEditCompletion : T.s6.cancelEditPrompt) | |
}, [m, o, p, s, l, c, r]); | |
return (0, k.useEffect)(function() { | |
var e = w.current, | |
t = function(e) { | |
"Enter" === e.key && e.metaKey ? x() : "Escape" === e.key && y() | |
}; | |
return e && e.addEventListener("keydown", t), | |
function() { | |
e && e.removeEventListener("keydown", t) | |
} | |
}, [y, x]), (0, et.jsxs)(et.Fragment, { | |
children: [(0, et.jsx)(C.ZP, { | |
ref: w, | |
value: f, | |
onChange: v, | |
className: "resize-none focus:ring-0 focus-visible:ring-0 p-0 m-0 border-0 bg-transparent" | |
}), (0, et.jsxs)(tV, { | |
children: [(0, et.jsx)(eN.z, { | |
as: "button", | |
onClick: x, | |
className: "mr-2", | |
children: b ? "Save new edit" : "Save & Submit" | |
}), (0, et.jsx)(eN.z, { | |
as: "button", | |
color: "neutral", | |
onClick: y, | |
children: "Cancel" | |
})] | |
})] | |
}) | |
} | |
function tX(e) { | |
var t = e.currentPage, | |
r = e.onChangeIndex, | |
n = e.length, | |
o = e.className, | |
a = function(e) { | |
r(tW()(t + e, 0, n - 1)) | |
}; | |
return (0, et.jsxs)(tK, { | |
className: o, | |
children: [(0, et.jsx)(tQ, { | |
onClick: function() { | |
return a(-1) | |
}, | |
disabled: 0 === t, | |
children: (0, et.jsx)(en.ZP, { | |
size: "xsmall", | |
icon: P.YFh | |
}) | |
}), (0, et.jsx)(t$, { | |
children: "".concat(t + 1, " / ").concat(n) | |
}), (0, et.jsx)(tQ, { | |
onClick: function() { | |
return a(1) | |
}, | |
disabled: t === n - 1, | |
children: (0, et.jsx)(en.ZP, { | |
size: "xsmall", | |
icon: P.Tfp | |
}) | |
})] | |
}) | |
} | |
var tK = u.ZP.div.withConfig({ | |
displayName: "Pagination__PaginationWrapper", | |
componentId: "sc-q79nhy-0" | |
})({ | |
display: "flex", | |
alignItems: "center", | |
justifyContent: "center", | |
gap: "0.25rem", | |
fontSize: "0.75rem", | |
lineHeight: "1rem" | |
}), | |
tQ = u.ZP.button.withConfig({ | |
displayName: "Pagination__PaginationButton", | |
componentId: "sc-q79nhy-1" | |
})({ | |
":disabled": { | |
"--tw-text-opacity": "1", | |
color: "rgb(197 197 210 / var(--tw-text-opacity))" | |
}, | |
".dark &": { | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))" | |
}, | |
".dark &:disabled": { | |
"--tw-text-opacity": "1", | |
color: "rgb(172 172 190 / var(--tw-text-opacity))" | |
} | |
}), | |
t$ = u.ZP.span.withConfig({ | |
displayName: "Pagination__PaginationState", | |
componentId: "sc-q79nhy-2" | |
})({ | |
flexShrink: "0", | |
flexGrow: "1" | |
}), | |
t0 = r(66280), | |
t1 = r(88366), | |
t5 = r(2155), | |
t2 = r(42426), | |
t3 = r(36542), | |
t7 = r(65921); | |
function t6(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function t4(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? t6(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : t6(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
function t8(e) { | |
var t = e.text, | |
r = e.children; | |
return (0, et.jsx)("span", { | |
className: "tooltip-label flex items-center text-center bg-slate-700 text-white dark:text-gray-700 text-sm font-medium py-1 px-2 rounded-sm shadow-md whitespace-pre-wrap normal-case", | |
"data-content": t, | |
children: r | |
}) | |
} | |
var t9 = function(e) { | |
var t = e.children, | |
r = e.label, | |
n = e.enterDelay, | |
o = void 0 === n ? 0 : n, | |
a = e.leaveDelay, | |
i = void 0 === a ? 50 : a, | |
s = e.placement, | |
c = void 0 === s ? "bottom" : s, | |
l = e.offset, | |
d = e.withArrow, | |
p = (0, k.useState)(!1), | |
u = p[0], | |
m = p[1], | |
h = (0, k.useState)(null), | |
g = h[0], | |
w = h[1], | |
b = (0, k.useState)(null), | |
v = b[0], | |
x = b[1], | |
y = (0, k.useState)(null), | |
j = y[0], | |
C = y[1], | |
P = (0, t7.D)(g, v, { | |
placement: c, | |
modifiers: [{ | |
name: "offset", | |
options: { | |
offset: void 0 === l ? [0, 14] : l | |
} | |
}, { | |
name: "arrow", | |
options: { | |
element: j | |
} | |
}] | |
}), | |
O = P.styles, | |
T = P.attributes, | |
S = P.forceUpdate, | |
N = (0, k.useRef)(), | |
I = (0, k.useRef)(), | |
Z = (0, k.useCallback)(function() { | |
null == S || S(), I.current && clearTimeout(I.current), N.current = setTimeout(function() { | |
return m(!0) | |
}, o) | |
}, [o, S]), | |
_ = (0, k.useCallback)(function() { | |
N.current && clearTimeout(N.current), I.current = setTimeout(function() { | |
return m(!1) | |
}, i) | |
}, [i]); | |
return (0, et.jsxs)("div", { | |
style: { | |
lineHeight: 0 | |
}, | |
children: [(0, et.jsx)("div", { | |
ref: w, | |
onMouseEnter: Z, | |
onMouseLeave: _, | |
className: "relative h-full", | |
children: t | |
}), (0, et.jsxs)("div", t4(t4({ | |
ref: x, | |
style: O.popper | |
}, T.popper), {}, { | |
className: (0, f.Z)("transition-opacity z-10", u ? "opacity-100" : "opacity-0", "bg-gray-800 dark:bg-gray-100 pointer-events-none"), | |
children: [r, (void 0 === d || d) && (0, et.jsx)(rt, { | |
ref: C, | |
style: O.arrow, | |
placement: c | |
})] | |
}))] | |
}) | |
}, | |
re = u.ZP.div.withConfig({ | |
displayName: "Tooltip__ArrowPseudo", | |
componentId: "sc-kik0qx-0" | |
})(function(e) { | |
var t = e.placement; | |
return [{ | |
"::before": { | |
content: "var(--tw-content)", | |
visibility: "visible", | |
position: "absolute", | |
height: "0.5rem", | |
width: "0.5rem", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(32 33 35 / var(--tw-bg-opacity))", | |
"--tw-content": '""' | |
}, | |
".dark &::before": { | |
content: "var(--tw-content)", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(236 236 241 / var(--tw-bg-opacity))" | |
} | |
}, "bottom" === t && { | |
"::before": { | |
content: "var(--tw-content)", | |
top: "-1.75rem", | |
"--tw-translate-y": "-50%", | |
transform: "translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))", | |
"--tw-translate-x": "-50%", | |
"--tw-rotate": "45deg" | |
} | |
}, "top" === t && { | |
"::before": { | |
content: "var(--tw-content)", | |
top: "-0.25rem", | |
"--tw-rotate": "45deg", | |
transform: "translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))" | |
} | |
}] | |
}), | |
rt = (0, u.ZP)(re).withConfig({ | |
displayName: "Tooltip__Arrow", | |
componentId: "sc-kik0qx-1" | |
})({ | |
position: "absolute", | |
zIndex: "-10", | |
height: "0.5rem", | |
width: "0.5rem" | |
}); | |
u.ZP.h3.withConfig({ | |
displayName: "shared__Header", | |
componentId: "sc-l9qja6-0" | |
})({ | |
position: "relative", | |
height: "37px", | |
borderTopWidth: "1px", | |
borderBottomWidth: "1px", | |
paddingTop: "0.625rem", | |
paddingBottom: "0.625rem", | |
paddingLeft: "1.5rem", | |
paddingRight: "1.5rem", | |
fontSize: "0.75rem", | |
lineHeight: "1rem", | |
fontWeight: "500", | |
textTransform: "uppercase", | |
"--tw-text-opacity": "1", | |
color: "rgb(64 65 79 / var(--tw-text-opacity))" | |
}); | |
var rr = u.ZP.h3.withConfig({ | |
displayName: "shared__SectionHeader", | |
componentId: "sc-l9qja6-1" | |
})({ | |
position: "relative", | |
borderTopWidth: "1px", | |
borderBottomWidth: "1px", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(236 236 241 / var(--tw-bg-opacity))", | |
paddingTop: "0.25rem", | |
paddingBottom: "0.25rem", | |
paddingLeft: "1.5rem", | |
paddingRight: "1.5rem", | |
fontSize: "0.75rem", | |
lineHeight: "1rem", | |
fontWeight: "500", | |
textTransform: "uppercase", | |
"--tw-text-opacity": "1", | |
color: "rgb(64 65 79 / var(--tw-text-opacity))" | |
}); | |
u.ZP.button.withConfig({ | |
displayName: "ArtifactHeader__ReportButton", | |
componentId: "sc-ur2kup-0" | |
})({ | |
position: "absolute", | |
right: "0px", | |
top: "50%", | |
display: "flex", | |
"--tw-translate-y": "-50%", | |
transform: "translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))", | |
alignItems: "center", | |
gap: "0.25rem", | |
fontSize: "0.75rem", | |
lineHeight: "1rem", | |
fontWeight: "400", | |
"--tw-text-opacity": "1", | |
color: "rgb(172 172 190 / var(--tw-text-opacity))", | |
":hover": { | |
"--tw-text-opacity": "1", | |
color: "rgb(142 142 160 / var(--tw-text-opacity))" | |
} | |
}); | |
var rn = function() { | |
var e = (0, k.useRef)(!1); | |
return (0, k.useEffect)(function() { | |
return e.current = !0, | |
function() { | |
e.current = !1 | |
} | |
}, []), (0, k.useCallback)(function() { | |
return e.current | |
}, []) | |
}; | |
function ro(e) { | |
var t = e.text, | |
r = e.onCopy, | |
n = (0, k.useState)(!1), | |
o = n[0], | |
a = n[1], | |
i = rn(), | |
s = (0, k.useCallback)(function() { | |
r(), a(!0), setTimeout(function() { | |
i() && a(!1) | |
}, 2e3) | |
}, [i, r]); | |
return (0, et.jsxs)(et.Fragment, { | |
children: [!o && (0, et.jsxs)(ra, { | |
onClick: s, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.j4u | |
}), t] | |
}), o && (0, et.jsxs)(ra, { | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.UgA | |
}), t && "Copied!"] | |
})] | |
}) | |
} | |
var ra = u.ZP.button.withConfig({ | |
displayName: "CopyButton__StyledButton", | |
componentId: "sc-qcg84k-0" | |
})({ | |
marginLeft: "auto", | |
display: "flex", | |
gap: "0.5rem" | |
}), | |
ri = u.ZP.div.withConfig({ | |
displayName: "CodeSnippet__Wrapper", | |
componentId: "sc-1ifybgh-0" | |
})({ | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(0 0 0 / var(--tw-bg-opacity))" | |
}), | |
rs = u.ZP.div.withConfig({ | |
displayName: "CodeSnippet__ActionBar", | |
componentId: "sc-1ifybgh-1" | |
})({ | |
position: "relative", | |
display: "flex", | |
alignItems: "center", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(52 53 65 / var(--tw-bg-opacity))", | |
paddingLeft: "1rem", | |
paddingRight: "1rem", | |
paddingTop: "0.5rem", | |
paddingBottom: "0.5rem", | |
fontFamily: "S\xf6hne, ui-sans-serif, system-ui, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji", | |
fontSize: "0.75rem", | |
lineHeight: "1rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(217 217 227 / var(--tw-text-opacity))" | |
}), | |
rc = u.ZP.span.withConfig({ | |
displayName: "CodeSnippet__LanguageIndicator", | |
componentId: "sc-1ifybgh-2" | |
})({}), | |
rl = u.ZP.div.withConfig({ | |
displayName: "CodeSnippet__CodeContainer", | |
componentId: "sc-1ifybgh-3" | |
})({ | |
padding: "1rem" | |
}), | |
rd = u.ZP.code.withConfig({ | |
displayName: "CodeSnippet__CodeContent", | |
componentId: "sc-1ifybgh-4" | |
})({ | |
whiteSpace: "pre-wrap !important" | |
}); | |
function rp(e) { | |
var t = e.children, | |
r = e.className, | |
n = e.language, | |
o = e.content, | |
a = (0, k.useCallback)(function() { | |
navigator.clipboard.writeText(o) | |
}, [o]); | |
return (0, et.jsxs)(ri, { | |
children: [(0, et.jsxs)(rs, { | |
children: [n && (0, et.jsx)(rc, { | |
children: n | |
}), (0, et.jsx)(ro, { | |
text: "Copy code", | |
onCopy: a | |
})] | |
}), (0, et.jsx)(rl, { | |
children: (0, et.jsx)(rd, { | |
className: r, | |
children: t | |
}) | |
})] | |
}) | |
} | |
var ru = ["inline", "node", "className", "children"]; | |
function rm(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function rh(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? rm(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : rm(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
"## ".concat("Table of Contents"); | |
var rf = [ | |
[t5.Z, { | |
detect: !0, | |
subset: ["python", "javascript", "java", "go", "bash", "c", "cpp", "csharp", "css", "diff", "graphql", "json", "kotlin", "less", "lua", "makefile", "markdown", "objectivec", "perl", "php", "php-template", "plaintext", "python-repl", "r", "ruby", "rust", "scss", "shell", "sql", "swift", "typescript", "vbnet", "wasm", "xml", "yaml"], | |
ignoreMissing: !0 | |
}], | |
[t2.Z, { | |
newlines: !0 | |
}] | |
], | |
rg = [t3.Z], | |
rw = { | |
code: function(e) { | |
var t = e.inline, | |
r = e.node, | |
n = e.className, | |
o = e.children, | |
a = (0, c.Z)(e, ru); | |
if (t) return (0, et.jsx)("code", rh(rh({ | |
className: n | |
}, a), {}, { | |
children: o | |
})); | |
var i = null != n && n.startsWith("language-") ? n.split("-")[1] : ""; | |
return (0, et.jsx)(rp, { | |
language: i, | |
className: n, | |
content: (0, t1.B)(r), | |
children: o | |
}) | |
} | |
}, | |
rb = k.memo(function(e) { | |
var t = e.id, | |
r = e.text, | |
n = e.isActive, | |
o = e.format, | |
a = e.className, | |
i = e.isCompletionInProgress, | |
s = e.flag, | |
c = e.showContentPolicyViolation, | |
l = (0, ec.F)().theme; | |
return (0, et.jsxs)("div", { | |
className: (0, f.Z)(a, "whitespace-pre-wrap flex flex-col items-start gap-4", !n && "hidden", "danger" === s && "text-red-500 flex flex-row gap-2", "warning" === s && "text-orange-500"), | |
children: [o ? (0, et.jsx)(t0.D, { | |
components: rw, | |
rehypePlugins: rf, | |
remarkPlugins: rg, | |
linkTarget: "_new", | |
className: (0, f.Z)(t, !s && o && "markdown prose dark:prose-invert break-words", "danger" !== s && i && "result-streaming", "dark" === l ? "dark" : "light", "danger" === s && "text-red-500 flex flex-row gap-2", "warning" === s && "text-orange-500"), | |
children: "" === r ? "​" : r | |
}) : r, c && (0, et.jsx)(rx, { | |
flag: s, | |
children: ("danger" === s || "warning" === s) && (0, et.jsx)(rv, {}) | |
})] | |
}, t) | |
}); | |
function rv() { | |
return (0, et.jsxs)(et.Fragment, { | |
children: ["This content may violate our", " ", (0, et.jsx)("a", { | |
target: "_blank", | |
href: "https://beta.openai.com/docs/usage-policies/content-policy", | |
rel: "noreferrer", | |
className: "bold underline", | |
children: "content policy" | |
}), ". If you believe this to be in error, please", " ", (0, et.jsx)("a", { | |
target: "_blank", | |
href: "https://forms.gle/C644Swu6iHNuAcLi9", | |
rel: "noreferrer", | |
className: "bold underline", | |
children: "submit your feedback" | |
}), " ", "— your input will aid our research in this area."] | |
}) | |
} | |
var rx = u.ZP.div.withConfig({ | |
displayName: "Result__Notice", | |
componentId: "sc-549i6y-0" | |
})(function(e) { | |
var t = e.flag; | |
return [{ | |
borderRadius: "0.375rem", | |
borderWidth: "1px", | |
paddingTop: "0.5rem", | |
paddingBottom: "0.5rem", | |
paddingLeft: "0.75rem", | |
paddingRight: "0.75rem", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(86 88 105 / var(--tw-text-opacity))", | |
".dark &": { | |
"--tw-text-opacity": "1", | |
color: "rgb(236 236 241 / var(--tw-text-opacity))" | |
} | |
}, "warning" === t && { | |
"--tw-border-opacity": "1", | |
borderColor: "rgb(224 108 43 / var(--tw-border-opacity))", | |
backgroundColor: "rgb(224 108 43 / 0.1)" | |
}, "danger" === t && { | |
"--tw-border-opacity": "1", | |
borderColor: "rgb(239 68 68 / var(--tw-border-opacity))", | |
backgroundColor: "rgb(239 68 68 / 0.1)" | |
}] | |
}), | |
ry = k.memo(function(e) { | |
var t = e.siblings, | |
r = void 0 === t ? [] : t, | |
n = e.itemInViewId, | |
o = e.type, | |
a = e.parentId, | |
i = e.onChangeItemInView, | |
s = e.onCreateNewNode, | |
c = e.onUpdateNode, | |
l = e.onChangeRating, | |
d = e.onDeleteNode, | |
p = e.onRequestCompletion, | |
u = e.activeRequests, | |
m = (0, k.useContext)(I.y).theme, | |
h = m.color, | |
g = m.icon, | |
w = (0, em.useSession)().data, | |
b = eJ(), | |
v = (0, O.WS)(), | |
x = (0, k.useState)(!1), | |
y = x[0], | |
j = x[1], | |
C = (0, k.useMemo)(function() { | |
return r.findIndex(function(e) { | |
return e.id === n | |
}) | |
}, [n, r]), | |
N = (0, k.useMemo)(function() { | |
return r[C] | |
}, [r, C]), | |
Z = N.id, | |
_ = N.message, | |
E = N.err, | |
D = N.errType, | |
B = N.errCode, | |
R = N.rating, | |
A = (0, k.useState)(R), | |
q = A[0], | |
M = A[1], | |
z = (0, k.useState)(Q(_)), | |
F = z[0], | |
W = z[1], | |
L = (0, k.useState)(D || !1), | |
H = L[0], | |
U = L[1], | |
J = (0, k.useState)(B === tU), | |
G = J[0], | |
V = J[1], | |
Y = (0, k.useCallback)(function() { | |
v(o === S.Jq.Completion || o === S.Jq.EditedCompletion ? T.s6.editCompletion : T.s6.editPrompt, _ ? { | |
id: _.id | |
} : {}), j(!0) | |
}, [_, v, o]), | |
X = (0, k.useCallback)(function() { | |
j(!1) | |
}, []), | |
K = o === S.Jq.Completion || o === S.Jq.EditedCompletion, | |
$ = (0, k.useCallback)(function(e) { | |
l(Z, _.id, e), M(e) | |
}, [Z, _.id, l]), | |
ee = "CompletionUpdated:".concat(Z), | |
er = (0, k.useCallback)(function(e, t) { | |
var r = t.text, | |
n = t.flag, | |
o = void 0 !== n && n, | |
a = t.errCode; | |
o && (U(o), V((void 0 === a ? "" : a) === tU)), W(r) | |
}, []); | |
return (0, k.useEffect)(function() { | |
M(R), _ && W(E || Q(_)) | |
}, [_, R, E]), (0, k.useEffect)(function() { | |
U(D || !1), V(B === tU) | |
}, [Z, B, D]), (0, k.useEffect)(function() { | |
return PubSub.subscribe(ee, er), | |
function() { | |
PubSub.unsubscribe(ee) | |
} | |
}, [er, ee]), (0, et.jsx)(rj, { | |
className: (0, f.Z)("group", K ? "bg-gray-50 dark:bg-[#444654]" : "dark:bg-gray-800"), | |
children: (0, et.jsxs)(rk, { | |
children: [(0, et.jsxs)(rC, { | |
children: [K ? (0, et.jsx)(tG.k, { | |
background: h, | |
iconName: g, | |
notice: H || void 0 | |
}) : (0, et.jsx)(tG.Y, { | |
user: null == w ? void 0 : w.user, | |
notice: H || void 0 | |
}), r.length > 1 && !b && (0, et.jsx)(tX, { | |
currentPage: C, | |
onChangeIndex: function(e) { | |
return i(r[e].id) | |
}, | |
length: r.length, | |
className: "absolute left-0 -translate-x-full top-2 -ml-4 invisible group-hover:visible" | |
})] | |
}), (0, et.jsxs)("div", { | |
className: (0, f.Z)("relative lg:w-[calc(100%-115px)] w-full flex flex-col"), | |
children: [!y && (0, et.jsx)(rb, { | |
id: Z, | |
text: F, | |
errCode: H ? B : void 0, | |
flag: H, | |
isActive: !0, | |
isCompletionInProgress: u.has(Z), | |
format: K, | |
className: "min-h-[20px]", | |
showContentPolicyViolation: G | |
}, "Result:".concat(Z)), y && (0, et.jsx)(tY, { | |
currentLeaf: Z, | |
initialText: F, | |
onCreateNewNode: s, | |
type: o, | |
parentId: a, | |
onUpdateNode: c, | |
onDeleteNode: d, | |
onChangeItemInView: i, | |
onRequestCompletion: p, | |
onExitEdit: X | |
}), r.length > 1 && b && (0, et.jsx)(tX, { | |
currentPage: C, | |
onChangeIndex: function(e) { | |
return i(r[e].id) | |
}, | |
length: r.length, | |
className: "pt-2 self-center" | |
}), !K && !y && (0, et.jsx)(rO, { | |
children: (0, et.jsx)(rP, { | |
onClick: Y, | |
children: (0, et.jsx)(en.ZP, { | |
icon: P.vPQ | |
}) | |
}) | |
}), K && !u.has(Z) && (0, et.jsxs)(rO, { | |
children: ["thumbsDown" !== q && (0, et.jsx)(rP, { | |
onClick: function() { | |
return $("thumbsUp") | |
}, | |
disabled: "thumbsUp" === q, | |
className: (0, f.Z)("thumbsUp" === q && "bg-gray-100 text-gray-700 dark:bg-gray-700 !dark:text-gray-200"), | |
children: (0, et.jsx)(en.ZP, { | |
icon: P.fmn | |
}) | |
}, "thumbsUp:".concat(Z)), "thumbsUp" !== q && (0, et.jsx)(rP, { | |
onClick: function() { | |
return $("thumbsDown") | |
}, | |
disabled: "thumbsDown" === q, | |
className: (0, f.Z)("thumbsDown" === q && "bg-gray-100 text-gray-700 dark:bg-gray-700 !dark:text-gray-200"), | |
children: (0, et.jsx)(en.ZP, { | |
icon: P.oLd | |
}) | |
}, "thumbsDown:".concat(Z))] | |
})] | |
})] | |
}) | |
}) | |
}), | |
rj = u.ZP.div.withConfig({ | |
displayName: "ConversationItem__ConversationItemWrapper", | |
componentId: "sc-18srrdc-0" | |
})({ | |
width: "100%", | |
borderBottomWidth: "1px", | |
borderColor: "rgb(0 0 0 / 0.1)", | |
"--tw-text-opacity": "1", | |
color: "rgb(52 53 65 / var(--tw-text-opacity))", | |
".dark &": { | |
borderColor: "rgb(32 33 35 / 0.5)", | |
"--tw-text-opacity": "1", | |
color: "rgb(236 236 241 / var(--tw-text-opacity))" | |
} | |
}), | |
rk = u.ZP.div.withConfig({ | |
displayName: "ConversationItem__Message", | |
componentId: "sc-18srrdc-1" | |
})({ | |
margin: "auto", | |
display: "flex", | |
gap: "1.5rem", | |
padding: "1rem", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem", | |
"@media (min-width: 768px)": { | |
maxWidth: "42rem", | |
paddingTop: "2rem", | |
paddingBottom: "2rem", | |
fontSize: "1rem", | |
lineHeight: "1.5rem" | |
}, | |
"@media (min-width: 1024px)": { | |
maxWidth: "42rem", | |
paddingTop: "2.5rem", | |
paddingBottom: "2.5rem", | |
paddingLeft: "0px", | |
paddingRight: "0px" | |
}, | |
"@media (min-width: 1280px)": { | |
maxWidth: "48rem" | |
} | |
}), | |
rC = u.ZP.div.withConfig({ | |
displayName: "ConversationItem__Role", | |
componentId: "sc-18srrdc-2" | |
})({ | |
position: "relative", | |
display: "flex", | |
width: "30px", | |
flexDirection: "column", | |
alignItems: "flex-end" | |
}), | |
rP = u.ZP.button.withConfig({ | |
displayName: "ConversationItem__ActionButton", | |
componentId: "sc-18srrdc-3" | |
})({ | |
borderRadius: "0.375rem", | |
padding: "0.25rem", | |
":hover": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(236 236 241 / var(--tw-bg-opacity))", | |
"--tw-text-opacity": "1", | |
color: "rgb(64 65 79 / var(--tw-text-opacity))" | |
}, | |
".dark &": { | |
"--tw-text-opacity": "1", | |
color: "rgb(172 172 190 / var(--tw-text-opacity))" | |
}, | |
".dark &:hover": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(64 65 79 / var(--tw-bg-opacity))", | |
"--tw-text-opacity": "1", | |
color: "rgb(217 217 227 / var(--tw-text-opacity))" | |
}, | |
".dark &:hover:disabled": { | |
"--tw-text-opacity": "1", | |
color: "rgb(172 172 190 / var(--tw-text-opacity))" | |
} | |
}), | |
rO = u.ZP.div.withConfig({ | |
displayName: "ConversationItem__ActionButtons", | |
componentId: "sc-18srrdc-4" | |
})({ | |
marginTop: "0.5rem", | |
display: "flex", | |
justifyContent: "center", | |
gap: "1rem", | |
alignSelf: "flex-end", | |
"--tw-text-opacity": "1", | |
color: "rgb(172 172 190 / var(--tw-text-opacity))", | |
"@media (min-width: 1024px)": { | |
position: "absolute", | |
top: "0px", | |
right: "0px", | |
marginTop: "0px", | |
"--tw-translate-x": "100%", | |
transform: "translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))", | |
gap: "0.25rem", | |
alignSelf: "center", | |
paddingLeft: "0.5rem" | |
} | |
}), | |
rT = (0, u.ZP)(P.dAq).withConfig({ | |
displayName: "Spinner__RotatingSpinner", | |
componentId: "sc-13viy0u-0" | |
})({ | |
"@keyframes spin": { | |
to: { | |
transform: "rotate(360deg)" | |
} | |
}, | |
animation: "spin 1s linear infinite", | |
textAlign: "center" | |
}); | |
function rS(e) { | |
var t = e.className; | |
return (0, et.jsx)(rT, { | |
className: t | |
}) | |
} | |
var rN = r(75318), | |
rI = u.ZP.div.withConfig({ | |
displayName: "shared__Wrapper", | |
componentId: "sc-1r13js9-0" | |
})({ | |
width: "100%", | |
paddingLeft: "1.5rem", | |
paddingRight: "1.5rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(52 53 65 / var(--tw-text-opacity))", | |
".dark &": { | |
"--tw-text-opacity": "1", | |
color: "rgb(236 236 241 / var(--tw-text-opacity))" | |
}, | |
"@media (min-width: 768px)": { | |
display: "flex", | |
height: "100%", | |
maxWidth: "42rem", | |
flexDirection: "column" | |
}, | |
"@media (min-width: 1024px)": { | |
maxWidth: "48rem" | |
} | |
}), | |
rZ = u.ZP.h1.withConfig({ | |
displayName: "shared__Title", | |
componentId: "sc-1r13js9-1" | |
})({ | |
marginTop: "20vh", | |
marginLeft: "auto", | |
marginRight: "auto", | |
marginBottom: "4rem", | |
fontSize: "2.25rem", | |
lineHeight: "2.5rem", | |
fontWeight: "600" | |
}), | |
r_ = u.ZP.div.withConfig({ | |
displayName: "shared__Capabilities", | |
componentId: "sc-1r13js9-2" | |
})({ | |
display: "flex", | |
alignItems: "flex-start", | |
gap: "0.875rem", | |
textAlign: "center" | |
}), | |
rE = u.ZP.div.withConfig({ | |
displayName: "shared__Capability", | |
componentId: "sc-1r13js9-3" | |
})({ | |
display: "flex", | |
flex: "1 1 0%", | |
flexDirection: "column", | |
gap: "0.875rem" | |
}), | |
rD = u.ZP.h2.withConfig({ | |
displayName: "shared__Header", | |
componentId: "sc-1r13js9-4" | |
})({ | |
fontSize: "1.125rem", | |
lineHeight: "1.75rem" | |
}), | |
rB = u.ZP.ul.withConfig({ | |
displayName: "shared__List", | |
componentId: "sc-1r13js9-5" | |
})({ | |
display: "flex", | |
flexDirection: "column", | |
gap: "0.875rem" | |
}), | |
rR = u.ZP.li.withConfig({ | |
displayName: "shared__ListItem", | |
componentId: "sc-1r13js9-6" | |
})({ | |
width: "100%", | |
borderRadius: "0.375rem", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(247 247 248 / var(--tw-bg-opacity))", | |
padding: "0.75rem", | |
".dark &": { | |
backgroundColor: "rgb(255 255 255 / 0.05)" | |
} | |
}), | |
rA = u.ZP.li.withConfig({ | |
displayName: "shared__ListItemQuote", | |
componentId: "sc-1r13js9-7" | |
})({ | |
width: "100%", | |
borderRadius: "0.375rem", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(247 247 248 / var(--tw-bg-opacity))", | |
padding: "0.75rem", | |
"::before": { | |
"--tw-content": "'\"'", | |
content: "var(--tw-content)" | |
}, | |
"::after": { | |
"--tw-content": "'\"'", | |
content: "var(--tw-content)" | |
}, | |
".dark &": { | |
backgroundColor: "rgb(255 255 255 / 0.05)" | |
} | |
}); | |
function rq() { | |
return (0, et.jsxs)(rI, { | |
children: [(0, et.jsx)(rZ, { | |
children: "ChatGPT" | |
}), (0, et.jsxs)(r_, { | |
children: [(0, et.jsxs)(rE, { | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.kXG, | |
size: "medium", | |
className: "m-auto" | |
}), (0, et.jsx)(rD, { | |
children: "Examples" | |
}), (0, et.jsxs)(rB, { | |
children: [(0, et.jsx)(rA, { | |
children: "Explain quantum computing in simple terms" | |
}), (0, et.jsx)(rA, { | |
children: "Got any creative ideas for a 10 year old’s birthday?" | |
}), (0, et.jsx)(rA, { | |
children: "How do I make an HTTP request in Javascript?" | |
})] | |
})] | |
}), (0, et.jsxs)(rE, { | |
children: [(0, et.jsx)(en.ZP, { | |
icon: rN.Z, | |
size: "medium", | |
className: "m-auto" | |
}), (0, et.jsx)(rD, { | |
children: "Capabilities" | |
}), (0, et.jsxs)(rB, { | |
children: [(0, et.jsx)(rR, { | |
children: "Remembers what user said earlier in the conversation" | |
}), (0, et.jsx)(rR, { | |
children: "Allows user to provide follow-up corrections" | |
}), (0, et.jsx)(rR, { | |
children: "Trained to decline inappropriate requests" | |
})] | |
})] | |
}), (0, et.jsxs)(rE, { | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.BJv, | |
size: "medium", | |
className: "m-auto" | |
}), (0, et.jsx)(rD, { | |
children: "Limitations" | |
}), (0, et.jsxs)(rB, { | |
children: [(0, et.jsx)(rR, { | |
children: "May occasionally generate incorrect information" | |
}), (0, et.jsx)(rR, { | |
children: "May occasionally produce harmful instructions or biased content" | |
}), (0, et.jsx)(rR, { | |
children: "Limited knowledge of world and events after 2021" | |
})] | |
})] | |
})] | |
})] | |
}) | |
} | |
var rM = r(40053); | |
function rz() { | |
return (0, et.jsxs)(rI, { | |
children: [(0, et.jsx)(rZ, { | |
children: "Workspace" | |
}), (0, et.jsxs)(r_, { | |
children: [(0, et.jsxs)(rE, { | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.kXG, | |
size: "medium", | |
className: "m-auto" | |
}), (0, et.jsx)(rD, { | |
children: "Learn about anything" | |
}), (0, et.jsxs)(rB, { | |
children: [(0, et.jsx)(rA, { | |
children: "Explain quantum computing, in layman's terms" | |
}), (0, et.jsx)(rA, { | |
children: "What the heck is a Kubernetes cluster?" | |
}), (0, et.jsx)(rA, { | |
children: "Quiz me on the Boston Tea Party" | |
})] | |
})] | |
}), (0, et.jsxs)(rE, { | |
children: [(0, et.jsx)(en.ZP, { | |
icon: rN.Z, | |
size: "medium", | |
className: "m-auto" | |
}), (0, et.jsx)(rD, { | |
children: "Synthesize information" | |
}), (0, et.jsxs)(rB, { | |
children: [(0, et.jsx)(rA, { | |
children: "Pull out memorable quotes from this blog post" | |
}), (0, et.jsx)(rA, { | |
children: "Summarize this meeting transcript as a poem" | |
}), (0, et.jsx)(rA, { | |
children: "Compare and contrast these two articles" | |
})] | |
})] | |
}), (0, et.jsxs)(rE, { | |
children: [(0, et.jsx)(en.ZP, { | |
icon: rM.Z, | |
size: "medium", | |
className: "m-auto" | |
}), (0, et.jsx)(rD, { | |
children: "Create things together" | |
}), (0, et.jsxs)(rB, { | |
children: [(0, et.jsx)(rA, { | |
children: "Plan an itinerary for a weekend trip to Big Sur" | |
}), (0, et.jsx)(rA, { | |
children: "Create an alien-themed browser game, full code" | |
}), (0, et.jsx)(rA, { | |
children: "Write a critical analysis on the current state of AI" | |
})] | |
})] | |
})] | |
})] | |
}) | |
} | |
var rF = r(24066); | |
function rW() { | |
return (0, et.jsxs)(rL, { | |
children: [(0, et.jsx)(rH, { | |
children: "Codespace" | |
}), (0, et.jsxs)(rU, { | |
children: [(0, et.jsxs)(rJ, { | |
children: [(0, et.jsx)(en.ZP, { | |
className: "text-gray-400", | |
icon: rF.Z, | |
size: "medium" | |
}), (0, et.jsx)(rG, { | |
children: "Ask anything" | |
}), (0, et.jsx)(rV, { | |
children: "No matter how simple or complex" | |
})] | |
}), (0, et.jsxs)(rJ, { | |
children: [(0, et.jsx)(en.ZP, { | |
className: "text-gray-400", | |
icon: P.cDN, | |
size: "medium" | |
}), (0, et.jsx)(rG, { | |
children: "Write code" | |
}), (0, et.jsx)(rV, { | |
children: "From one line of code to full-fledged apps" | |
})] | |
}), (0, et.jsxs)(rJ, { | |
children: [(0, et.jsx)(en.ZP, { | |
className: "text-gray-400", | |
icon: P.U0j, | |
size: "medium" | |
}), (0, et.jsx)(rG, { | |
children: "Debug faster" | |
}), (0, et.jsx)(rV, { | |
children: "Paste in a code of just an error statement" | |
})] | |
})] | |
})] | |
}) | |
} | |
var rL = u.ZP.div.withConfig({ | |
displayName: "ProgrammingPlaceholder__Wrapper", | |
componentId: "sc-1dvr9c4-0" | |
})({ | |
width: "100%", | |
alignItems: "center", | |
justifyContent: "space-between", | |
gap: "2.5rem", | |
paddingLeft: "1.5rem", | |
paddingRight: "1.5rem", | |
"--tw-text-opacity": "1", | |
color: "rgb(86 88 105 / var(--tw-text-opacity))", | |
".dark &": { | |
"--tw-text-opacity": "1", | |
color: "rgb(255 255 255 / var(--tw-text-opacity))" | |
}, | |
"@media (min-width: 768px)": { | |
display: "flex", | |
height: "100%", | |
maxWidth: "42rem", | |
paddingLeft: "0px", | |
paddingRight: "0px" | |
}, | |
"@media (min-width: 1024px)": { | |
maxWidth: "48rem" | |
} | |
}), | |
rH = u.ZP.h1.withConfig({ | |
displayName: "ProgrammingPlaceholder__Title", | |
componentId: "sc-1dvr9c4-1" | |
})({ | |
display: "flex", | |
flexDirection: "column", | |
alignItems: "center", | |
gap: "1.5rem", | |
borderBottomWidth: "2px", | |
"--tw-border-opacity": "1", | |
borderColor: "rgb(64 65 79 / var(--tw-border-opacity))", | |
paddingTop: "2.5rem", | |
paddingBottom: "2.5rem", | |
fontFamily: "S\xf6hne Mono, Monaco, Andale Mono, Ubuntu Mono, monospace", | |
fontSize: "3.75rem", | |
lineHeight: "1", | |
"@media (min-width: 768px)": { | |
alignItems: "flex-start", | |
borderWidth: "0px", | |
paddingTop: "0px", | |
paddingBottom: "0px" | |
} | |
}), | |
rU = u.ZP.div.withConfig({ | |
displayName: "ProgrammingPlaceholder__Capabilities", | |
componentId: "sc-1dvr9c4-2" | |
})({ | |
display: "flex", | |
height: "100%", | |
flexDirection: "column", | |
alignItems: "center", | |
justifyContent: "space-evenly" | |
}), | |
rJ = u.ZP.div.withConfig({ | |
displayName: "ProgrammingPlaceholder__Capability", | |
componentId: "sc-1dvr9c4-3" | |
})({ | |
display: "flex", | |
flexDirection: "column", | |
alignItems: "center", | |
gap: "0.5rem" | |
}), | |
rG = u.ZP.h2.withConfig({ | |
displayName: "ProgrammingPlaceholder__CapabilityTitle", | |
componentId: "sc-1dvr9c4-4" | |
})({ | |
fontSize: "1.25rem", | |
lineHeight: "1.75rem" | |
}), | |
rV = u.ZP.p.withConfig({ | |
displayName: "ProgrammingPlaceholder__CapabilityDescription", | |
componentId: "sc-1dvr9c4-5" | |
})({ | |
fontSize: "1rem", | |
lineHeight: "1.5rem", | |
".dark &": { | |
"--tw-text-opacity": "1", | |
color: "rgb(197 197 210 / var(--tw-text-opacity))" | |
} | |
}); | |
function rY(e) { | |
var t = e.nodes, | |
r = e.onChangeItemInView, | |
n = e.onCreateNewNode, | |
o = e.onUpdateNode, | |
a = e.onChangeRating, | |
i = e.onDeleteNode, | |
s = e.onRequestCompletion, | |
c = e.activeRequests, | |
l = e.branchesInView, | |
d = e.isProcessingArtifact, | |
p = (0, k.useContext)(I.y).id, | |
u = (0, tz.useScrollToBottom)(), | |
m = (0, tz.useSticky)(), | |
h = (0, R.Z)(m, 1)[0]; | |
return (0, et.jsxs)(et.Fragment, { | |
children: [(0, et.jsxs)(rX, { | |
children: ["programming" === p && t.length < 2 && (0, et.jsx)(rW, {}), "chat" === p && t.length < 2 && (0, et.jsx)(rq, {}), "default" === p && t.length < 2 && (0, et.jsx)(rz, {}), t.map(function(e, t) { | |
var d = e.siblings, | |
p = e.type, | |
u = e.parentId; | |
return u ? (0, et.jsx)(ry, { | |
type: p, | |
parentId: u, | |
itemInViewId: l[t], | |
siblings: d, | |
onChangeItemInView: r, | |
onCreateNewNode: n, | |
onUpdateNode: o, | |
onChangeRating: a, | |
onDeleteNode: i, | |
onRequestCompletion: s, | |
activeRequests: c | |
}, "".concat(u, "-").concat(t)) : null | |
}), (0, et.jsx)(rK, {})] | |
}), d && (0, et.jsx)(rS, { | |
className: "mx-auto mt-4" | |
}), !h && (0, et.jsx)(rQ, { | |
onClick: u, | |
children: (0, et.jsx)(en.ZP, { | |
icon: P.tv1, | |
className: "m-1" | |
}) | |
})] | |
}) | |
} | |
var rX = u.ZP.div.withConfig({ | |
displayName: "ThreadLayout__NodeWrapper", | |
componentId: "sc-wfs93o-0" | |
})({ | |
display: "flex", | |
height: "100%", | |
flexDirection: "column", | |
alignItems: "center", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem", | |
".dark &": { | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(52 53 65 / var(--tw-bg-opacity))" | |
} | |
}), | |
rK = u.ZP.div.withConfig({ | |
displayName: "ThreadLayout__BottomSpacer", | |
componentId: "sc-wfs93o-1" | |
})({ | |
height: "12rem", | |
width: "100%", | |
flexShrink: "0" | |
}), | |
rQ = u.ZP.button.withConfig({ | |
displayName: "ThreadLayout__ScrollButton", | |
componentId: "sc-wfs93o-2" | |
})({ | |
position: "absolute", | |
right: "1.5rem", | |
bottom: "140px", | |
zIndex: "10", | |
cursor: "pointer", | |
borderRadius: "9999px", | |
borderWidth: "1px", | |
"--tw-border-opacity": "1", | |
borderColor: "rgb(217 217 227 / var(--tw-border-opacity))", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(247 247 248 / var(--tw-bg-opacity))", | |
"--tw-text-opacity": "1", | |
color: "rgb(86 88 105 / var(--tw-text-opacity))", | |
".dark &": { | |
borderColor: "rgb(255 255 255 / 0.1)", | |
backgroundColor: "rgb(255 255 255 / 0.1)", | |
"--tw-text-opacity": "1", | |
color: "rgb(217 217 227 / var(--tw-text-opacity))" | |
}, | |
"@media (min-width: 768px)": { | |
bottom: "132px" | |
} | |
}), | |
r$ = /(<\|endoftext\|>)|(<\|endofprompt\|>)|(<\|endofprefix\|>)/g; | |
function r0(e) { | |
var t = e.lastPrompt, | |
r = e.lastQueryDataResult, | |
n = e.fullText, | |
o = (0, k.useCallback)(function(e) { | |
return "".concat(t.prefix || "").concat(e).concat(r || "").concat(t.prompt).concat(t.turnSeparator) | |
}, [t.prefix, t.prompt, t.turnSeparator, r]), | |
a = (0, k.useMemo)(function() { | |
var e = (n || o("<|endofprefix|>")).split(r$), | |
r = [], | |
a = Boolean(!t.prefix); | |
return e.forEach(function(e, t) { | |
e && (e.match(r$) ? "<|endofprefix|>" === e ? a = !0 : r.push((0, et.jsx)("span", { | |
className: "text-gray-400", | |
children: e | |
}, "piece-".concat(t))) : r.push((0, et.jsx)("span", { | |
className: a ? "" : "text-gray-400", | |
children: e | |
}, "piece-".concat(t)))) | |
}), r | |
}, [n, o, t.prefix]), | |
i = (0, k.useCallback)(function() { | |
navigator.clipboard.writeText(n || o("")) | |
}, [n, o]); | |
return (0, et.jsx)(et.Fragment, { | |
children: (0, et.jsxs)(r1, { | |
children: [(0, et.jsxs)(rr, { | |
children: ["Last prompt request", (0, et.jsx)(r2, { | |
children: (0, et.jsx)(t9, { | |
label: (0, et.jsx)(t8, { | |
text: "Copy thread to clipboard" | |
}), | |
children: (0, et.jsx)(ro, { | |
onCopy: i | |
}) | |
}) | |
})] | |
}), (0, et.jsx)(r5, { | |
children: a | |
})] | |
}) | |
}) | |
} | |
var r1 = u.ZP.div.withConfig({ | |
displayName: "DebugSidebar__DebugWrapper", | |
componentId: "sc-rq8gxd-0" | |
})({ | |
height: "100%", | |
overflowY: "auto" | |
}), | |
r5 = u.ZP.pre.withConfig({ | |
displayName: "DebugSidebar__DebugSection", | |
componentId: "sc-rq8gxd-1" | |
})({ | |
whiteSpace: "pre-wrap", | |
padding: "1.5rem", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem" | |
}), | |
r2 = u.ZP.div.withConfig({ | |
displayName: "DebugSidebar__PositionCopyButton", | |
componentId: "sc-rq8gxd-2" | |
})({ | |
position: "absolute", | |
top: "50%", | |
right: "1.5rem", | |
"--tw-translate-y": "-50%", | |
transform: "translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))" | |
}), | |
r3 = r(30331), | |
r7 = r(65045), | |
r6 = r(89678), | |
r4 = r.n(r6), | |
r8 = /^\n+/; | |
function r9(e) { | |
var t = RegExp(r8, "gm"); | |
return t.test(e), { | |
found: 0 !== t.lastIndex, | |
result: e.substring(t.lastIndex) | |
} | |
} | |
var ne = [/\bnigger\w*/i, /\bfaggot\w*/i, /\bkike\w*/i, /\bdykes?\b/i, /\bwetbacks?\b/i, /\bchinks?\b/i, /\bgooks?\b/i, /\bpakis?\b/i, /\binjuns?\b/i, /\btrannys?\b/i, /\btrannies\b/i, /\bspicks?\b/i, /\bshemales?\b/i]; | |
function nt(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function nr(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? nt(Object(r), !0).forEach(function(t) { | |
(0, i.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : nt(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
function nn(e) { | |
var t = function(e, t) { | |
if ("object" != typeof e || null === e) return e; | |
var r = e[Symbol.toPrimitive]; | |
if (void 0 !== r) { | |
var n = r.call(e, t || "default"); | |
if ("object" != typeof n) return n; | |
throw TypeError("@@toPrimitive must return a primitive value.") | |
} | |
return ("string" === t ? String : Number)(e) | |
}(e, "string"); | |
return "symbol" == typeof t ? t : String(t) | |
} | |
var no = v()(function() { | |
return Promise.resolve().then(r.bind(r, 46939)) | |
}, { | |
ssr: !1, | |
loadableGenerated: { | |
webpack: function() { | |
return [46939] | |
} | |
} | |
}), | |
na = function(e) { | |
var t, r, n, o, a, d, u, g, b, v, y, Z, A, M, F, L, ei, es, ec, el, ed, ep, eu, eh, eg, ex, ey, ej, ek, eC, eP, eO, eT, eS, eN, eI = e.contextName, | |
eZ = e.initialCurrentLeafId, | |
e_ = e.initialTree, | |
eE = e.threadId, | |
eD = e.paletteFeatures, | |
eB = e.features, | |
eR = e.pages, | |
eA = (0, x.useRouter)(), | |
eq = (0, k.useContext)(I.y).id, | |
eM = (0, O.WS)(), | |
ez = (0, k.useState)("programming" === eq ? _ : ""), | |
eF = ez[0], | |
eW = ez[1], | |
eL = (0, k.useState)(!1), | |
eH = eL[0], | |
eU = eL[1], | |
eJ = (0, k.useState)(""), | |
eG = eJ[0], | |
eV = eJ[1], | |
eY = (0, k.useState)(), | |
eX = eY[0], | |
eK = eY[1], | |
eQ = (0, k.useState)(), | |
e$ = eQ[0], | |
e0 = eQ[1], | |
e1 = (0, k.useRef)(null), | |
e5 = (0, k.useState)(!1), | |
e2 = e5[0], | |
e3 = e5[1], | |
e7 = (r = (t = { | |
exempt: !1, | |
onRestrictedTermFound: (0, k.useCallback)(function(e) { | |
e3(!0), eM(T.s6.promptUsedRestrictedWords, { | |
content: e | |
}) | |
}, [eM]) | |
}).exempt, n = t.onRestrictedTermFound, a = (o = (0, k.useState)(!1))[0], d = o[1], { | |
hasRestrictedTerms: a, | |
checkRestrictedTerms: (0, k.useCallback)(function(e) { | |
var t; | |
return (ne.some(function(r) { | |
var n = r.exec(e); | |
return n && (t = n[0]), n | |
}), !r && t) ? (d(!0), null == n || n(t), !0) : (d(!1), !1) | |
}, [r, n]) | |
}), | |
e6 = e7.hasRestrictedTerms, | |
e4 = e7.checkRestrictedTerms, | |
e8 = (0, k.useState)(!0), | |
e9 = e8[0], | |
te = e8[1], | |
tt = (0, k.useState)(!1), | |
tr = tt[0], | |
tn = tt[1], | |
to = (0, k.useState)(!1), | |
ta = to[0], | |
ti = to[1], | |
ts = (u = (0, em.useSession)().data, b = (g = (0, k.useState)([{ | |
id: "text-davinci-002-render", | |
type: "default", | |
eopToken: "", | |
maxTokens: 4097 | |
}]))[0], v = g[1], (0, k.useEffect)(function() { | |
null != u && u.accessToken && N.ZP.getModels(null == u ? void 0 : u.accessToken).then(function(e) { | |
v(e.models.map(function(e) { | |
var t = e.is_special ? "■" : r7.QZ, | |
r = (0, r7.hY)(e.slug) ? "" : t; | |
return { | |
id: e.slug, | |
type: e.is_special ? "special" : "default", | |
eopToken: r, | |
maxTokens: e.max_tokens | |
} | |
}).sort(function(e, t) { | |
return t.type.localeCompare(e.type) || e.id.localeCompare(t.id) | |
})) | |
}).catch(function(e) { | |
try { | |
r3.Tb(e) | |
} catch (t) {} | |
}) | |
}, [null == u ? void 0 : u.accessToken]), (0, k.useMemo)(function() { | |
return { | |
availableModels: b | |
} | |
}, [b])).availableModels, | |
tc = (0, r7.ZP)(ts), | |
tl = tc.temperature, | |
td = tc.maxTokens, | |
tp = tc.modelBackend, | |
tu = tc.modelIsSpecial, | |
tm = tc.endOfPromptToken, | |
th = tc.onChangeModelSetting, | |
tf = (0, k.useMemo)(function() { | |
return tu ? D : E | |
}, [tu]), | |
tg = (0, k.useMemo)(function() { | |
var e = { | |
model: tp || "", | |
url: "".concat("https://chat.openai.com/backend-api", "/").concat((0, r7.hY)(tp) ? "conversation" : "completions"), | |
appId: "programming" === eq ? "codeqa" : "" | |
}; | |
if ("public" === eI) { | |
var t = (0, ea.Jw)(tp || "") ? tp : "custom"; | |
e.url = "".concat("https://api.openai.com", "/v1/engines/").concat(t, "/completions") | |
} | |
return e | |
}, [eq, eI, tp]), | |
tw = (0, k.useRef)(eE ? "" + eE : ""), | |
tb = (0, k.useRef)(e_ ? function(e) { | |
try { | |
var t = {}; | |
return Object.entries(e).forEach(function(e) { | |
var r = (0, R.Z)(e, 2), | |
n = r[0], | |
o = r[1]; | |
t[n] = W(W({}, o), {}, { | |
children: new Set(o.children) | |
}) | |
}), t | |
} catch (r) { | |
console.log(r) | |
} | |
return Y() | |
}(e_) : Y()), | |
tv = (0, k.useState)(eZ || "root"), | |
tx = tv[0], | |
ty = tv[1], | |
tj = (0, k.useState)(null), | |
tk = tj[0], | |
tC = tj[1], | |
tP = (0, k.useState)({}), | |
tO = tP[0], | |
tT = tP[1], | |
tS = (0, k.useState)(new Set), | |
tN = tS[0], | |
tI = tS[1], | |
tZ = (0, k.useCallback)(function(e, t) { | |
var r = t.isContinue, | |
n = void 0 !== r && r, | |
o = "", | |
a = H(tb.current, e), | |
i = new Set; | |
a.forEach(function(e, t) { | |
if (e.type !== S.Jq.Root) { | |
null !== (r = e.metadata) && void 0 !== r && r.artifacts && (0, l.Z)(e.metadata.artifacts).forEach(function(e) { | |
return i.add(e) | |
}); | |
var r, s = K(e); | |
if (t === a.length - 1 && n) return o += s; | |
var c, d = tf(tm), | |
p = d.turnSeparator, | |
u = (0, d.preProcessInput)(s, e.type === S.Jq.Completion || e.type === S.Jq.EditedCompletion ? "Assistant" : "User"); | |
return o += p + u | |
} | |
}); | |
var s = tf(tm), | |
c = s.processPrefix, | |
d = s.turnSeparator, | |
p = s.promptSuffix, | |
u = s.preProcessRetrieval; | |
return { | |
prefix: c(eF), | |
prompt: o, | |
artifacts: i, | |
turnSeparator: d, | |
promptSuffix: p, | |
preProcessRetrieval: u | |
} | |
}, [tm, tf, eF]), | |
t_ = (0, k.useCallback)(function(e) { | |
tT(function(t) { | |
return t[e], (0, c.Z)(t, [e].map(nn)) | |
}) | |
}, []), | |
tD = (0, k.useCallback)((y = (0, s.Z)(p().mark(function e(t) { | |
var r, n; | |
return p().wrap(function(e) { | |
for (;;) switch (e.prev = e.next) { | |
case 0: | |
if (eB.has("history")) { | |
e.next = 2; | |
break | |
} | |
return e.abrupt("return"); | |
case 2: | |
if (r = X(tb.current), !("root" === tx && !tw.current)) { | |
e.next = 11; | |
break | |
} | |
return tw.current = "pending", e.next = 7, N.ZP.createThread("", { | |
content: { | |
tree: r, | |
currentLeafId: "root" | |
}, | |
artifacts: [], | |
clientId: "librarian" | |
}); | |
case 7: | |
null != (n = e.sent) && n.id ? tw.current = n.id : console.error(n), e.next = 14; | |
break; | |
case 11: | |
if (!("pending" !== tw.current)) { | |
e.next = 14; | |
break | |
} | |
return e.next = 14, N.ZP.updateThread("", tw.current, { | |
content: { | |
tree: r, | |
currentLeafId: t | |
}, | |
artifacts: [], | |
clientId: "librarian", | |
id: tw.current | |
}); | |
case 14: | |
case "end": | |
return e.stop() | |
} | |
}, e) | |
})), function(e) { | |
return y.apply(this, arguments) | |
}), [tx, eB]), | |
tB = (Z = tw, A = tb, ed = (0, k.useId)(), ep = (0, O.WS)(), eh = (eu = (0, r7.ZP)(ts)).temperature, eg = eu.endOfPromptToken, ex = eu.modelBackend, ey = eu.maxTokens, ek = (ej = (0, k.useState)(0))[0], eC = ej[1], eP = (0, k.useRef)({}), eO = (0, k.useRef)(!1), eT = (0, k.useCallback)(function(e, t, r) { | |
var n = r.completionPrefix, | |
o = r.eventSource, | |
a = "CompletionUpdated:".concat(t), | |
i = A.current[t].parentId, | |
c = !0, | |
l = !n, | |
d = n || "", | |
u = d, | |
m = !1, | |
h = !1; | |
function f() { | |
setTimeout(function() { | |
t_(t), tI(function(e) { | |
var r = new Set(e); | |
return r.delete(t), r | |
}), delete eP.current[t], eO.current = !1 | |
}, 0) | |
} | |
var g, w, b = r4()(function() { | |
if (!eO.current && !m) { | |
var e = V(A.current || {}, t, { | |
message: { | |
content: { | |
parts: { | |
$set: [d] | |
} | |
} | |
} | |
}); | |
A.current = e, j().publish(a, { | |
text: d | |
}) | |
} | |
}, 50, { | |
leading: !0, | |
maxWait: 50 | |
}), | |
v = r4()((g = (0, s.Z)(p().mark(function e(r, n) { | |
var o, s, c, l, f, g, w, b, v = arguments; | |
return p().wrap(function(e) { | |
for (;;) switch (e.prev = e.next) { | |
case 0: | |
if (!(!(o = v.length > 2 && void 0 !== v[2] && v[2]) && d === u || m)) { | |
e.next = 5; | |
break | |
} | |
return e.abrupt("return"); | |
case 5: | |
u = d; | |
case 6: | |
return s = o ? ee(A.current, i, 3) : $(A.current, i), e.prev = 7, e.next = 10, tJ(s + "\n\n" + u, !o); | |
case 10: | |
l = (c = e.sent).isBlocked, f = c.isFlagged, l && !m ? (m = !0, g = V(A.current, t, { | |
message: { | |
content: { | |
parts: { | |
$set: [""] | |
} | |
} | |
}, | |
metadata: { | |
$set: { | |
err: "Contents may violate our content policy", | |
errCode: "content_policy", | |
errType: "danger" | |
} | |
} | |
}), A.current = g, ep(T.s6.completionBlockedByModeration, { | |
threadId: r, | |
id: n | |
}), j().publish(a, { | |
text: "Contents may violate our content policy", | |
errCode: "content_policy", | |
flag: "danger" | |
})) : f && !h && (h = !0, w = V(A.current, t, { | |
metadata: { | |
$set: tL | |
} | |
}), A.current = w, ep(T.s6.completionFlaggedByModeration, { | |
threadId: r, | |
id: n | |
}), j().publish(a, { | |
text: d, | |
errCode: "content_policy", | |
flag: "warning" | |
})), e.next = 24; | |
break; | |
case 16: | |
e.prev = 16, e.t0 = e.catch(7), m = !0, b = V(A.current, t, { | |
metadata: { | |
$set: tH | |
} | |
}), A.current = b, ep(T.s6.moderationError, { | |
content: JSON.stringify(e.t0 || "") | |
}), j().publish(a, { | |
text: "An error occured", | |
flag: "danger" | |
}), j().publish("UnrecoverableError"); | |
case 24: | |
case "end": | |
return e.stop() | |
} | |
}, e, null, [ | |
[7, 16] | |
]) | |
})), function(e, t) { | |
return g.apply(this, arguments) | |
}), 5e3, { | |
leading: !0, | |
maxWait: 5e3 | |
}); | |
return w = (0, s.Z)(p().mark(function r(n) { | |
var i, s, u, h, g, w, x, y, k, C, P; | |
return p().wrap(function(r) { | |
for (;;) switch (r.prev = r.next) { | |
case 0: | |
if (i = n.id, s = n.text, u = n.err, h = n.finish_reason, g = n.message, w = n.threadId, !((u || !s && !g) && !h)) { | |
r.next = 8; | |
break | |
} | |
return u && console.error(u), x = V(A.current || {}, t, { | |
message: { | |
content: { | |
parts: { | |
$set: [d] | |
} | |
} | |
}, | |
metadata: { | |
$set: { | |
err: null == u ? void 0 : u.message, | |
errType: "danger" | |
} | |
} | |
}), A.current = x, j().publish(a, { | |
text: (null == u ? void 0 : u.message) || "Something went wrong", | |
flag: "danger" | |
}), f(), r.abrupt("return"); | |
case 8: | |
g ? d = Q(g) : !l && s ? d += s : (k = (y = r9(s || "")).found, d += y.result, k || (l = !1)), c && (c = !1, w && (Z.current = w), P = g ? V(A.current || {}, t, { | |
message: { | |
$set: g | |
} | |
}) : V(A.current || {}, t, { | |
message: { | |
id: { | |
$set: i | |
} | |
} | |
}), A.current = P, ep(T.s6.generateCompletion, { | |
id: (null == g ? void 0 : g.id) || i || "", | |
threadId: w, | |
completionType: e, | |
eventSource: o | |
}), j().publish("PublishAborter", { | |
id: t, | |
aborter: eP.current[t] | |
})), v(Z.current, (null == g ? void 0 : g.id) || i), b(), ("stop" === h || "length" === h) && (eO.current || m || b.flush(), v(Z.current, (null == g ? void 0 : g.id) || i, !0), v.flush(), tD(t), m || j().publish(a, { | |
text: d | |
}), f()); | |
case 13: | |
case "end": | |
return r.stop() | |
} | |
}, r) | |
})), | |
function(e) { | |
return w.apply(this, arguments) | |
} | |
}, [ep, t_, tI, Z, A, tD]), (0, k.useCallback)((eS = (0, s.Z)(p().mark(function e(t, r, n, o, a) { | |
var i, s, c, l, d, u, m, h, f, g, w, b, v, x, y, k, C, P, O, I; | |
return p().wrap(function(e) { | |
for (;;) switch (e.prev = e.next) { | |
case 0: | |
if (i = r.prefix, s = r.prompt, c = r.url, l = r.tokenCount, d = r.promptSuffix, u = r.turnSeparator, m = r.preProcessRetrieval, eC(function(e) { | |
return e + 1 | |
}), h = "request-".concat(ed, "-").concat(ek), f = "CompletionUpdated:".concat(n), tI(function(e) { | |
var t = new Set(e); | |
return t.add(h), t | |
}), g = "".concat(i || "").concat(s).concat(u).concat(d), tJ(s).then(function(e) { | |
var t = e.isBlocked, | |
r = e.isFlagged; | |
if (t) { | |
var o = V(A.current || {}, n, { | |
metadata: { | |
$set: tH | |
} | |
}); | |
A.current = o, ep(T.s6.promptBlockedByModeration, { | |
threadId: Z.current, | |
id: n | |
}), eO.current = !0, j().publish(f, { | |
text: "Contents may violate our content policy", | |
errCode: "content_policy", | |
flag: "danger" | |
}) | |
} else if (r) { | |
var a = V(A.current || {}, n, { | |
metadata: { | |
$set: tL | |
} | |
}); | |
A.current = a, ep(T.s6.promptFlaggedByModeration, { | |
threadId: Z.current, | |
id: n | |
}), j().publish(f, { | |
text: Q(A.current[n].message), | |
errCode: "content_policy", | |
flag: "warning" | |
}) | |
} | |
}).catch(function(e) { | |
var t = V(A.current || {}, n, { | |
metadata: { | |
$set: { | |
err: "An error occurred", | |
errType: "danger" | |
} | |
} | |
}); | |
A.current = t, ep(T.s6.moderationError, { | |
content: JSON.stringify(e || "") | |
}), eO.current = !0, j().publish(f, { | |
text: "An error occured", | |
flag: "danger", | |
errCode: "content_policy" | |
}), j().publish("UnrecoverableError") | |
}), w = J(h, "", n, S.Jq.Completion), b = G(A.current || {}, n, w), A.current = b, tD(h), ty(h), !eH) { | |
e.next = 26; | |
break | |
} | |
return e.prev = 13, e.next = 16, N.ZP.getRetrievalResults(s); | |
case 16: | |
x = B(m, e.sent), eV(x), g = "".concat(i || "").concat(x).concat(s).concat(u).concat(d), e.next = 26; | |
break; | |
case 22: | |
e.prev = 22, e.t0 = e.catch(13), console.error(e.t0), eV(""); | |
case 26: | |
return k = [], C = A.current[n], t === S.Os.Next || t === S.Os.Variant ? (y = A.current[C.parentId].message.id, k.push(C.message)) : y = C.message.id, O = tW()(ey - l - 500, 100, Math.floor(ey / 2)), e.next = 32, N.ZP.publicApiCompletionStream({ | |
url: o.url, | |
model: ex, | |
appId: o.appId | |
}, { | |
completionType: t, | |
threadId: Z.current || void 0, | |
parentMessageId: y, | |
messages: k, | |
prompt: g, | |
url: c, | |
temperature: eh, | |
stop: [eg], | |
maxTokens: O | |
}, eT(t, h, a)); | |
case 32: | |
I = e.sent, eP.current[h] = I; | |
case 34: | |
case "end": | |
return e.stop() | |
} | |
}, e, null, [ | |
[13, 22] | |
]) | |
})), function(e, t, r, n, o) { | |
return eS.apply(this, arguments) | |
}), [ed, ek, tI, A, tD, ty, eH, ex, Z, eh, eg, ey, eT, ep, eV])), | |
tR = (0, k.useCallback)(function() { | |
eA.replace({ | |
pathname: eA.basePath, | |
query: {} | |
}, void 0, { | |
shallow: !0 | |
}) | |
}, [eA]), | |
tA = (0, k.useCallback)(function() { | |
if (tx) { | |
var e = H(tb.current, tx); | |
tT(function(t) { | |
var r = nr({}, t); | |
return e.forEach(function(e) { | |
e.id in r && (r[e.id].abort(), delete r[e.id]) | |
}), r | |
}), tI(function(t) { | |
var r = new Set(t); | |
return e.forEach(function(e) { | |
r.delete(e.id) | |
}), r | |
}) | |
} | |
}, [tx]), | |
tq = (0, k.useCallback)((eN = (0, s.Z)(p().mark(function e(t, r, n, o, a) { | |
var i; | |
return p().wrap(function(e) { | |
for (;;) switch (e.prev = e.next) { | |
case 0: | |
if (o && tA(), i = tZ(r, { | |
isContinue: t === S.Os.Continue | |
}), !e4(i.prompt)) { | |
e.next = 4; | |
break | |
} | |
return e.abrupt("return"); | |
case 4: | |
tB(t, nr(nr({}, i), {}, { | |
url: a, | |
tokenCount: 0 | |
}), r, tg, n); | |
case 5: | |
case "end": | |
return e.stop() | |
} | |
}, e) | |
})), function(e, t, r, n, o) { | |
return eN.apply(this, arguments) | |
}), [tZ, e4, tB, tg, tA]), | |
tz = (0, k.useCallback)(function(e, t, r, n, o) { | |
var a = J(e, n, t, r, o), | |
i = G(tb.current, t, a); | |
tb.current = i | |
}, []), | |
tF = (0, k.useCallback)(function(e, t, r, n) { | |
var o = t.value, | |
a = t.artifacts; | |
tz(e, tx, S.Jq.Prompt, o, a ? { | |
artifacts: a | |
} : void 0), tD(e), tq(S.Os.Next, e, r, !0, n) | |
}, [tx, tz, tq, tD]), | |
tU = (0, k.useCallback)(function(e) { | |
var t = tb.current[e].parentId || "root"; | |
tq(S.Os.Variant, t, { | |
eventSource: "mouse" | |
}, !1) | |
}, [tq]); | |
(0, k.useCallback)(function(e) { | |
var t = tb.current[e].parentId || "root"; | |
tq(S.Os.Continue, t, { | |
eventSource: "mouse" | |
}, !0) | |
}, [tq]); | |
var tG = (0, k.useCallback)(function(e) { | |
var t = U(tb.current, e); | |
ty(t.id) | |
}, []), | |
tV = (0, k.useCallback)(function(e, t) { | |
var r = V(tb.current, e, { | |
message: { | |
content: { | |
parts: { | |
$set: [t] | |
} | |
} | |
} | |
}); | |
tb.current = r | |
}, []), | |
tY = (0, k.useCallback)(function(e, t, r) { | |
eM(T.s6.thumbRating, { | |
id: t, | |
rating: r, | |
model: tp | |
}), N.ZP.submitMessageFeedback({ | |
message_id: t, | |
conversation_id: tw.current, | |
rating: r | |
}), eK(r), e0(t); | |
var n = tb.current[e].metadata, | |
o = V(tb.current, e, { | |
metadata: { | |
$set: nr(nr({}, n), {}, { | |
rating: r | |
}) | |
} | |
}); | |
tb.current = o | |
}, [eM, tp]), | |
tX = (0, k.useCallback)(function() { | |
var e, t = null === (e = e1.current) || void 0 === e ? void 0 : e.elements, | |
r = (0, l.Z)(t || []).filter(function(e) { | |
return e.checked | |
}).map(function(e) { | |
return e.id | |
}), | |
n = (null == t ? void 0 : t["feedback-other"].value) || ""; | |
eX && e$ && (n || r.length > 0) && (eM(T.s6.reportResult, { | |
id: e$, | |
content: n, | |
model: tp, | |
rating: eX, | |
tags: r | |
}), N.ZP.submitMessageFeedback({ | |
message_id: e$, | |
conversation_id: tw.current, | |
rating: eX, | |
text: n, | |
tags: r.map(function(e) { | |
return e.replace("feedback-", "") | |
}) | |
})), eK(void 0) | |
}, [eM, tp, e$, eX]), | |
tK = (0, k.useCallback)(function(e) { | |
var t, r, n, o, a, s = (n = (t = tb.current)[e], o = (0, c.Z)(t, [e].map(z)), a = n.parentId, q()(o, (0, i.Z)({}, a, { | |
children: { | |
$remove: [e] | |
} | |
}))); | |
tb.current = s | |
}, []), | |
tQ = (0, k.useCallback)(function(e) { | |
switch (null == e ? void 0 : e.state) { | |
case "pending": | |
tz("artifact", "root", S.Jq.Prompt, e.url, { | |
artifacts: [e.url] | |
}), tz("artifact-summary", "artifact", S.Jq.Completion, "loading..."), ty("artifact"), tC(e), tD("artifact"); | |
break; | |
case "success": | |
tV("artifact-summary", e.contents), ty("artifact-summary"), tC(e), tD("artifact-summary"); | |
break; | |
default: | |
tC(e) | |
} | |
}, [tz, tV, tD]), | |
t$ = (0, k.useCallback)(function() { | |
ti(function(e) { | |
return "debug" !== e && "debug" | |
}) | |
}, []), | |
t0 = (0, k.useCallback)(function() { | |
ti(function(e) { | |
return "navigation" !== e && "navigation" | |
}) | |
}, []), | |
t1 = (0, k.useCallback)(function(e, t) { | |
tT(function(e) { | |
var r = e[t], | |
n = (0, c.Z)(e, [t].map(nn)); | |
return null == r || r.abort(), n | |
}), tI(function(e) { | |
var r = new Set(e); | |
return r.delete(t), r | |
}) | |
}, []), | |
t5 = (0, k.useCallback)(function(e, t) { | |
var r = t.id, | |
n = t.aborter; | |
n && tT(function(e) { | |
return nr(nr({}, e), {}, (0, i.Z)({}, r, n)) | |
}) | |
}, []), | |
t2 = (0, k.useCallback)(function() { | |
tT(function(e) { | |
return Object.values(e).forEach(function(e) { | |
return e.abort() | |
}), {} | |
}), tI(new Set), ty("root"), tC(null), tb.current = Y(), tw.current = "", eM(T.s6.newThread) | |
}, [eM]); | |
(0, k.useCallback)(function() { | |
var e = tZ(tx, {}), | |
t = e.prompt, | |
r = e.prefix; | |
navigator.clipboard.writeText("".concat(r).concat(t)), eM(T.s6.copyToClipboard) | |
}, [tZ, tx, eM]); | |
var t3 = (0, k.useCallback)(function() { | |
tn(!0) | |
}, []); | |
(0, k.useEffect)(function() { | |
return j().subscribe("AbortCompletion", t1), j().subscribe("PublishAborter", t5), j().subscribe("UnrecoverableError", t3), | |
function() { | |
j().unsubscribe("AbortCompletion"), j().unsubscribe("PublishAborter"), j().unsubscribe("UnrecoverableError") | |
} | |
}, [t1, t5, t3]); | |
var t7 = (0, k.useMemo)(function() { | |
return new Set(Object.keys(tO)) | |
}, [tO]), | |
t6 = (0, k.useMemo)(function() { | |
return tx ? H(tb.current, tx).map(function(e) { | |
return e.id | |
}) : [] | |
}, [tx]), | |
t4 = (0, k.useMemo)(function() { | |
if (0 === Object.keys(tb.current || {}).length) return []; | |
var e = tb.current || {}, | |
t = H(e, tx || "root").reverse(), | |
r = []; | |
return t.forEach(function(t, n) { | |
var o = t.id, | |
a = t.createdAt, | |
i = t.children, | |
s = t.type, | |
c = t.parentId, | |
l = t.message, | |
d = t.metadata, | |
p = tN.has(o) && !t7.has(o), | |
u = t7.has(o); | |
r.push({ | |
siblings: [{ | |
id: o, | |
type: s, | |
depth: n, | |
streaming: u, | |
waiting: p, | |
createdAt: a, | |
message: l, | |
err: null == d ? void 0 : d.err, | |
errType: null == d ? void 0 : d.errType, | |
errCode: null == d ? void 0 : d.errCode, | |
rating: null == d ? void 0 : d.rating | |
}], | |
type: s, | |
parentId: c | |
}), i.size > 0 && n > 0 && (r[n - 1].siblings = Array.from(i).map(function(t) { | |
var r = e[t], | |
o = r.id, | |
a = r.type, | |
i = r.createdAt, | |
s = r.metadata; | |
return nr({ | |
id: o, | |
createdAt: i, | |
message: r.message, | |
type: a, | |
depth: n - 1, | |
rating: null == s ? void 0 : s.rating, | |
streaming: t7.has(o), | |
waiting: a !== S.Jq.Prompt && !S.Jq.EditedPrompt && tN.has(o) && !t7.has(o) | |
}, s) | |
})) | |
}), r.reverse() | |
}, [t7, tx, tN]), | |
t8 = (0, k.useCallback)(function() { | |
te(!0), localStorage.setItem("oai/librarian/hasSeenWarning", "true") | |
}, []), | |
t9 = (0, k.useCallback)(function() { | |
e3(!1) | |
}, []), | |
re = tZ(tx, { | |
isContinue: !1 | |
}), | |
rt = (0, k.useMemo)(function() { | |
return eB.has("debug") ? new Set([r7.G3.Model]) : new Set | |
}, [eB]); | |
return (0, et.jsxs)(ni, { | |
children: [!e9 && (0, et.jsx)(eo.Z, { | |
isOpen: !0, | |
onModalClose: t8, | |
icon: h.Z, | |
title: "Do not share sensitive materials with this application", | |
primaryButton: (0, et.jsx)(eo.m, { | |
onClick: t8, | |
title: "Acknowledge" | |
}), | |
type: "danger" | |
}, "OnboardingModal"), e6 && e2 && (0, et.jsx)(eo.Z, { | |
isOpen: !0, | |
onModalClose: t9, | |
icon: P.U0j, | |
title: "This prompt may violate our content policy.", | |
primaryButton: (0, et.jsx)(eo.m, { | |
onClick: t9, | |
title: "Acknowledge" | |
}), | |
type: "danger" | |
}, "RestrictedTerms"), Boolean(eX) && (0, et.jsx)(eo.Z, { | |
isOpen: !0, | |
onModalClose: function() { | |
return eK(void 0) | |
}, | |
type: "thumbsUp" === eX ? "success" : "danger", | |
icon: "thumbsUp" === eX ? P.fmn : P.oLd, | |
title: "Provide additional feedback", | |
primaryButton: (0, et.jsx)(eo.m, { | |
title: "Submit feedback", | |
onClick: tX | |
}), | |
children: (0, et.jsxs)("form", { | |
ref: e1, | |
children: [(0, et.jsx)(C.ZP, { | |
id: "feedback-other", | |
placeholder: "What would the ideal answer have been?", | |
rows: 3, | |
className: "w-full mt-4 mb-1 rounded-md dark:bg-gray-800 dark:focus:border-white dark:focus:ring-white" | |
}), "thumbsDown" === eX && (0, et.jsxs)(et.Fragment, { | |
children: [(0, et.jsx)(er, { | |
id: "feedback-harmful", | |
label: "This is harmful / unsafe" | |
}), (0, et.jsx)(er, { | |
id: "feedback-false", | |
label: "This isn't true" | |
}), (0, et.jsx)(er, { | |
id: "feedback-not-helpful", | |
label: "This isn't helpful" | |
})] | |
})] | |
}) | |
}, "RatingModal-".concat(e$)), (0, et.jsxs)("div", { | |
className: "flex flex-1 flex-col md:pl-52 h-full", | |
children: [(0, et.jsx)(ev, { | |
onSidebarOpen: t0 | |
}), (0, et.jsxs)(ns, { | |
className: "flex-1 ", | |
children: [(0, et.jsx)(nc, { | |
children: (0, et.jsx)(no, { | |
className: (0, f.Z)("h-full dark:bg-gray-800"), | |
followButtonClassName: "scroll-convo", | |
children: (0, et.jsx)(rY, { | |
onChangeItemInView: tG, | |
onCreateNewNode: tz, | |
onUpdateNode: tV, | |
onChangeRating: tY, | |
onDeleteNode: tK, | |
onRequestCompletion: tq, | |
nodes: t4, | |
branchesInView: t6, | |
activeRequests: tN, | |
isProcessingArtifact: (null == tk ? void 0 : tk.state) === "pending" | |
}) | |
}) | |
}), (0, et.jsxs)(nl, { | |
children: [(0, et.jsx)(tE, { | |
currentLeafId: tx, | |
queryDataEnabled: eH, | |
onToggleQueryData: eU, | |
onRequestMoreCompletions: tU, | |
onCreateNewCompletion: tF, | |
onAbortCompletion: t1, | |
isCompletionInProgress: tN.has(tx), | |
onUpdateArtifactStatus: tQ, | |
artifact: tk, | |
className: (0, f.Z)("flex flex-row stretch gap-3 mx-2 lg:mx-auto pt-2 lg:pt-6 lg:max-w-3xl last:mb-2 md:last:mb-6"), | |
canUsePalette: eD.length > 0, | |
paletteFeatures: eD, | |
placeholder: "programming" === eq ? "How do I..." : "", | |
disableInterruptions: (0, r7.hY)(tp || ""), | |
disabled: !ts.length | |
}), "chat" === eq && (0, et.jsx)("div", { | |
className: "text-xs text-black/50 dark:text-white/50 pt-2 pb-3 px-3 md:pt-3 md:pb-6 md:px-4 text-center", | |
children: "Free Research Preview: ChatGPT is optimized for dialogue. Our goal is to make AI systems more natural to interact with, and your feedback will help us improve our systems and make them safer." | |
})] | |
})] | |
})] | |
}), (0, et.jsx)(eb, { | |
onSidebarOpen: t0, | |
sidebarOpen: "navigation" === ta, | |
onOpenDebugPanel: t$, | |
onNewThread: t2, | |
pages: eR | |
}), (0, et.jsx)(ew, { | |
onOpenDebugPanel: t$, | |
onNewThread: t2, | |
pages: eR, | |
children: rt.size > 0 && (0, et.jsx)(ea.ZP, { | |
temperature: tl, | |
maxTokens: td, | |
endOfPromptToken: tm, | |
onRestoreDefaults: tR, | |
promptPrefix: eF, | |
onChangePromptPrefix: eW, | |
modelBackend: tp, | |
onChangeSetting: th, | |
position: "top-right", | |
settings: rt, | |
availableModels: ts, | |
children: (0, et.jsxs)(m.J.Button, { | |
as: ef, | |
children: [(0, et.jsx)(en.ZP, { | |
icon: P.nbt | |
}), "Settings"] | |
}) | |
}) | |
}), (0, et.jsx)(tM, { | |
icon: P.cDN, | |
title: "Debug", | |
sidebarOpen: "debug" === ta, | |
onSidebarOpen: t0, | |
children: (0, et.jsx)(r0, { | |
lastPrompt: re, | |
lastQueryDataResult: eG, | |
fullText: (0, r7.hY)(tp || "") ? $(tb.current, tx) : "" | |
}) | |
}), tr && (0, et.jsx)(eo.Z, { | |
onModalClose: w(), | |
isOpen: !0, | |
icon: h.Z, | |
title: "Something went wrong", | |
description: "We're sorry, but something went wrong. Please try again later.", | |
primaryButton: (0, et.jsx)(eo.m, { | |
onClick: function() { | |
t2(), tn(!1) | |
}, | |
title: "Reset thread" | |
}), | |
type: "danger" | |
}, "UnrecoverableErrorModal")] | |
}) | |
}, | |
ni = u.ZP.div.withConfig({ | |
displayName: "Thread__Wrapper", | |
componentId: "sc-15plnpr-0" | |
})({ | |
position: "relative", | |
height: "100%", | |
width: "100%", | |
overflow: "hidden" | |
}), | |
ns = u.ZP.main.withConfig({ | |
displayName: "Thread__Content", | |
componentId: "sc-15plnpr-1" | |
})(function() { | |
return [{ | |
position: "relative", | |
display: "flex", | |
height: "100%", | |
width: "100%", | |
flexDirection: "column", | |
alignItems: "stretch", | |
overflow: "hidden", | |
transitionProperty: "width", | |
transitionTimingFunction: "cubic-bezier(0.4, 0, 0.2, 1)", | |
transitionDuration: "150ms" | |
}] | |
}), | |
nc = u.ZP.div.withConfig({ | |
displayName: "Thread__StyledThread", | |
componentId: "sc-15plnpr-2" | |
})({ | |
flex: "1 1 0%", | |
flexGrow: "1", | |
overflow: "hidden" | |
}), | |
nl = u.ZP.div.withConfig({ | |
displayName: "Thread__PositionForm", | |
componentId: "sc-15plnpr-3" | |
})({ | |
position: "absolute", | |
bottom: "0px", | |
left: "0px", | |
width: "100%", | |
backgroundImage: "linear-gradient(180deg, rgba(255, 255, 255, 0) 13.94%, #FFFFFF 54.73%)", | |
".dark &": { | |
borderColor: "transparent", | |
backgroundImage: "linear-gradient(180deg, rgba(53, 55, 64, 0) 0%, #353740 58.85%)" | |
} | |
}), | |
nd = na | |
}, | |
67138: function(e, t, r) { | |
r.d(t, { | |
Z: function() { | |
return g | |
}, | |
P: function() { | |
return f | |
} | |
}); | |
var n = r(89925), | |
o = r(70079), | |
a = r(57076), | |
i = r(50970), | |
s = r(35250); | |
function c(e) { | |
var t = e.icon, | |
r = e.children; | |
return (0, s.jsxs)(l, { | |
children: [(0, s.jsx)(d, { | |
children: t | |
}), (0, s.jsx)(p, { | |
children: r | |
})] | |
}) | |
} | |
var l = n.ZP.div.withConfig({ | |
displayName: "shared__Wrapper", | |
componentId: "sc-12rtod5-0" | |
})({ | |
display: "flex", | |
minHeight: "71px", | |
alignItems: "center", | |
gap: "1rem", | |
borderRadius: "0.375rem", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(247 247 248 / var(--tw-bg-opacity))", | |
padding: "1rem", | |
".dark &": { | |
backgroundColor: "rgb(255 255 255 / 0.05)" | |
} | |
}), | |
d = n.ZP.div.withConfig({ | |
displayName: "shared__IconWrapper", | |
componentId: "sc-12rtod5-1" | |
})({ | |
width: "2.5rem", | |
textAlign: "center", | |
fontSize: "1.5rem", | |
lineHeight: "2rem" | |
}), | |
p = n.ZP.div.withConfig({ | |
displayName: "shared__Content", | |
componentId: "sc-12rtod5-2" | |
})({ | |
flex: "1 1 0%", | |
lineHeight: "1.25rem" | |
}); | |
function u(e) { | |
var t = e.onBack, | |
r = e.onNext, | |
n = e.onSubmit; | |
return (0, s.jsxs)(m, { | |
children: [t && (0, s.jsx)(i.z, { | |
as: "button", | |
color: "neutral", | |
onClick: t, | |
children: "Back" | |
}), r && (0, s.jsx)(i.z, { | |
as: "button", | |
onClick: r, | |
color: "neutral", | |
className: "ml-auto", | |
children: "Next" | |
}), n && (0, s.jsx)(i.z, { | |
as: "button", | |
onClick: n, | |
color: "primary", | |
className: "ml-auto", | |
children: "Done" | |
})] | |
}) | |
} | |
var m = n.ZP.div.withConfig({ | |
displayName: "shared__Buttons", | |
componentId: "sc-12rtod5-3" | |
})({ | |
marginTop: "1.5rem", | |
display: "flex", | |
gap: "1rem" | |
}), | |
h = "oai/apps/hasSeenOnboarding", | |
f = function(e) { | |
var t = (0, o.useCallback)(function() { | |
localStorage.setItem("".concat(h, "/").concat(e), "true") | |
}, [e]), | |
r = (0, o.useCallback)(function() { | |
return Boolean(!localStorage.getItem("".concat(h, "/").concat(e))) | |
}, [e]); | |
return (0, o.useMemo)(function() { | |
return { | |
setHasSeenOnboarding: t, | |
getHasSeenOnboarding: r | |
} | |
}, [r, t]) | |
}; | |
function g(e) { | |
var t = e.onClose, | |
r = f((0, o.useContext)(a.y).id).setHasSeenOnboarding, | |
n = (0, o.useState)(0), | |
i = n[0], | |
c = n[1], | |
l = (0, o.useCallback)(function() { | |
t(!0), r() | |
}, [t, r]); | |
return (0, s.jsxs)(y, { | |
children: [0 === i && (0, s.jsx)(b, { | |
onChangePage: c | |
}), 1 === i && (0, s.jsx)(v, { | |
onChangePage: c | |
}), 2 === i && (0, s.jsx)(x, { | |
onChangePage: c, | |
onSubmit: l | |
})] | |
}) | |
} | |
var w = function() { | |
var e = (0, o.useContext)(a.y), | |
t = e.id, | |
r = e.name; | |
return "chat" === t ? (0, s.jsxs)(s.Fragment, { | |
children: [(0, s.jsx)("div", { | |
className: "mb-5", | |
children: (0, s.jsx)(j, { | |
children: (0, s.jsx)("b", { | |
children: r | |
}) | |
}) | |
}), (0, s.jsx)(C, {})] | |
}) : (0, s.jsxs)(s.Fragment, { | |
children: [(0, s.jsxs)(j, { | |
children: ["Welcome to ", (0, s.jsx)("b", { | |
children: r | |
})] | |
}), (0, s.jsx)("p", { | |
children: "Here are a few things to keep in mind before we get started:" | |
}), (0, s.jsx)(C, {})] | |
}) | |
}, | |
b = function(e) { | |
var t = e.onChangePage; | |
return "chat" === (0, o.useContext)(a.y).id ? (0, s.jsxs)(s.Fragment, { | |
children: [(0, s.jsx)(w, {}), (0, s.jsx)(k, { | |
children: "This is a free research preview." | |
}), (0, s.jsxs)(P, { | |
children: [(0, s.jsx)(c, { | |
icon: "\uD83D\uDD2C", | |
children: "Our goal is to get external feedback in order to improve our systems and make them safer." | |
}), (0, s.jsx)(c, { | |
icon: "\uD83D\uDEA8", | |
children: "While we have safeguards in place, the system may occasionally generate incorrect or misleading information and produce offensive or biased content. It is not intended to give advice." | |
})] | |
}), (0, s.jsx)(u, { | |
onNext: function() { | |
return t(1) | |
} | |
})] | |
}) : (0, s.jsxs)(s.Fragment, { | |
children: [(0, s.jsx)(w, {}), (0, s.jsx)(k, { | |
children: "Confidentiality" | |
}), (0, s.jsxs)(P, { | |
children: [(0, s.jsx)(c, { | |
icon: "\uD83E\uDD2B", | |
children: "This private preview is strictly for testing purposes only" | |
}), (0, s.jsxs)(c, { | |
icon: "\uD83D\uDCC3", | |
children: ["Please do not share info about this product with anyone. Use of this product is subject to our", " ", (0, s.jsx)("a", { | |
href: "https://openai.com/api/policies/terms/", | |
target: "_blank", | |
rel: "noreferrer", | |
children: "Terms of Service" | |
})] | |
})] | |
}), (0, s.jsx)(u, { | |
onNext: function() { | |
return t(1) | |
} | |
})] | |
}) | |
}, | |
v = function(e) { | |
var t = e.onChangePage, | |
r = (0, o.useContext)(a.y).id; | |
return (0, s.jsxs)(s.Fragment, { | |
children: [(0, s.jsx)(w, {}), (0, s.jsx)(k, { | |
children: "How we collect data" | |
}), (0, s.jsxs)(P, { | |
children: [(0, s.jsx)(c, { | |
icon: "\uD83E\uDDBE", | |
children: "Conversations may be reviewed by our AI trainers to improve our systems." | |
}), (0, s.jsx)(c, { | |
icon: "\uD83D\uDD10", | |
children: "Please don't share any sensitive information in your conversations." | |
})] | |
}), "chat" !== r && (0, s.jsx)(O, { | |
children: "If you think you've mentioned sensitive information, please reach out to [email protected]" | |
}), (0, s.jsx)(u, { | |
onBack: function() { | |
return t(0) | |
}, | |
onNext: function() { | |
return t(2) | |
} | |
})] | |
}) | |
}, | |
x = function(e) { | |
var t = e.onChangePage, | |
r = e.onSubmit, | |
n = (0, o.useContext)(a.y).id, | |
i = (0, o.useRef)(null); | |
return (0, s.jsxs)(s.Fragment, { | |
children: [(0, s.jsx)(w, {}), (0, s.jsx)(k, { | |
children: "We'd love your feedback!" | |
}), (0, s.jsxs)(P, { | |
children: [(0, s.jsx)(c, { | |
icon: "\uD83D\uDC4D", | |
children: "This system is optimized for dialogue. Let us know if a particular response was good or unhelpful." | |
}), (0, s.jsx)(c, { | |
icon: "\uD83D\uDCAC", | |
children: "chat" === n ? (0, s.jsxs)(s.Fragment, { | |
children: ["Share your feedback in our", " ", (0, s.jsx)("a", { | |
href: "https://discord.gg/openai", | |
target: "_blank", | |
rel: "noreferrer", | |
children: "Discord server" | |
}), "."] | |
}) : "Share your ideas and feedback with us directly" | |
})] | |
}), (0, s.jsx)(u, { | |
onBack: function() { | |
return t(1) | |
}, | |
onSubmit: function() { | |
return null == r ? void 0 : r(i) | |
} | |
})] | |
}) | |
}, | |
y = n.ZP.div.withConfig({ | |
displayName: "onboarding__Wrapper", | |
componentId: "sc-wcsa52-0" | |
})({ | |
color: "var(--tw-prose-body)", | |
maxWidth: "65ch", | |
'& :where([class~="lead"]):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-lead)", | |
fontSize: "1.25em", | |
lineHeight: "1.6", | |
marginTop: "1.2em", | |
marginBottom: "1.2em" | |
}, | |
'& :where(a):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-links)", | |
textDecoration: "underline", | |
fontWeight: "500" | |
}, | |
'& :where(strong):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-bold)", | |
fontWeight: "600" | |
}, | |
'& :where(a strong):not(:where([class~="not-prose"] *))': { | |
color: "inherit" | |
}, | |
'& :where(blockquote strong):not(:where([class~="not-prose"] *))': { | |
color: "inherit" | |
}, | |
'& :where(thead th strong):not(:where([class~="not-prose"] *))': { | |
color: "inherit" | |
}, | |
'& :where(ol):not(:where([class~="not-prose"] *))': { | |
listStyleType: "decimal", | |
marginTop: "1.25em", | |
marginBottom: "1.25em", | |
paddingLeft: "1.625em" | |
}, | |
'& :where(ol[type="A"]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "upper-alpha" | |
}, | |
'& :where(ol[type="a"]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "lower-alpha" | |
}, | |
'& :where(ol[type="A" s]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "upper-alpha" | |
}, | |
'& :where(ol[type="a" s]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "lower-alpha" | |
}, | |
'& :where(ol[type="I"]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "upper-roman" | |
}, | |
'& :where(ol[type="i"]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "lower-roman" | |
}, | |
'& :where(ol[type="I" s]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "upper-roman" | |
}, | |
'& :where(ol[type="i" s]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "lower-roman" | |
}, | |
'& :where(ol[type="1"]):not(:where([class~="not-prose"] *))': { | |
listStyleType: "decimal" | |
}, | |
'& :where(ul):not(:where([class~="not-prose"] *))': { | |
listStyleType: "disc", | |
marginTop: "1.25em", | |
marginBottom: "1.25em", | |
paddingLeft: "1.625em" | |
}, | |
'& :where(ol > li):not(:where([class~="not-prose"] *))::marker': { | |
fontWeight: "400", | |
color: "var(--tw-prose-counters)" | |
}, | |
'& :where(ul > li):not(:where([class~="not-prose"] *))::marker': { | |
color: "var(--tw-prose-bullets)" | |
}, | |
'& :where(hr):not(:where([class~="not-prose"] *))': { | |
borderColor: "var(--tw-prose-hr)", | |
borderTopWidth: "1px", | |
marginTop: "3em", | |
marginBottom: "3em" | |
}, | |
'& :where(blockquote):not(:where([class~="not-prose"] *))': { | |
fontWeight: "500", | |
fontStyle: "normal", | |
color: "var(--tw-prose-quotes)", | |
borderLeftWidth: "0.25rem", | |
borderLeftColor: "var(--tw-prose-quote-borders)", | |
quotes: '"\\201C""\\201D""\\2018""\\2019"', | |
marginTop: "1.6em", | |
marginBottom: "1.6em", | |
paddingLeft: "1em" | |
}, | |
'& :where(blockquote p:first-of-type):not(:where([class~="not-prose"] *))::before': { | |
content: "open-quote" | |
}, | |
'& :where(blockquote p:last-of-type):not(:where([class~="not-prose"] *))::after': { | |
content: "close-quote" | |
}, | |
'& :where(h1):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-headings)", | |
fontWeight: "800", | |
fontSize: "2.25em", | |
marginTop: "0", | |
marginBottom: "0.8888889em", | |
lineHeight: "1.1111111" | |
}, | |
'& :where(h1 strong):not(:where([class~="not-prose"] *))': { | |
fontWeight: "900", | |
color: "inherit" | |
}, | |
'& :where(h2):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-headings)", | |
fontWeight: "700", | |
fontSize: "1.5em", | |
marginTop: "2em", | |
marginBottom: "1em", | |
lineHeight: "1.3333333" | |
}, | |
'& :where(h2 strong):not(:where([class~="not-prose"] *))': { | |
fontWeight: "800", | |
color: "inherit" | |
}, | |
'& :where(h3):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-headings)", | |
fontWeight: "600", | |
fontSize: "1.25em", | |
marginTop: "1.6em", | |
marginBottom: "0.6em", | |
lineHeight: "1.6" | |
}, | |
'& :where(h3 strong):not(:where([class~="not-prose"] *))': { | |
fontWeight: "700", | |
color: "inherit" | |
}, | |
'& :where(h4):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-headings)", | |
fontWeight: "600", | |
marginTop: "1.5em", | |
marginBottom: "0.5em", | |
lineHeight: "1.5" | |
}, | |
'& :where(h4 strong):not(:where([class~="not-prose"] *))': { | |
fontWeight: "700", | |
color: "inherit" | |
}, | |
'& :where(img):not(:where([class~="not-prose"] *))': { | |
marginTop: "2em", | |
marginBottom: "2em" | |
}, | |
'& :where(figure > *):not(:where([class~="not-prose"] *))': { | |
marginTop: "0", | |
marginBottom: "0" | |
}, | |
'& :where(figcaption):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-captions)", | |
fontSize: "0.875em", | |
lineHeight: "1.4285714", | |
marginTop: "0.8571429em" | |
}, | |
'& :where(code):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-code)", | |
fontWeight: "600", | |
fontSize: "0.875em" | |
}, | |
'& :where(code):not(:where([class~="not-prose"] *))::before': { | |
content: '"`"' | |
}, | |
'& :where(code):not(:where([class~="not-prose"] *))::after': { | |
content: '"`"' | |
}, | |
'& :where(a code):not(:where([class~="not-prose"] *))': { | |
color: "inherit" | |
}, | |
'& :where(h1 code):not(:where([class~="not-prose"] *))': { | |
color: "inherit" | |
}, | |
'& :where(h2 code):not(:where([class~="not-prose"] *))': { | |
color: "inherit", | |
fontSize: "0.875em" | |
}, | |
'& :where(h3 code):not(:where([class~="not-prose"] *))': { | |
color: "inherit", | |
fontSize: "0.9em" | |
}, | |
'& :where(h4 code):not(:where([class~="not-prose"] *))': { | |
color: "inherit" | |
}, | |
'& :where(blockquote code):not(:where([class~="not-prose"] *))': { | |
color: "inherit" | |
}, | |
'& :where(thead th code):not(:where([class~="not-prose"] *))': { | |
color: "inherit" | |
}, | |
'& :where(pre):not(:where([class~="not-prose"] *))': { | |
color: "currentColor", | |
backgroundColor: "transparent", | |
overflowX: "auto", | |
fontWeight: "400", | |
fontSize: "0.875em", | |
lineHeight: "1.7142857", | |
marginTop: "1.7142857em", | |
marginBottom: "1.7142857em", | |
borderRadius: "0.375rem", | |
paddingTop: "0.8571429em", | |
paddingRight: "1.1428571em", | |
paddingBottom: "0.8571429em", | |
paddingLeft: "1.1428571em", | |
margin: "0", | |
padding: "0" | |
}, | |
'& :where(pre code):not(:where([class~="not-prose"] *))': { | |
backgroundColor: "transparent", | |
borderWidth: "0", | |
borderRadius: "0", | |
padding: "0", | |
fontWeight: "inherit", | |
color: "inherit", | |
fontSize: "inherit", | |
fontFamily: "inherit", | |
lineHeight: "inherit" | |
}, | |
'& :where(pre code):not(:where([class~="not-prose"] *))::before': { | |
content: "none" | |
}, | |
'& :where(pre code):not(:where([class~="not-prose"] *))::after': { | |
content: "none" | |
}, | |
'& :where(table):not(:where([class~="not-prose"] *))': { | |
width: "100%", | |
tableLayout: "auto", | |
textAlign: "left", | |
marginTop: "2em", | |
marginBottom: "2em", | |
fontSize: "0.875em", | |
lineHeight: "1.7142857" | |
}, | |
'& :where(thead):not(:where([class~="not-prose"] *))': { | |
borderBottomWidth: "1px", | |
borderBottomColor: "var(--tw-prose-th-borders)" | |
}, | |
'& :where(thead th):not(:where([class~="not-prose"] *))': { | |
color: "var(--tw-prose-headings)", | |
fontWeight: "600", | |
verticalAlign: "bottom", | |
paddingRight: "0.5714286em", | |
paddingBottom: "0.5714286em", | |
paddingLeft: "0.5714286em" | |
}, | |
'& :where(tbody tr):not(:where([class~="not-prose"] *))': { | |
borderBottomWidth: "1px", | |
borderBottomColor: "var(--tw-prose-td-borders)" | |
}, | |
'& :where(tbody tr:last-child):not(:where([class~="not-prose"] *))': { | |
borderBottomWidth: "0" | |
}, | |
'& :where(tbody td):not(:where([class~="not-prose"] *))': { | |
verticalAlign: "baseline" | |
}, | |
'& :where(tfoot):not(:where([class~="not-prose"] *))': { | |
borderTopWidth: "1px", | |
borderTopColor: "var(--tw-prose-th-borders)" | |
}, | |
'& :where(tfoot td):not(:where([class~="not-prose"] *))': { | |
verticalAlign: "top" | |
}, | |
"--tw-prose-body": "#374151", | |
"--tw-prose-headings": "#111827", | |
"--tw-prose-lead": "#4b5563", | |
"--tw-prose-links": "#111827", | |
"--tw-prose-bold": "#111827", | |
"--tw-prose-counters": "#6b7280", | |
"--tw-prose-bullets": "#d1d5db", | |
"--tw-prose-hr": "#e5e7eb", | |
"--tw-prose-quotes": "#111827", | |
"--tw-prose-quote-borders": "#e5e7eb", | |
"--tw-prose-captions": "#6b7280", | |
"--tw-prose-code": "#111827", | |
"--tw-prose-pre-code": "#e5e7eb", | |
"--tw-prose-pre-bg": "#1f2937", | |
"--tw-prose-th-borders": "#d1d5db", | |
"--tw-prose-td-borders": "#e5e7eb", | |
"--tw-prose-invert-body": "#d1d5db", | |
"--tw-prose-invert-headings": "#fff", | |
"--tw-prose-invert-lead": "#9ca3af", | |
"--tw-prose-invert-links": "#fff", | |
"--tw-prose-invert-bold": "#fff", | |
"--tw-prose-invert-counters": "#9ca3af", | |
"--tw-prose-invert-bullets": "#4b5563", | |
"--tw-prose-invert-hr": "#374151", | |
"--tw-prose-invert-quotes": "#f3f4f6", | |
"--tw-prose-invert-quote-borders": "#374151", | |
"--tw-prose-invert-captions": "#9ca3af", | |
"--tw-prose-invert-code": "#fff", | |
"--tw-prose-invert-pre-code": "#d1d5db", | |
"--tw-prose-invert-pre-bg": "rgb(0 0 0 / 50%)", | |
"--tw-prose-invert-th-borders": "#4b5563", | |
"--tw-prose-invert-td-borders": "#374151", | |
fontSize: "1rem", | |
lineHeight: "1.75", | |
'& :where(p):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.25em", | |
marginBottom: "1.25em" | |
}, | |
'& :where(video):not(:where([class~="not-prose"] *))': { | |
marginTop: "2em", | |
marginBottom: "2em" | |
}, | |
'& :where(figure):not(:where([class~="not-prose"] *))': { | |
marginTop: "2em", | |
marginBottom: "2em" | |
}, | |
'& :where(li):not(:where([class~="not-prose"] *))': { | |
marginTop: "0.5em", | |
marginBottom: "0.5em" | |
}, | |
'& :where(ol > li):not(:where([class~="not-prose"] *))': { | |
paddingLeft: "0.375em" | |
}, | |
'& :where(ul > li):not(:where([class~="not-prose"] *))': { | |
paddingLeft: "0.375em" | |
}, | |
'& :where(.prose > ul > li p):not(:where([class~="not-prose"] *))': { | |
marginTop: "0.75em", | |
marginBottom: "0.75em" | |
}, | |
'& :where(.prose > ul > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.25em" | |
}, | |
'& :where(.prose > ul > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.25em" | |
}, | |
'& :where(.prose > ol > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.25em" | |
}, | |
'& :where(.prose > ol > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.25em" | |
}, | |
'& :where(ul ul, ul ol, ol ul, ol ol):not(:where([class~="not-prose"] *))': { | |
marginTop: "0.75em", | |
marginBottom: "0.75em" | |
}, | |
'& :where(hr + *):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'& :where(h2 + *):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'& :where(h3 + *):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'& :where(h4 + *):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'& :where(thead th:first-child):not(:where([class~="not-prose"] *))': { | |
paddingLeft: "0" | |
}, | |
'& :where(thead th:last-child):not(:where([class~="not-prose"] *))': { | |
paddingRight: "0" | |
}, | |
'& :where(tbody td, tfoot td):not(:where([class~="not-prose"] *))': { | |
paddingTop: "0.5714286em", | |
paddingRight: "0.5714286em", | |
paddingBottom: "0.5714286em", | |
paddingLeft: "0.5714286em" | |
}, | |
'& :where(tbody td:first-child, tfoot td:first-child):not(:where([class~="not-prose"] *))': { | |
paddingLeft: "0" | |
}, | |
'& :where(tbody td:last-child, tfoot td:last-child):not(:where([class~="not-prose"] *))': { | |
paddingRight: "0" | |
}, | |
'& :where(.prose > :first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'& :where(.prose > :last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "0" | |
}, | |
'.prose-sm :where(& > ul > li p):not(:where([class~="not-prose"] *))': { | |
marginTop: "0.5714286em", | |
marginBottom: "0.5714286em" | |
}, | |
'.prose-sm :where(& > ul > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.1428571em" | |
}, | |
'.prose-sm :where(& > ul > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.1428571em" | |
}, | |
'.prose-sm :where(& > ol > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.1428571em" | |
}, | |
'.prose-sm :where(& > ol > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.1428571em" | |
}, | |
'.prose-sm :where(& > :first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'.prose-sm :where(& > :last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "0" | |
}, | |
'.prose-base :where(& > ul > li p):not(:where([class~="not-prose"] *))': { | |
marginTop: "0.75em", | |
marginBottom: "0.75em" | |
}, | |
'.prose-base :where(& > ul > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.25em" | |
}, | |
'.prose-base :where(& > ul > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.25em" | |
}, | |
'.prose-base :where(& > ol > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.25em" | |
}, | |
'.prose-base :where(& > ol > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.25em" | |
}, | |
'.prose-base :where(& > :first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'.prose-base :where(& > :last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "0" | |
}, | |
'.prose-lg :where(& > ul > li p):not(:where([class~="not-prose"] *))': { | |
marginTop: "0.8888889em", | |
marginBottom: "0.8888889em" | |
}, | |
'.prose-lg :where(& > ul > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.3333333em" | |
}, | |
'.prose-lg :where(& > ul > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.3333333em" | |
}, | |
'.prose-lg :where(& > ol > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.3333333em" | |
}, | |
'.prose-lg :where(& > ol > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.3333333em" | |
}, | |
'.prose-lg :where(& > :first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'.prose-lg :where(& > :last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "0" | |
}, | |
'.prose-xl :where(& > ul > li p):not(:where([class~="not-prose"] *))': { | |
marginTop: "0.8em", | |
marginBottom: "0.8em" | |
}, | |
'.prose-xl :where(& > ul > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.2em" | |
}, | |
'.prose-xl :where(& > ul > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.2em" | |
}, | |
'.prose-xl :where(& > ol > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.2em" | |
}, | |
'.prose-xl :where(& > ol > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.2em" | |
}, | |
'.prose-xl :where(& > :first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'.prose-xl :where(& > :last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "0" | |
}, | |
'.prose-2xl :where(& > ul > li p):not(:where([class~="not-prose"] *))': { | |
marginTop: "0.8333333em", | |
marginBottom: "0.8333333em" | |
}, | |
'.prose-2xl :where(& > ul > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.3333333em" | |
}, | |
'.prose-2xl :where(& > ul > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.3333333em" | |
}, | |
'.prose-2xl :where(& > ol > li > *:first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "1.3333333em" | |
}, | |
'.prose-2xl :where(& > ol > li > *:last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "1.3333333em" | |
}, | |
'.prose-2xl :where(& > :first-child):not(:where([class~="not-prose"] *))': { | |
marginTop: "0" | |
}, | |
'.prose-2xl :where(& > :last-child):not(:where([class~="not-prose"] *))': { | |
marginBottom: "0" | |
}, | |
".dark &": { | |
"--tw-prose-body": "var(--tw-prose-invert-body)", | |
"--tw-prose-headings": "var(--tw-prose-invert-headings)", | |
"--tw-prose-lead": "var(--tw-prose-invert-lead)", | |
"--tw-prose-links": "var(--tw-prose-invert-links)", | |
"--tw-prose-bold": "var(--tw-prose-invert-bold)", | |
"--tw-prose-counters": "var(--tw-prose-invert-counters)", | |
"--tw-prose-bullets": "var(--tw-prose-invert-bullets)", | |
"--tw-prose-hr": "var(--tw-prose-invert-hr)", | |
"--tw-prose-quotes": "var(--tw-prose-invert-quotes)", | |
"--tw-prose-quote-borders": "var(--tw-prose-invert-quote-borders)", | |
"--tw-prose-captions": "var(--tw-prose-invert-captions)", | |
"--tw-prose-code": "var(--tw-prose-invert-code)", | |
"--tw-prose-pre-code": "var(--tw-prose-invert-pre-code)", | |
"--tw-prose-pre-bg": "var(--tw-prose-invert-pre-bg)", | |
"--tw-prose-th-borders": "var(--tw-prose-invert-th-borders)", | |
"--tw-prose-td-borders": "var(--tw-prose-invert-td-borders)" | |
} | |
}), | |
j = n.ZP.h2.withConfig({ | |
displayName: "onboarding__Headline", | |
componentId: "sc-wcsa52-1" | |
})({ | |
marginTop: "1rem !important", | |
marginBottom: "0.5rem !important", | |
fontWeight: "400" | |
}), | |
k = n.ZP.h4.withConfig({ | |
displayName: "onboarding__Subtitle", | |
componentId: "sc-wcsa52-2" | |
})({ | |
marginBottom: "1rem" | |
}), | |
C = n.ZP.div.withConfig({ | |
displayName: "onboarding__Spacer", | |
componentId: "sc-wcsa52-3" | |
})({ | |
height: "1px", | |
width: "100%", | |
"--tw-bg-opacity": "1", | |
backgroundColor: "rgb(197 197 210 / var(--tw-bg-opacity))", | |
opacity: "0.2" | |
}), | |
P = n.ZP.div.withConfig({ | |
displayName: "onboarding__Notes", | |
componentId: "sc-wcsa52-4" | |
})({ | |
display: "flex", | |
flexDirection: "column", | |
gap: "1rem", | |
fontSize: "0.875rem", | |
lineHeight: "1.25rem" | |
}), | |
O = n.ZP.div.withConfig({ | |
displayName: "onboarding__Aside", | |
componentId: "sc-wcsa52-5" | |
})({ | |
marginTop: "1rem", | |
display: "flex", | |
alignItems: "center", | |
fontSize: "0.75rem", | |
lineHeight: "1.25rem" | |
}) | |
}, | |
65045: function(e, t, r) { | |
r.d(t, { | |
G3: function() { | |
return o | |
}, | |
QZ: function() { | |
return u | |
}, | |
ZP: function() { | |
return h | |
}, | |
hY: function() { | |
return m | |
} | |
}); | |
var n, o, a = r(50809), | |
i = r(64138), | |
s = r(70079), | |
c = r(57076), | |
l = r(30867); | |
function d(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function p(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? d(Object(r), !0).forEach(function(t) { | |
(0, a.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : d(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
}(n = o || (o = {})).Model = "model", n.Temperature = "temperature", n.EopToken = "endOfPromptToken", n.MaxTokens = "maxTokens", n.Context = "context"; | |
var u = "<|endofprompt|>"; | |
function m(e) { | |
return Boolean(e && e.includes("-render")) | |
} | |
function h(e) { | |
var t, r, n, d, u, h, f = (0, s.useContext)(c.y).id, | |
g = (0, i.useRouter)(), | |
w = g.query, | |
b = decodeURIComponent(w[o.Model] || ""), | |
v = (0, s.useMemo)(function() { | |
if (b || e.length) { | |
var t, r = b || (null === (t = e.find(function(e) { | |
return "programming" === f ? "special" === e.type : "chat" === f ? m(e.id) : "default" === e.type | |
})) || void 0 === t ? void 0 : t.id) || e[0].id, | |
n = (0, l.Vq)(b) ? "custom" : r; | |
return e.find(function(e) { | |
return e.id === n | |
}) | |
} | |
}, [e, f, b]), | |
x = (n = null == v ? void 0 : v.maxTokens, parseInt(w[o.MaxTokens] || "", 10) || n || 1024), | |
y = parseFloat(w[o.Temperature] || "1"), | |
j = (h = (null == v ? void 0 : v.eopToken) || "", decodeURIComponent(w[o.EopToken] || h)), | |
k = (0, s.useCallback)(function(e, t) { | |
g.replace({ | |
pathname: g.basePath, | |
query: p(p({}, w), {}, (0, a.Z)({}, e, encodeURIComponent(t))) | |
}, void 0, { | |
shallow: !0 | |
}) | |
}, [w, g]); | |
return (0, s.useMemo)(function() { | |
return { | |
temperature: y, | |
maxTokens: x, | |
modelBackend: (null == v ? void 0 : v.id) || "", | |
modelIsSpecial: (null == v ? void 0 : v.type) === "special", | |
endOfPromptToken: j, | |
onChangeModelSetting: k | |
} | |
}, [j, k, x, null == v ? void 0 : v.id, null == v ? void 0 : v.type, y]) | |
} | |
}, | |
91831: function(e, t, r) { | |
r.d(t, { | |
Z: function() { | |
return s | |
} | |
}); | |
var n = r(86986), | |
o = r(70079), | |
a = r(66740), | |
i = r(75716); | |
function s(e, t, r) { | |
var s = (0, n.useSession)().data; | |
(0, o.useEffect)(function() { | |
i.ZP.setAccessToken(r), a.ZP.setUser(t) | |
}, []), (0, o.useEffect)(function() { | |
null != s && s.accessToken && i.ZP.setAccessToken(s.accessToken), (null == s ? void 0 : s.error) === "RefreshAccessTokenError" && (console.error(s.error), window._oaiHandleSessionExpired()) | |
}, [s]), (0, o.useEffect)(function() { | |
document.title = e | |
}, [e]) | |
} | |
}, | |
75716: function(e, t, r) { | |
r.d(t, { | |
ZP: function() { | |
return S | |
} | |
}); | |
var n = r(50809), | |
o = r(95590), | |
a = r(91690), | |
i = r(44111), | |
s = r(42772), | |
c = r.n(s), | |
l = r(48879), | |
d = r(86986); | |
r(138); | |
var p = r(23827), | |
u = r(17719), | |
m = r(6359), | |
h = r(86600); | |
function f(e) { | |
var t = function() { | |
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; | |
if ("function" == typeof Proxy) return !0; | |
try { | |
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 | |
} catch (e) { | |
return !1 | |
} | |
}(); | |
return function() { | |
var r, n = (0, m.Z)(e); | |
if (t) { | |
var o = (0, m.Z)(this).constructor; | |
r = Reflect.construct(n, arguments, o) | |
} else r = n.apply(this, arguments); | |
return (0, u.Z)(this, r) | |
} | |
} | |
var g = "Something went wrong. If this issue persists please contact us through our help center at help.openai.com."; | |
function w(e) { | |
return void 0 !== e.userMessage | |
}! function(e) { | |
(0, p.Z)(r, e); | |
var t = f(r); | |
function r(e, n, o, i, s) { | |
var c; | |
return (0, a.Z)(this, r), (c = t.call(this, e)).name = "UserError", c.userMessage = e, c.status = n || 400, c.code = o, c.type = i, c.response = s, c | |
} | |
return (0, i.Z)(r) | |
}((0, h.Z)(Error)), Error, Error; | |
var b = r(30867), | |
v = r(65045); | |
function x(e) { | |
var t = function() { | |
if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; | |
if ("function" == typeof Proxy) return !0; | |
try { | |
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 | |
} catch (e) { | |
return !1 | |
} | |
}(); | |
return function() { | |
var r, n = (0, m.Z)(e); | |
if (t) { | |
var o = (0, m.Z)(this).constructor; | |
r = Reflect.construct(n, arguments, o) | |
} else r = n.apply(this, arguments); | |
return (0, u.Z)(this, r) | |
} | |
} | |
var y = function(e) { | |
(0, p.Z)(r, e); | |
var t = x(r); | |
function r(e, n, o, i) { | |
var s; | |
return (0, a.Z)(this, r), (s = t.call(this, e)).name = "UserError", s.userMessage = e, s.status = n || 400, s.code = o || null, s.type = i || null, s | |
} | |
return (0, i.Z)(r) | |
}((0, h.Z)(Error)), | |
j = function(e) { | |
(0, p.Z)(r, e); | |
var t = x(r); | |
function r() { | |
var e, n, o = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "An error occurred. If this issue persists please contact us through our help center at help.openai.com.", | |
i = arguments.length > 1 ? arguments[1] : void 0; | |
return (0, a.Z)(this, r), (e = t.call(this, (n = o, n && (n.startsWith("Rate limit reached for") || n.startsWith("End-user exceeded rate-limit")) ? "We're sorry, but we limit the number of requests one user can make in a certain timeframe. Please hang tight and try again in a little while." : n))).name = "FatalError", e.type = i || null, e | |
} | |
return (0, i.Z)(r) | |
}((0, h.Z)(Error)), | |
k = r(91320); | |
function C(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function P(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? C(Object(r), !0).forEach(function(t) { | |
(0, n.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : C(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var O = "https://chat.openai.com/backend-api", | |
T = function() { | |
var e, t; | |
function r() { | |
(0, a.Z)(this, r) | |
} | |
return (0, i.Z)(r, null, [{ | |
key: "setAccessToken", | |
value: function(e) { | |
this.accessToken = e | |
} | |
}, { | |
key: "getAuthHeader", | |
value: function(e) { | |
return { | |
Authorization: "Bearer ".concat(e || this.accessToken) | |
} | |
} | |
}, { | |
key: "refreshApiKey", | |
value: function() { | |
var e = this; | |
return this.apiKeyRefreshing || (this.apiKeyRefreshing = (0, o.Z)(c().mark(function t() { | |
var r; | |
return c().wrap(function(t) { | |
for (;;) switch (t.prev = t.next) { | |
case 0: | |
return t.next = 3, (0, d.getSession)(); | |
case 3: | |
return (r = t.sent) && e.setAccessToken(r.accessToken), t.abrupt("return"); | |
case 8: | |
throw Error("Cannot refresh access token outside of browser"); | |
case 9: | |
case "end": | |
return t.stop() | |
} | |
}, t) | |
}))(), setTimeout(function() { | |
e.apiKeyRefreshing = null | |
}, 6e4)), this.apiKeyRefreshing | |
} | |
}, { | |
key: "fetch", | |
value: function(e) { | |
function t(t, r) { | |
return e.apply(this, arguments) | |
} | |
return t.toString = function() { | |
return e.toString() | |
}, t | |
}((e = (0, o.Z)(c().mark(function e(t, r) { | |
var n, o, a, i, s = arguments; | |
return c().wrap(function(e) { | |
for (;;) switch (e.prev = e.next) { | |
case 0: | |
return n = s.length > 2 && void 0 !== s[2] ? s[2] : {}, e.next = 3, fetch(t, r); | |
case 3: | |
if (!((o = e.sent).status >= 500)) { | |
e.next = 6; | |
break | |
} | |
throw new j; | |
case 6: | |
if (!(o.status >= 400)) { | |
e.next = 27; | |
break | |
} | |
return e.next = 9, o.json(); | |
case 9: | |
if (i = (null == (a = e.sent) ? void 0 : a.detail) || (null == a ? void 0 : a.error), console.error("API error", i), !((null == i ? void 0 : i.code) === "expired_session_key" || (null == i ? void 0 : i.code) === "token_expired")) { | |
e.next = 24; | |
break | |
} | |
if (e.prev = 13, n.isRetry) { | |
e.next = 18; | |
break | |
} | |
return e.next = 17, this.refreshApiKey(); | |
case 17: | |
return e.abrupt("return", this.fetch(t, r, P(P({}, n), {}, { | |
isRetry: !0 | |
}))); | |
case 18: | |
e.next = 23; | |
break; | |
case 20: | |
e.prev = 20, e.t0 = e.catch(13), console.error("Failed to refresh expired access token: ".concat(e.t0)); | |
case 23: | |
window._oaiHandleSessionExpired(); | |
case 24: | |
if (!(null != i && i.type)) { | |
e.next = 26; | |
break | |
} | |
throw new y((null == i ? void 0 : i.message) || i, o.status, null == i ? void 0 : i.code, null == i ? void 0 : i.type); | |
case 26: | |
throw new j; | |
case 27: | |
if (204 !== o.status) { | |
e.next = 29; | |
break | |
} | |
return e.abrupt("return", {}); | |
case 29: | |
return e.abrupt("return", o.json()); | |
case 30: | |
case "end": | |
return e.stop() | |
} | |
}, e, this, [ | |
[13, 20] | |
]) | |
})), function(t, r) { | |
return e.apply(this, arguments) | |
})) | |
}, { | |
key: "getThreads", | |
value: function() { | |
return this.fetch("".concat(O, "/threads"), { | |
method: "GET", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()) | |
}) | |
} | |
}, { | |
key: "getThread", | |
value: function(e, t) { | |
return this.fetch("".concat(O, "/threads/").concat(t), { | |
method: "GET", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()) | |
}) | |
} | |
}, { | |
key: "createThread", | |
value: function(e, t) { | |
return this.fetch("".concat(O, "/threads"), { | |
method: "POST", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()), | |
body: JSON.stringify(t) | |
}) | |
} | |
}, { | |
key: "updateThread", | |
value: function(e, t, r) { | |
return this.fetch("".concat(O, "/threads/").concat(t), { | |
method: "PUT", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()), | |
body: JSON.stringify(r) | |
}) | |
} | |
}, { | |
key: "getArtifacts", | |
value: function() { | |
return this.fetch("".concat(O, "/artifacts"), { | |
method: "GET", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()) | |
}) | |
} | |
}, { | |
key: "createArtifact", | |
value: function(e) { | |
return this.fetch("".concat(O, "/artifacts"), { | |
method: "POST", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()), | |
body: JSON.stringify({ | |
url: e, | |
contents: "\n" | |
}) | |
}) | |
} | |
}, { | |
key: "sendDocument", | |
value: function() { | |
return this.fetch("".concat(O, "/private"), { | |
method: "GET", | |
headers: { | |
"Content-Type": "application/json" | |
} | |
}) | |
} | |
}, { | |
key: "getRetrievalResults", | |
value: function(e) { | |
return this.fetch("".concat(O, "/retrieval/public_data"), { | |
method: "POST", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()), | |
body: JSON.stringify({ | |
query: e | |
}) | |
}) | |
} | |
}, { | |
key: "getModels", | |
value: function(e) { | |
return this.fetch("".concat(O, "/models"), { | |
method: "GET", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader(e)) | |
}) | |
} | |
}, { | |
key: "getServiceMessaging", | |
value: function() { | |
var e = "false" === k.env.BLOCK_LOGIN, | |
t = this.fetch("".concat("https://chat.openai.com/public-api/status"), { | |
method: "GET", | |
headers: { | |
"Content-Type": "application/json" | |
} | |
}); | |
return e ? P(P({}, t), {}, { | |
oof: !1 | |
}) : t | |
} | |
}, { | |
key: "publicApiCompletionStream", | |
value: (t = (0, o.Z)(c().mark(function e(t, r, n) { | |
var a, i, s, d; | |
return c().wrap(function(e) { | |
for (;;) switch (e.prev = e.next) { | |
case 0: | |
return a = new AbortController, i = t.url.startsWith("https://api.openai.com") ? { | |
prompt: r.prompt || "", | |
max_tokens: r.maxTokens, | |
temperature: r.temperature, | |
stop: r.stop || [""], | |
stream: !0 | |
} : (0, v.hY)(t.model) ? { | |
action: r.completionType, | |
messages: r.messages, | |
conversation_id: r.threadId, | |
parent_message_id: r.parentMessageId, | |
model: t.model | |
} : { | |
query: r.prompt || "", | |
url: r.url, | |
max_tokens: r.maxTokens, | |
temperature: r.temperature, | |
stop: r.stop || [""], | |
stream: !0, | |
model: t.model | |
}, s = (0, b.Vq)(t.model) ? { | |
"X-OpenAI-Preferred-Model-Url": t.url || "", | |
Authorization: "Bearer 1" | |
} : void 0, (0, l.L)(t.url, { | |
method: "POST", | |
headers: P(P({ | |
"Content-Type": "application/json", | |
"X-OpenAI-Assistant-App-Id": t.appId || "" | |
}, this.getAuthHeader()), s), | |
body: JSON.stringify(i), | |
signal: a.signal, | |
openWhenHidden: !0, | |
onopen: function(e) { | |
return (0, o.Z)(c().mark(function t() { | |
var r, n, o; | |
return c().wrap(function(t) { | |
for (;;) switch (t.prev = t.next) { | |
case 0: | |
if (r = e.headers.get("content-type") || "", !(e.ok && r.includes("text/event-stream"))) { | |
t.next = 3; | |
break | |
} | |
return t.abrupt("return"); | |
case 3: | |
if (!r.includes("application/json")) { | |
t.next = 16; | |
break | |
} | |
return t.next = 6, e.json(); | |
case 6: | |
if (n = t.sent, console.error(n), !(o = (null == n ? void 0 : n.error) || (null == n ? void 0 : n.detail))) { | |
t.next = 16; | |
break | |
} | |
if (!(e.status >= 500)) { | |
t.next = 14; | |
break | |
} | |
throw new j((null == o ? void 0 : o.message) || o); | |
case 14: | |
throw ((null == o ? void 0 : o.code) === "expired_session_key" || (null == o ? void 0 : o.code) === "invalid_api_key" || (null == o ? void 0 : o.code) === "token_expired") && window._oaiHandleSessionExpired(), new y((null == o ? void 0 : o.message) || o, e.status, null == o ? void 0 : o.code, null == o ? void 0 : o.type); | |
case 16: | |
throw new j; | |
case 17: | |
case "end": | |
return t.stop() | |
} | |
}, t) | |
}))() | |
}, | |
onmessage: function(e) { | |
if ("[DONE]" === e.data) a.abort(), n({ | |
finish_reason: "stop" | |
}); | |
else if ("ping" === e.event) console.error("PING RECEIVED", e); | |
else try { | |
var t = JSON.parse(e.data); | |
if (t.error) throw new j(t.error.message); | |
t.message ? n({ | |
message: t.message, | |
threadId: t.conversation_id | |
}) : n({ | |
id: t.id, | |
text: t.choices[0].text, | |
finish_reason: t.choices[0].finish_reason | |
}) | |
} catch (r) { | |
if (w(r)) throw new j(r.message) | |
} | |
}, | |
onerror: function(e) { | |
throw "Failed to fetch" === e.message && (e = new j("An error occurred. Either the engine you requested does not exist or there was another issue processing your request. If this issue persists please contact us through our help center at help.openai.com.")), n({ | |
err: e | |
}), e | |
} | |
}).catch(function(e) { | |
e instanceof y || e instanceof j || console.error(e) | |
}), e.abrupt("return", a); | |
case 6: | |
case "end": | |
return e.stop() | |
} | |
}, e, this) | |
})), function(e, r, n) { | |
return t.apply(this, arguments) | |
}) | |
}, { | |
key: "runModerationApi", | |
value: function(e, t) { | |
return this.fetch("".concat("https://chat.openai.com/backend-api", "/moderations"), { | |
method: "POST", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()), | |
body: JSON.stringify({ | |
input: e, | |
model: t | |
}) | |
}) | |
} | |
}, { | |
key: "submitMessageFeedback", | |
value: function(e) { | |
return this.fetch("".concat(O, "/conversation/message_feedback"), { | |
method: "POST", | |
headers: P({ | |
"Content-Type": "application/json" | |
}, this.getAuthHeader()), | |
body: JSON.stringify(e) | |
}) | |
} | |
}]), r | |
}(); | |
T.auth0Client = null; | |
var S = T | |
}, | |
57076: function(e, t, r) { | |
r.d(t, { | |
T: function() { | |
return o | |
}, | |
y: function() { | |
return a | |
} | |
}); | |
var n = r(70079), | |
o = { | |
id: "chat", | |
name: "ChatGPT", | |
href: "/chat", | |
theme: { | |
icon: "openai", | |
color: "#10A37F" | |
}, | |
description: "Chat with GPT", | |
features: new Set | |
}, | |
a = (0, n.createContext)(o) | |
}, | |
2656: function(e, t, r) { | |
r.d(t, { | |
MC: function() { | |
return o | |
}, | |
VY: function() { | |
return n | |
}, | |
s6: function() { | |
return a | |
} | |
}); | |
var n = "Explorer: ", | |
o = { | |
Dashboard: "Dashboard: ", | |
Thread: "Thread: ", | |
CodeQA: "CodeQA: " | |
}, | |
a = { | |
editPrompt: function(e) { | |
return "".concat(e, "Edit Prompt") | |
}, | |
cancelEditPrompt: function(e) { | |
return "".concat(e, "Cancel Edit Prompt") | |
}, | |
editCompletion: function(e) { | |
return "".concat(e, "Edit Completion") | |
}, | |
cancelEditCompletion: function(e) { | |
return "".concat(e, "Cancel Edit Completion") | |
}, | |
generateCompletion: function(e) { | |
return "".concat(e, "Generate Completion") | |
}, | |
pauseCompletion: function(e) { | |
return "".concat(e, "Pause Completion") | |
}, | |
copyToClipboard: function(e) { | |
return "".concat(e, "Copy Thread to Clipboard") | |
}, | |
copyNodeToClipboard: function(e) { | |
return "".concat(e, "Copy Node to Clipboard") | |
}, | |
newThread: function(e) { | |
return "".concat(e, "Create New Thread") | |
}, | |
changeNode: function(e) { | |
return "".concat(e, "Change Active Node") | |
}, | |
enableFormattingThread: function(e) { | |
return "".concat(e, "Enable Thread Formatting") | |
}, | |
disableFormattingThread: function(e) { | |
return "".concat(e, "Disable Thread Formatting") | |
}, | |
enableFormatNode: function(e) { | |
return "".concat(e, "Enable Node Formatting") | |
}, | |
disableFormatNode: function(e) { | |
return "".concat(e, "Disable Node Formatting") | |
}, | |
addLink: function(e) { | |
return "".concat(e, "Add Link") | |
}, | |
removeLink: function(e) { | |
return "".concat(e, "Remove Link") | |
}, | |
reportResult: function(e) { | |
return "".concat(e, "Report Result") | |
}, | |
thumbRating: function(e) { | |
return "".concat(e, "Rated Result") | |
}, | |
allowContactForFeedback: function(e) { | |
return "".concat(e, "Allow contact for Feedback") | |
}, | |
moderationError: function(e) { | |
return "".concat(e, "Moderation: Error") | |
}, | |
promptFlaggedByModeration: function(e) { | |
return "".concat(e, "Moderation: Prompt Content Flagged") | |
}, | |
promptBlockedByModeration: function(e) { | |
return "".concat(e, "Moderation: Prompt Content Blocked") | |
}, | |
promptUsedRestrictedWords: function(e) { | |
return "".concat(e, "Moderation: Prompt Has Restricted Terms") | |
}, | |
completionFlaggedByModeration: function(e) { | |
return "".concat(e, "Moderation: Completion Content Flagged") | |
}, | |
completionBlockedByModeration: function(e) { | |
return "".concat(e, "Moderation: Completion Content Blocked") | |
} | |
} | |
}, | |
66740: function(e, t, r) { | |
r.d(t, { | |
Af: function() { | |
return m | |
}, | |
WS: function() { | |
return h | |
} | |
}); | |
var n = r(50809), | |
o = r(91690), | |
a = r(44111), | |
i = r(79153), | |
s = r.n(i), | |
c = r(70079), | |
l = r(2656); | |
function d(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function p(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? d(Object(r), !0).forEach(function(t) { | |
(0, n.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : d(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
} | |
var u = new(function() { | |
function e() { | |
(0, o.Z)(this, e), this._initializedMixpanel = !1, this._identified = !1 | |
} | |
return (0, a.Z)(e, [{ | |
key: "pageview", | |
value: function(e, t) { | |
this._sendMixpanelEvent("View Page", p({ | |
page: e | |
}, t)) | |
} | |
}, { | |
key: "event", | |
value: function(e, t) { | |
this._sendMixpanelEvent(e, t) | |
} | |
}, { | |
key: "publicEvent", | |
value: function(e, t) { | |
this._sendMixpanelEvent(e, t, !1) | |
} | |
}, { | |
key: "setUser", | |
value: function(e) { | |
this._initializeMixpanel(), s().identify(e.id), s().people.set({ | |
$email: e.email, | |
$user_id: e.id, | |
name: e.name | |
}), this._identified = !0 | |
} | |
}, { | |
key: "_initializeMixpanel", | |
value: function() { | |
this._initializedMixpanel || (s().init("d7d7628de9d5e6160010b84db960a7ee"), this._initializedMixpanel = !0) | |
} | |
}, { | |
key: "_sendMixpanelEvent", | |
value: function(e, t) { | |
var r = !(arguments.length > 2) || void 0 === arguments[2] || arguments[2]; | |
(!r || this._identified) && (this._initializeMixpanel(), t = p(p({}, t), {}, { | |
openai_app: "API" | |
}), s().track(e, t)) | |
} | |
}]), e | |
}()), | |
m = (0, c.createContext)({}), | |
h = function() { | |
var e = (0, c.useContext)(m), | |
t = e.app, | |
r = e.origin; | |
return (0, c.useMemo)(function() { | |
return function(e, n) { | |
u.event(e("".concat(t).concat(l.MC.Thread)), p(p({}, n), {}, { | |
origin: r | |
})) | |
} | |
}, [t, r]) | |
}; | |
t.ZP = u | |
}, | |
37918: function(e, t, r) { | |
r.d(t, { | |
w: function() { | |
return i | |
} | |
}); | |
var n = r(50809), | |
o = r(86986); | |
function a(e, t) { | |
var r = Object.keys(e); | |
if (Object.getOwnPropertySymbols) { | |
var n = Object.getOwnPropertySymbols(e); | |
t && (n = n.filter(function(t) { | |
return Object.getOwnPropertyDescriptor(e, t).enumerable | |
})), r.push.apply(r, n) | |
} | |
return r | |
} | |
function i(e) { | |
(0, o.signOut)(function(e) { | |
for (var t = 1; t < arguments.length; t++) { | |
var r = null != arguments[t] ? arguments[t] : {}; | |
t % 2 ? a(Object(r), !0).forEach(function(t) { | |
(0, n.Z)(e, t, r[t]) | |
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : a(Object(r)).forEach(function(t) { | |
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) | |
}) | |
} | |
return e | |
}({ | |
callbackUrl: window.location.origin + "/api/auth/logout" | |
}, e)) | |
} | |
} | |
} | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment