2024-02-24 00:37:31 +08:00

1175 lines
69 KiB
JavaScript

exports.id = 2296;
exports.ids = [2296];
exports.modules = {
/***/ 92296:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
Settings: () => (/* binding */ Settings)
});
// EXTERNAL MODULE: external "next/dist/compiled/react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(56786);
// EXTERNAL MODULE: external "next/dist/compiled/react"
var react_ = __webpack_require__(18038);
// EXTERNAL MODULE: ./app/components/settings.module.scss
var settings_module = __webpack_require__(5590);
var settings_module_default = /*#__PURE__*/__webpack_require__.n(settings_module);
// EXTERNAL MODULE: ./app/icons/reload.svg
var reload = __webpack_require__(4925);
// EXTERNAL MODULE: ./app/icons/add.svg
var add = __webpack_require__(31935);
// EXTERNAL MODULE: ./app/icons/close.svg
var icons_close = __webpack_require__(54299);
// EXTERNAL MODULE: ./app/icons/copy.svg
var copy = __webpack_require__(53231);
// EXTERNAL MODULE: ./app/icons/clear.svg
var clear = __webpack_require__(99449);
// EXTERNAL MODULE: ./app/icons/three-dots.svg
var three_dots = __webpack_require__(3076);
// EXTERNAL MODULE: ./app/icons/edit.svg
var edit = __webpack_require__(54095);
// EXTERNAL MODULE: ./app/icons/eye.svg
var eye = __webpack_require__(61221);
// EXTERNAL MODULE: ./app/icons/download.svg
var download = __webpack_require__(24624);
// EXTERNAL MODULE: ./app/icons/upload.svg
var upload = __webpack_require__(62030);
;// CONCATENATED MODULE: ./app/icons/config.svg
var _mask, _defs;
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var SvgConfig = function SvgConfig(props) {
return /*#__PURE__*/react_.createElement("svg", _extends({
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink",
width: 16,
height: 16,
fill: "none"
}, props), /*#__PURE__*/react_.createElement("g", null, _mask || (_mask = /*#__PURE__*/react_.createElement("mask", {
id: "config_svg__b",
fill: "#fff"
}, /*#__PURE__*/react_.createElement("use", {
xlinkHref: "#config_svg__a"
}))), /*#__PURE__*/react_.createElement("g", {
mask: "url(#config_svg__b)"
}, /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "M13.833 4h-2a.665.665 0 0 1-.471-1.138.664.664 0 0 1 .471-.195h2a.665.665 0 0 1 .654.796.666.666 0 0 1-.654.537zM9.833 2v2.667a.665.665 0 0 1-1.037.554.665.665 0 0 1-.296-.554V2a.665.665 0 0 1 1.037-.554.665.665 0 0 1 .296.554z"
}), /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "M9.166 4H1.833a.665.665 0 0 1-.554-1.037.665.665 0 0 1 .554-.296h7.333a.665.665 0 0 1 .555 1.037.665.665 0 0 1-.555.296zM4.5 8.667H1.833A.665.665 0 0 1 1.28 7.63a.665.665 0 0 1 .554-.297H4.5a.665.665 0 0 1 .555 1.037.665.665 0 0 1-.555.297zM7.833 6.667v2.667a.665.665 0 0 1-1.037.554.665.665 0 0 1-.296-.554V6.667a.665.665 0 0 1 1.037-.555.665.665 0 0 1 .296.555z"
}), /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "M14.5 8.667H7.167a.665.665 0 0 1-.555-1.037.665.665 0 0 1 .555-.297H14.5a.665.665 0 0 1 .471 1.138.664.664 0 0 1-.471.196zM13.833 13.333h-2a.666.666 0 1 1 0-1.333h2a.666.666 0 1 1 0 1.333zM9.833 11.333V14a.665.665 0 0 1-.796.654A.666.666 0 0 1 8.5 14v-2.667a.665.665 0 0 1 1.138-.471.664.664 0 0 1 .195.471z"
}), /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "M9.166 13.333H1.833a.666.666 0 1 1 0-1.333h7.333a.666.666 0 1 1 0 1.333z"
}))), _defs || (_defs = /*#__PURE__*/react_.createElement("defs", null, /*#__PURE__*/react_.createElement("path", {
id: "config_svg__a",
d: "M0 0h16v16H0z"
}))));
};
/* harmony default export */ const config = (SvgConfig);
// EXTERNAL MODULE: ./app/icons/confirm.svg
var icons_confirm = __webpack_require__(77365);
;// CONCATENATED MODULE: ./app/icons/connection.svg
var connection_mask, connection_defs;
function connection_extends() { connection_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return connection_extends.apply(this, arguments); }
var SvgConnection = function SvgConnection(props) {
return /*#__PURE__*/react_.createElement("svg", connection_extends({
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink",
width: 16,
height: 16,
fill: "none"
}, props), /*#__PURE__*/react_.createElement("g", null, connection_mask || (connection_mask = /*#__PURE__*/react_.createElement("mask", {
id: "connection_svg__b",
fill: "#fff"
}, /*#__PURE__*/react_.createElement("use", {
xlinkHref: "#connection_svg__a"
}))), /*#__PURE__*/react_.createElement("g", {
mask: "url(#connection_svg__b)"
}, /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "M11.867 4.14c-.914-.907-1.823-.908-2.729-.002l-1 1-.471-.471.471-.472 3.67 3.67-.471.472-.472-.472 1-1c.255-.255.421-.639.499-1.151.094-.624-.072-1.15-.499-1.576zm.941-.945c.744.744 1.035 1.65.874 2.717-.12.802-.412 1.434-.874 1.896l-1 1a.667.667 0 0 1-.943 0l-3.67-3.67a.667.667 0 0 1 0-.943l1-1c.462-.462 1.093-.753 1.892-.874 1.065-.16 1.971.13 2.72.872z"
}), /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "m14.475 2.471-1.67 1.67a.67.67 0 0 1-.727.145.664.664 0 0 1-.299-.986.659.659 0 0 1 .083-.101l1.67-1.67a.664.664 0 0 1 .842-.083.67.67 0 0 1 .283.684.666.666 0 0 1-.182.341zM4.138 11.865c.91.91 1.818.91 2.727 0l1-1 .472.472-.472.471-3.67-3.67.472-.471.471.471-1 1c-.906.906-.905 1.815.002 2.729zm-.945.941c-.742-.748-1.033-1.654-.872-2.719.12-.8.412-1.43.874-1.892l1-1c.26-.26.683-.26.943 0l3.67 3.67c.26.26.26.683 0 .943l-1 1c-.462.462-1.094.753-1.896.874-1.068.161-1.973-.13-2.717-.874z"
}), /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "m7.195 10.192 1.33-1.33a.665.665 0 0 1 1.125.341.665.665 0 0 1-.182.602l-1.33 1.33a.667.667 0 0 1-.943-.943zM1.529 13.532l1.67-1.67a.659.659 0 0 1 .471-.195.666.666 0 0 1 .471 1.138l-1.67 1.67a.667.667 0 0 1-.942-.943zM4.862 7.859l1.33-1.33a.665.665 0 1 1 .943.942l-1.33 1.33a.665.665 0 0 1-1.125-.34.665.665 0 0 1 .182-.602z"
}))), connection_defs || (connection_defs = /*#__PURE__*/react_.createElement("defs", null, /*#__PURE__*/react_.createElement("path", {
id: "connection_svg__a",
d: "M0 0h16v16H0z"
}))));
};
/* harmony default export */ const connection = (SvgConnection);
;// CONCATENATED MODULE: ./app/icons/cloud-success.svg
var cloud_success_mask, cloud_success_defs;
function cloud_success_extends() { cloud_success_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return cloud_success_extends.apply(this, arguments); }
var SvgCloudSuccess = function SvgCloudSuccess(props) {
return /*#__PURE__*/react_.createElement("svg", cloud_success_extends({
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink",
width: 16,
height: 16,
fill: "none"
}, props), /*#__PURE__*/react_.createElement("g", null, cloud_success_mask || (cloud_success_mask = /*#__PURE__*/react_.createElement("mask", {
id: "cloud-success_svg__b",
fill: "#fff"
}, /*#__PURE__*/react_.createElement("use", {
xlinkHref: "#cloud-success_svg__a"
}))), /*#__PURE__*/react_.createElement("g", {
mask: "url(#cloud-success_svg__b)"
}, /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "M4.003 11.663c-.839 0-1.551-.207-2.137-.623-.8-.567-1.2-1.415-1.2-2.543 0-1.252.521-2.204 1.563-2.855C2.915 5.214 3.616 5 4.333 5v.667l-.641-.181.641.18-.641-.18C4.347 3.162 5.784 2 8.003 2c2.307 0 3.74.995 4.302 2.986l-.642.18.073-.662-.073.663.073-.663c2.396.263 3.594 1.541 3.594 3.833 0 2.217-1.109 3.326-3.327 3.326a.666.666 0 1 1 0-1.333c1.33 0 1.994-.664 1.994-1.993 0-1.495-.802-2.331-2.407-2.508-.27-.03-.495-.22 0 0a.667.667 0 0 1-.568-.481c-.379-1.343-1.385-2.015-3.019-2.015-1.546 0-2.555.838-3.028 2.515-.081.287-.343.485 0 0a.667.667 0 0 1-.642.485c-.462 0-.928.147-1.398.44-.623.39-.935.964-.935 1.724 0 .669.213 1.154.638 1.456.354.251.81.377 1.365.377a.666.666 0 1 1 0 1.333z"
}), /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "m6.426 10.49 2 1.66-.426.513-.52-.417 2.67-3.33a.668.668 0 0 1 1.104.096.667.667 0 0 1-.064.738l-2.67 3.33a.667.667 0 0 1-.946.096l-2-1.66a.663.663 0 0 1-.21-.71.667.667 0 0 1 1.062-.316z"
}))), cloud_success_defs || (cloud_success_defs = /*#__PURE__*/react_.createElement("defs", null, /*#__PURE__*/react_.createElement("path", {
id: "cloud-success_svg__a",
d: "M0 0h16v16H0z"
}))));
};
/* harmony default export */ const cloud_success = (SvgCloudSuccess);
;// CONCATENATED MODULE: ./app/icons/cloud-fail.svg
var cloud_fail_mask, cloud_fail_defs;
function cloud_fail_extends() { cloud_fail_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return cloud_fail_extends.apply(this, arguments); }
var SvgCloudFail = function SvgCloudFail(props) {
return /*#__PURE__*/react_.createElement("svg", cloud_fail_extends({
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink",
width: 16,
height: 16,
fill: "none"
}, props), /*#__PURE__*/react_.createElement("g", null, cloud_fail_mask || (cloud_fail_mask = /*#__PURE__*/react_.createElement("mask", {
id: "cloud-fail_svg__b",
fill: "#fff"
}, /*#__PURE__*/react_.createElement("use", {
xlinkHref: "#cloud-fail_svg__a"
}))), /*#__PURE__*/react_.createElement("g", {
mask: "url(#cloud-fail_svg__b)"
}, /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "M4.003 11.663c-.839 0-1.551-.207-2.137-.623-.8-.567-1.2-1.415-1.2-2.543 0-1.252.521-2.204 1.563-2.855C2.915 5.214 3.616 5 4.333 5v.667l-.641-.181.641.18-.641-.18C4.347 3.162 5.784 2 8.003 2c2.307 0 3.74.995 4.302 2.986l-.642.18.073-.662-.073.663.073-.663c2.396.263 3.594 1.541 3.594 3.833 0 2.217-1.109 3.326-3.327 3.326a.666.666 0 1 1 0-1.333c1.33 0 1.994-.664 1.994-1.993 0-1.495-.802-2.331-2.407-2.508-.27-.03-.495-.22 0 0a.667.667 0 0 1-.568-.481c-.379-1.343-1.385-2.015-3.019-2.015-1.546 0-2.555.838-3.028 2.515-.081.287-.343.485 0 0a.667.667 0 0 1-.642.485c-.462 0-.928.147-1.398.44-.623.39-.935.964-.935 1.724 0 .669.213 1.154.638 1.456.354.251.81.377 1.365.377a.666.666 0 1 1 0 1.333z"
}), /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "m10.135 9.805-3.33 3.33a.667.667 0 0 1-.943-.943l3.33-3.33a.665.665 0 1 1 .943.943z"
}), /*#__PURE__*/react_.createElement("path", {
style: {
fill: "#333",
opacity: 1
},
d: "m6.805 8.862 3.33 3.33a.67.67 0 0 1 0 .943.672.672 0 0 1-.602.182.666.666 0 0 1-.341-.182l-3.33-3.33a.665.665 0 0 1 .341-1.126.665.665 0 0 1 .602.183z"
}))), cloud_fail_defs || (cloud_fail_defs = /*#__PURE__*/react_.createElement("defs", null, /*#__PURE__*/react_.createElement("path", {
id: "cloud-fail_svg__a",
d: "M0 0h16v16H0z"
}))));
};
/* harmony default export */ const cloud_fail = (SvgCloudFail);
// EXTERNAL MODULE: ./app/components/ui-lib.tsx + 3 modules
var ui_lib = __webpack_require__(24552);
// EXTERNAL MODULE: ./app/components/model-config.tsx
var model_config = __webpack_require__(80663);
// EXTERNAL MODULE: ./app/components/button.tsx
var components_button = __webpack_require__(39378);
// EXTERNAL MODULE: ./app/store/index.ts + 2 modules
var store = __webpack_require__(1075);
// EXTERNAL MODULE: ./app/locales/index.ts + 19 modules
var locales = __webpack_require__(57254);
// EXTERNAL MODULE: ./app/utils.ts
var utils = __webpack_require__(92842);
// EXTERNAL MODULE: ./app/constant.ts
var constant = __webpack_require__(43684);
// EXTERNAL MODULE: ./app/store/prompt.ts
var store_prompt = __webpack_require__(16975);
// EXTERNAL MODULE: ./app/components/error.tsx + 1 modules
var error = __webpack_require__(13727);
// EXTERNAL MODULE: ./app/components/input-range.tsx
var input_range = __webpack_require__(26033);
// EXTERNAL MODULE: ./node_modules/react-router-dom/dist/umd/react-router-dom.production.min.js
var react_router_dom_production_min = __webpack_require__(99742);
// EXTERNAL MODULE: ./app/components/emoji.tsx + 1 modules
var emoji = __webpack_require__(85563);
// EXTERNAL MODULE: ./app/config/client.ts + 2 modules
var client = __webpack_require__(39463);
// EXTERNAL MODULE: ./app/store/sync.ts + 1 modules
var sync = __webpack_require__(83141);
// EXTERNAL MODULE: ./node_modules/nanoid/index.js + 1 modules
var nanoid = __webpack_require__(35667);
// EXTERNAL MODULE: ./app/store/mask.ts
var mask = __webpack_require__(73706);
// EXTERNAL MODULE: ./app/utils/cloud/index.ts + 2 modules
var cloud = __webpack_require__(28324);
;// CONCATENATED MODULE: ./app/components/settings.tsx
function EditPromptModal(props) {
const promptStore = (0,store_prompt/* usePromptStore */.f)();
const prompt = promptStore.get(props.id);
return prompt ? /*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "modal-mask",
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* Modal */.u_, {
title: locales/* default */.ZP.Settings.Prompt.EditModal.Title,
onClose: props.onClose,
actions: [
/*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
onClick: props.onClose,
text: locales/* default */.ZP.UI.Confirm,
bordered: true
}, "")
],
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: (settings_module_default())["edit-prompt-modal"],
children: [
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: prompt.title,
readOnly: !prompt.isUser,
className: (settings_module_default())["edit-prompt-title"],
onInput: (e)=>promptStore.updatePrompt(props.id, (prompt)=>prompt.title = e.currentTarget.value)
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* Input */.II, {
value: prompt.content,
readOnly: !prompt.isUser,
className: (settings_module_default())["edit-prompt-content"],
rows: 10,
onInput: (e)=>promptStore.updatePrompt(props.id, (prompt)=>prompt.content = e.currentTarget.value)
})
]
})
})
}) : null;
}
function UserPromptModal(props) {
const promptStore = (0,store_prompt/* usePromptStore */.f)();
const userPrompts = promptStore.getUserPrompts();
const builtinPrompts = store_prompt/* SearchService */.o.builtinPrompts;
const allPrompts = userPrompts.concat(builtinPrompts);
const [searchInput, setSearchInput] = (0,react_.useState)("");
const [searchPrompts, setSearchPrompts] = (0,react_.useState)([]);
const prompts = searchInput.length > 0 ? searchPrompts : allPrompts;
const [editingPromptId, setEditingPromptId] = (0,react_.useState)();
(0,react_.useEffect)(()=>{
if (searchInput.length > 0) {
const searchResult = store_prompt/* SearchService */.o.search(searchInput);
setSearchPrompts(searchResult);
} else {
setSearchPrompts([]);
}
}, [
searchInput
]);
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "modal-mask",
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* Modal */.u_, {
title: locales/* default */.ZP.Settings.Prompt.Modal.Title,
onClose: ()=>props.onClose?.(),
actions: [
/*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
onClick: ()=>{
const promptId = promptStore.add({
id: (0,nanoid/* nanoid */.x0)(),
createdAt: Date.now(),
title: "Empty Prompt",
content: "Empty Prompt Content"
});
setEditingPromptId(promptId);
},
icon: /*#__PURE__*/ jsx_runtime_.jsx(add/* default */.Z, {}),
bordered: true,
text: locales/* default */.ZP.Settings.Prompt.Modal.Add
}, "add")
],
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: (settings_module_default())["user-prompt-modal"],
children: [
/*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
className: (settings_module_default())["user-prompt-search"],
placeholder: locales/* default */.ZP.Settings.Prompt.Modal.Search,
value: searchInput,
onInput: (e)=>setSearchInput(e.currentTarget.value)
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: (settings_module_default())["user-prompt-list"],
children: prompts.map((v, _)=>/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: (settings_module_default())["user-prompt-item"],
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: (settings_module_default())["user-prompt-header"],
children: [
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: (settings_module_default())["user-prompt-title"],
children: v.title
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: (settings_module_default())["user-prompt-content"] + " one-line",
children: v.content
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: (settings_module_default())["user-prompt-buttons"],
children: [
v.isUser && /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(clear/* default */.Z, {}),
className: (settings_module_default())["user-prompt-button"],
onClick: ()=>promptStore.remove(v.id)
}),
v.isUser ? /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(edit/* default */.Z, {}),
className: (settings_module_default())["user-prompt-button"],
onClick: ()=>setEditingPromptId(v.id)
}) : /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(eye/* default */.Z, {}),
className: (settings_module_default())["user-prompt-button"],
onClick: ()=>setEditingPromptId(v.id)
}),
/*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(copy/* default */.Z, {}),
className: (settings_module_default())["user-prompt-button"],
onClick: ()=>(0,utils/* copyToClipboard */.vQ)(v.content)
})
]
})
]
}, v.id ?? v.title))
})
]
})
}),
editingPromptId !== undefined && /*#__PURE__*/ jsx_runtime_.jsx(EditPromptModal, {
id: editingPromptId,
onClose: ()=>setEditingPromptId(undefined)
})
]
});
}
function DangerItems() {
const chatStore = (0,store/* useChatStore */.aK)();
const appConfig = (0,store/* useAppConfig */.MG)();
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Danger.Reset.Title,
subTitle: locales/* default */.ZP.Settings.Danger.Reset.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
text: locales/* default */.ZP.Settings.Danger.Reset.Action,
onClick: async ()=>{
if (await (0,ui_lib/* showConfirm */.i0)(locales/* default */.ZP.Settings.Danger.Reset.Confirm)) {
appConfig.reset();
}
},
type: "danger"
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Danger.Clear.Title,
subTitle: locales/* default */.ZP.Settings.Danger.Clear.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
text: locales/* default */.ZP.Settings.Danger.Clear.Action,
onClick: async ()=>{
if (await (0,ui_lib/* showConfirm */.i0)(locales/* default */.ZP.Settings.Danger.Clear.Confirm)) {
chatStore.clearAllData();
}
},
type: "danger"
})
})
]
});
}
function CheckButton() {
const syncStore = (0,sync/* useSyncStore */.i)();
const couldCheck = (0,react_.useMemo)(()=>{
return syncStore.cloudSync();
}, [
syncStore
]);
const [checkState, setCheckState] = (0,react_.useState)("none");
async function check() {
setCheckState("checking");
const valid = await syncStore.check();
setCheckState(valid ? "success" : "failed");
}
if (!couldCheck) return null;
return /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
text: locales/* default */.ZP.Settings.Sync.Config.Modal.Check,
bordered: true,
onClick: check,
icon: checkState === "none" ? /*#__PURE__*/ jsx_runtime_.jsx(connection, {}) : checkState === "checking" ? /*#__PURE__*/ jsx_runtime_.jsx(three_dots/* default */.Z, {}) : checkState === "success" ? /*#__PURE__*/ jsx_runtime_.jsx(cloud_success, {}) : checkState === "failed" ? /*#__PURE__*/ jsx_runtime_.jsx(cloud_fail, {}) : /*#__PURE__*/ jsx_runtime_.jsx(connection, {})
});
}
function SyncConfigModal(props) {
const syncStore = (0,sync/* useSyncStore */.i)();
return /*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "modal-mask",
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* Modal */.u_, {
title: locales/* default */.ZP.Settings.Sync.Config.Modal.Title,
onClose: ()=>props.onClose?.(),
actions: [
/*#__PURE__*/ jsx_runtime_.jsx(CheckButton, {}, "check"),
/*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
onClick: props.onClose,
icon: /*#__PURE__*/ jsx_runtime_.jsx(icons_confirm/* default */.Z, {}),
bordered: true,
text: locales/* default */.ZP.UI.Confirm
}, "confirm")
],
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.SyncType.Title,
subTitle: locales/* default */.ZP.Settings.Sync.Config.SyncType.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("select", {
value: syncStore.provider,
onChange: (e)=>{
syncStore.update((config)=>config.provider = e.target.value);
},
children: Object.entries(cloud/* ProviderType */.lP).map(([k, v])=>/*#__PURE__*/ jsx_runtime_.jsx("option", {
value: v,
children: k
}, k))
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.Proxy.Title,
subTitle: locales/* default */.ZP.Settings.Sync.Config.Proxy.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "checkbox",
checked: syncStore.useProxy,
onChange: (e)=>{
syncStore.update((config)=>config.useProxy = e.currentTarget.checked);
}
})
}),
syncStore.useProxy ? /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.ProxyUrl.Title,
subTitle: locales/* default */.ZP.Settings.Sync.Config.ProxyUrl.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: syncStore.proxyUrl,
onChange: (e)=>{
syncStore.update((config)=>config.proxyUrl = e.currentTarget.value);
}
})
}) : null
]
}),
syncStore.provider === cloud/* ProviderType */.lP.WebDAV && /*#__PURE__*/ jsx_runtime_.jsx(jsx_runtime_.Fragment, {
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.WebDav.Endpoint,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: syncStore.webdav.endpoint,
onChange: (e)=>{
syncStore.update((config)=>config.webdav.endpoint = e.currentTarget.value);
}
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.WebDav.UserName,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: syncStore.webdav.username,
onChange: (e)=>{
syncStore.update((config)=>config.webdav.username = e.currentTarget.value);
}
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.WebDav.Password,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* PasswordInput */.WU, {
value: syncStore.webdav.password,
onChange: (e)=>{
syncStore.update((config)=>config.webdav.password = e.currentTarget.value);
}
})
})
]
})
}),
syncStore.provider === cloud/* ProviderType */.lP.UpStash && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.UpStash.Endpoint,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: syncStore.upstash.endpoint,
onChange: (e)=>{
syncStore.update((config)=>config.upstash.endpoint = e.currentTarget.value);
}
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.UpStash.UserName,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: syncStore.upstash.username,
placeholder: constant/* STORAGE_KEY */.Uf,
onChange: (e)=>{
syncStore.update((config)=>config.upstash.username = e.currentTarget.value);
}
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.Config.UpStash.Password,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* PasswordInput */.WU, {
value: syncStore.upstash.apiKey,
onChange: (e)=>{
syncStore.update((config)=>config.upstash.apiKey = e.currentTarget.value);
}
})
})
]
})
]
})
});
}
function SyncItems() {
const syncStore = (0,sync/* useSyncStore */.i)();
const chatStore = (0,store/* useChatStore */.aK)();
const promptStore = (0,store_prompt/* usePromptStore */.f)();
const maskStore = (0,mask/* useMaskStore */.Zy)();
const couldSync = (0,react_.useMemo)(()=>{
return syncStore.cloudSync();
}, [
syncStore
]);
const [showSyncConfigModal, setShowSyncConfigModal] = (0,react_.useState)(false);
const stateOverview = (0,react_.useMemo)(()=>{
const sessions = chatStore.sessions;
const messageCount = sessions.reduce((p, c)=>p + c.messages.length, 0);
return {
chat: sessions.length,
message: messageCount,
prompt: Object.keys(promptStore.prompts).length,
mask: Object.keys(maskStore.masks).length
};
}, [
chatStore.sessions,
maskStore.masks,
promptStore.prompts
]);
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.CloudState,
subTitle: syncStore.lastProvider ? `${new Date(syncStore.lastSyncTime).toLocaleString()} [${syncStore.lastProvider}]` : locales/* default */.ZP.Settings.Sync.NotSyncYet,
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
style: {
display: "flex"
},
children: [
/*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(config, {}),
text: locales/* default */.ZP.UI.Config,
onClick: ()=>{
setShowSyncConfigModal(true);
}
}),
couldSync && /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(reload/* default */.Z, {}),
text: locales/* default */.ZP.UI.Sync,
onClick: async ()=>{
try {
await syncStore.sync();
(0,ui_lib/* showToast */.CF)(locales/* default */.ZP.Settings.Sync.Success);
} catch (e) {
(0,ui_lib/* showToast */.CF)(locales/* default */.ZP.Settings.Sync.Fail);
console.error("[Sync]", e);
}
}
})
]
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Sync.LocalState,
subTitle: locales/* default */.ZP.Settings.Sync.Overview(stateOverview),
children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
style: {
display: "flex"
},
children: [
/*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(upload/* default */.Z, {}),
text: locales/* default */.ZP.UI.Export,
onClick: ()=>{
syncStore.export();
}
}),
/*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(download/* default */.Z, {}),
text: locales/* default */.ZP.UI.Import,
onClick: ()=>{
syncStore.import();
}
})
]
})
})
]
}),
showSyncConfigModal && /*#__PURE__*/ jsx_runtime_.jsx(SyncConfigModal, {
onClose: ()=>setShowSyncConfigModal(false)
})
]
});
}
function Settings() {
const navigate = (0,react_router_dom_production_min.useNavigate)();
const [showEmojiPicker, setShowEmojiPicker] = (0,react_.useState)(false);
const config = (0,store/* useAppConfig */.MG)();
const updateConfig = config.update;
const updateStore = (0,store/* useUpdateStore */.u2)();
const [checkingUpdate, setCheckingUpdate] = (0,react_.useState)(false);
const currentVersion = updateStore.formatVersion(updateStore.version);
const remoteId = updateStore.formatVersion(updateStore.remoteVersion);
const hasNewVersion = currentVersion !== remoteId;
const updateUrl = (0,client/* getClientConfig */.Z)()?.isApp ? constant/* RELEASE_URL */.cr : constant/* UPDATE_URL */.Cs;
function checkUpdate(force = false) {
setCheckingUpdate(true);
updateStore.getLatestVersion(force).then(()=>{
setCheckingUpdate(false);
});
console.log("[Update] local version ", updateStore.version);
console.log("[Update] remote version ", updateStore.remoteVersion);
}
const accessStore = (0,store/* useAccessStore */._X)();
const shouldHideBalanceQuery = (0,react_.useMemo)(()=>{
const isOpenAiUrl = accessStore.openaiUrl.includes(constant/* OPENAI_BASE_URL */.Bi);
return accessStore.hideBalanceQuery || isOpenAiUrl || accessStore.provider === constant/* ServiceProvider */.UT.Azure;
}, [
accessStore.hideBalanceQuery,
accessStore.openaiUrl,
accessStore.provider
]);
const usage = {
used: updateStore.used,
subscription: updateStore.subscription
};
const [loadingUsage, setLoadingUsage] = (0,react_.useState)(false);
function checkUsage(force = false) {
if (shouldHideBalanceQuery) {
return;
}
setLoadingUsage(true);
updateStore.updateUsage(force).finally(()=>{
setLoadingUsage(false);
});
}
const enabledAccessControl = (0,react_.useMemo)(()=>accessStore.enabledAccessControl(), // eslint-disable-next-line react-hooks/exhaustive-deps
[]);
const promptStore = (0,store_prompt/* usePromptStore */.f)();
const builtinCount = store_prompt/* SearchService */.o.count.builtin;
const customCount = promptStore.getUserPrompts().length ?? 0;
const [shouldShowPromptModal, setShowPromptModal] = (0,react_.useState)(false);
const showUsage = accessStore.isAuthorized();
(0,react_.useEffect)(()=>{
// checks per minutes
checkUpdate();
showUsage && checkUsage();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
(0,react_.useEffect)(()=>{
const keydownEvent = (e)=>{
if (e.key === "Escape") {
navigate(constant/* Path */.y$.Home);
}
};
if (clientConfig?.isApp) {
// Force to set custom endpoint to true if it's app
accessStore.update((state)=>{
state.useCustomConfig = true;
});
}
document.addEventListener("keydown", keydownEvent);
return ()=>{
document.removeEventListener("keydown", keydownEvent);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const clientConfig = (0,react_.useMemo)(()=>(0,client/* getClientConfig */.Z)(), []);
const showAccessCode = enabledAccessControl && !clientConfig?.isApp;
return /*#__PURE__*/ (0,jsx_runtime_.jsxs)(error/* ErrorBoundary */.S, {
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "window-header",
"data-tauri-drag-region": true,
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "window-header-title",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "window-header-main-title",
children: locales/* default */.ZP.Settings.Title
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "window-header-sub-title",
children: locales/* default */.ZP.Settings.SubTitle
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: "window-actions",
children: [
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "window-action-button"
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "window-action-button"
}),
/*#__PURE__*/ jsx_runtime_.jsx("div", {
className: "window-action-button",
children: /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(icons_close/* default */.Z, {}),
onClick: ()=>navigate(constant/* Path */.y$.Home),
bordered: true
})
})
]
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
className: (settings_module_default()).settings,
children: [
/*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Avatar,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* Popover */.J2, {
onClose: ()=>setShowEmojiPicker(false),
content: /*#__PURE__*/ jsx_runtime_.jsx(emoji/* AvatarPicker */.aR, {
onEmojiClick: (avatar)=>{
updateConfig((config)=>config.avatar = avatar);
setShowEmojiPicker(false);
}
}),
open: showEmojiPicker,
children: /*#__PURE__*/ jsx_runtime_.jsx("div", {
className: (settings_module_default()).avatar,
onClick: ()=>setShowEmojiPicker(true),
children: /*#__PURE__*/ jsx_runtime_.jsx(emoji/* Avatar */.qE, {
avatar: config.avatar
})
})
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.SendKey,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* Select */.Ph, {
value: config.submitKey,
onChange: (e)=>{
updateConfig((config)=>config.submitKey = e.target.value);
},
children: Object.values(store/* SubmitKey */.mQ).map((v)=>/*#__PURE__*/ jsx_runtime_.jsx("option", {
value: v,
children: v
}, v))
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Theme,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* Select */.Ph, {
value: config.theme,
onChange: (e)=>{
updateConfig((config)=>config.theme = e.target.value);
},
children: Object.values(store/* Theme */.Q2).map((v)=>/*#__PURE__*/ jsx_runtime_.jsx("option", {
value: v,
children: v
}, v))
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Lang.Name,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* Select */.Ph, {
value: (0,locales/* getLang */.VQ)(),
onChange: (e)=>{
(0,locales/* changeLang */.t4)(e.target.value);
},
children: locales/* AllLangs */.DC.map((lang)=>/*#__PURE__*/ jsx_runtime_.jsx("option", {
value: lang,
children: locales/* ALL_LANG_OPTIONS */.nW[lang]
}, lang))
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.FontSize.Title,
subTitle: locales/* default */.ZP.Settings.FontSize.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx(input_range/* InputRange */.O, {
title: `${config.fontSize ?? 14}px`,
value: config.fontSize,
min: "12",
max: "40",
step: "1",
onChange: (e)=>updateConfig((config)=>config.fontSize = Number.parseInt(e.currentTarget.value))
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.AutoGenerateTitle.Title,
subTitle: locales/* default */.ZP.Settings.AutoGenerateTitle.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "checkbox",
checked: config.enableAutoGenerateTitle,
onChange: (e)=>updateConfig((config)=>config.enableAutoGenerateTitle = e.currentTarget.checked)
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.SendPreviewBubble.Title,
subTitle: locales/* default */.ZP.Settings.SendPreviewBubble.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "checkbox",
checked: config.sendPreviewBubble,
onChange: (e)=>updateConfig((config)=>config.sendPreviewBubble = e.currentTarget.checked)
})
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx(SyncItems, {}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Mask.Splash.Title,
subTitle: locales/* default */.ZP.Settings.Mask.Splash.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "checkbox",
checked: !config.dontShowMaskSplashScreen,
onChange: (e)=>updateConfig((config)=>config.dontShowMaskSplashScreen = !e.currentTarget.checked)
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Mask.Builtin.Title,
subTitle: locales/* default */.ZP.Settings.Mask.Builtin.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "checkbox",
checked: config.hideBuiltinMasks,
onChange: (e)=>updateConfig((config)=>config.hideBuiltinMasks = e.currentTarget.checked)
})
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Prompt.Disable.Title,
subTitle: locales/* default */.ZP.Settings.Prompt.Disable.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "checkbox",
checked: config.disablePromptHint,
onChange: (e)=>updateConfig((config)=>config.disablePromptHint = e.currentTarget.checked)
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Prompt.List,
subTitle: locales/* default */.ZP.Settings.Prompt.ListCount(builtinCount, customCount),
children: /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(edit/* default */.Z, {}),
text: locales/* default */.ZP.Settings.Prompt.Edit,
onClick: ()=>setShowPromptModal(true)
})
})
]
}),
/*#__PURE__*/ (0,jsx_runtime_.jsxs)(ui_lib/* List */.aV, {
id: constant/* SlotID */.ym.CustomModel,
children: [
showAccessCode && /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.AccessCode.Title,
subTitle: locales/* default */.ZP.Settings.Access.AccessCode.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* PasswordInput */.WU, {
value: accessStore.accessCode,
type: "text",
placeholder: locales/* default */.ZP.Settings.Access.AccessCode.Placeholder,
onChange: (e)=>{
accessStore.update((access)=>access.accessCode = e.currentTarget.value);
}
})
}),
!accessStore.hideUserApiKey && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
children: [
// Conditionally render the following ListItem based on clientConfig.isApp
!clientConfig?.isApp && /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.CustomEndpoint.Title,
subTitle: locales/* default */.ZP.Settings.Access.CustomEndpoint.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "checkbox",
checked: accessStore.useCustomConfig,
onChange: (e)=>accessStore.update((access)=>access.useCustomConfig = e.currentTarget.checked)
})
}),
accessStore.useCustomConfig && /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.Provider.Title,
subTitle: locales/* default */.ZP.Settings.Access.Provider.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* Select */.Ph, {
value: accessStore.provider,
onChange: (e)=>{
accessStore.update((access)=>access.provider = e.target.value);
},
children: Object.entries(constant/* ServiceProvider */.UT).map(([k, v])=>/*#__PURE__*/ jsx_runtime_.jsx("option", {
value: v,
children: k
}, k))
})
}),
accessStore.provider === "OpenAI" ? /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.OpenAI.Endpoint.Title,
subTitle: locales/* default */.ZP.Settings.Access.OpenAI.Endpoint.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: accessStore.openaiUrl,
placeholder: constant/* OPENAI_BASE_URL */.Bi,
onChange: (e)=>accessStore.update((access)=>access.openaiUrl = e.currentTarget.value)
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.OpenAI.ApiKey.Title,
subTitle: locales/* default */.ZP.Settings.Access.OpenAI.ApiKey.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* PasswordInput */.WU, {
value: accessStore.openaiApiKey,
type: "text",
placeholder: locales/* default */.ZP.Settings.Access.OpenAI.ApiKey.Placeholder,
onChange: (e)=>{
accessStore.update((access)=>access.openaiApiKey = e.currentTarget.value);
}
})
})
]
}) : accessStore.provider === "Azure" ? /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.Azure.Endpoint.Title,
subTitle: locales/* default */.ZP.Settings.Access.Azure.Endpoint.SubTitle + constant/* Azure */.kn.ExampleEndpoint,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: accessStore.azureUrl,
placeholder: constant/* Azure */.kn.ExampleEndpoint,
onChange: (e)=>accessStore.update((access)=>access.azureUrl = e.currentTarget.value)
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.Azure.ApiKey.Title,
subTitle: locales/* default */.ZP.Settings.Access.Azure.ApiKey.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* PasswordInput */.WU, {
value: accessStore.azureApiKey,
type: "text",
placeholder: locales/* default */.ZP.Settings.Access.Azure.ApiKey.Placeholder,
onChange: (e)=>{
accessStore.update((access)=>access.azureApiKey = e.currentTarget.value);
}
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.Azure.ApiVerion.Title,
subTitle: locales/* default */.ZP.Settings.Access.Azure.ApiVerion.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: accessStore.azureApiVersion,
placeholder: "2023-08-01-preview",
onChange: (e)=>accessStore.update((access)=>access.azureApiVersion = e.currentTarget.value)
})
})
]
}) : accessStore.provider === "Google" ? /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
children: [
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.Google.Endpoint.Title,
subTitle: locales/* default */.ZP.Settings.Access.Google.Endpoint.SubTitle + constant/* Google */.ie.ExampleEndpoint,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: accessStore.googleUrl,
placeholder: constant/* Google */.ie.ExampleEndpoint,
onChange: (e)=>accessStore.update((access)=>access.googleUrl = e.currentTarget.value)
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.Google.ApiKey.Title,
subTitle: locales/* default */.ZP.Settings.Access.Google.ApiKey.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* PasswordInput */.WU, {
value: accessStore.googleApiKey,
type: "text",
placeholder: locales/* default */.ZP.Settings.Access.Google.ApiKey.Placeholder,
onChange: (e)=>{
accessStore.update((access)=>access.googleApiKey = e.currentTarget.value);
}
})
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.Google.ApiVersion.Title,
subTitle: locales/* default */.ZP.Settings.Access.Google.ApiVersion.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: accessStore.googleApiVersion,
placeholder: "2023-08-01-preview",
onChange: (e)=>accessStore.update((access)=>access.googleApiVersion = e.currentTarget.value)
})
})
]
}) : null
]
})
]
}),
!shouldHideBalanceQuery && !clientConfig?.isApp ? /*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Usage.Title,
subTitle: showUsage ? loadingUsage ? locales/* default */.ZP.Settings.Usage.IsChecking : locales/* default */.ZP.Settings.Usage.SubTitle(usage?.used ?? "[?]", usage?.subscription ?? "[?]") : locales/* default */.ZP.Settings.Usage.NoAccess,
children: !showUsage || loadingUsage ? /*#__PURE__*/ jsx_runtime_.jsx("div", {}) : /*#__PURE__*/ jsx_runtime_.jsx(components_button/* IconButton */.h, {
icon: /*#__PURE__*/ jsx_runtime_.jsx(reload/* default */.Z, {}),
text: locales/* default */.ZP.Settings.Usage.Check,
onClick: ()=>checkUsage(true)
})
}) : null,
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* ListItem */.HC, {
title: locales/* default */.ZP.Settings.Access.CustomModel.Title,
subTitle: locales/* default */.ZP.Settings.Access.CustomModel.SubTitle,
children: /*#__PURE__*/ jsx_runtime_.jsx("input", {
type: "text",
value: config.customModels,
placeholder: "model1,model2,model3",
onChange: (e)=>config.update((config)=>config.customModels = e.currentTarget.value)
})
})
]
}),
/*#__PURE__*/ jsx_runtime_.jsx(ui_lib/* List */.aV, {
children: /*#__PURE__*/ jsx_runtime_.jsx(model_config/* ModelConfigList */.j, {
modelConfig: config.modelConfig,
updateConfig: (updater)=>{
const modelConfig = {
...config.modelConfig
};
updater(modelConfig);
config.update((config)=>config.modelConfig = modelConfig);
}
})
}),
shouldShowPromptModal && /*#__PURE__*/ jsx_runtime_.jsx(UserPromptModal, {
onClose: ()=>setShowPromptModal(false)
}),
/*#__PURE__*/ jsx_runtime_.jsx(DangerItems, {})
]
})
]
});
}
/***/ }),
/***/ 5590:
/***/ ((module) => {
// Exports
module.exports = {
"settings": "settings_settings__427bK",
"avatar": "settings_avatar__jO3Wv",
"edit-prompt-modal": "settings_edit-prompt-modal__iP1gi",
"edit-prompt-title": "settings_edit-prompt-title__mq8os",
"edit-prompt-content": "settings_edit-prompt-content__9i9Y_",
"user-prompt-modal": "settings_user-prompt-modal__YWssH",
"user-prompt-search": "settings_user-prompt-search__kskD_",
"user-prompt-list": "settings_user-prompt-list__BrWRy",
"user-prompt-item": "settings_user-prompt-item__kh_6Q",
"user-prompt-header": "settings_user-prompt-header__MBMAf",
"user-prompt-title": "settings_user-prompt-title__BpRs1",
"user-prompt-content": "settings_user-prompt-content__CxL3R",
"user-prompt-buttons": "settings_user-prompt-buttons__y5Hf_",
"user-prompt-button": "settings_user-prompt-button__efhSx"
};
/***/ })
};
;