add reset current to prompt
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
|||||||
STORAGE_NAME_TEMPLATE_API,
|
STORAGE_NAME_TEMPLATE_API,
|
||||||
TemplateAPI,
|
TemplateAPI,
|
||||||
addTotalCost,
|
addTotalCost,
|
||||||
|
newChatStore,
|
||||||
} from "./app";
|
} from "./app";
|
||||||
import ChatGPT, {
|
import ChatGPT, {
|
||||||
calculate_token_length,
|
calculate_token_length,
|
||||||
@@ -376,10 +377,21 @@ export default function ChatBOX(props: {
|
|||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{templates.length > 0 &&
|
{chatStore.history.filter((msg) => !msg.example).length == 0 && (
|
||||||
chatStore.history.filter((msg) => !msg.example).length == 0 && (
|
|
||||||
<p className="break-all opacity-80 p-3 rounded bg-white my-3 text-left dark:text-black">
|
<p className="break-all opacity-80 p-3 rounded bg-white my-3 text-left dark:text-black">
|
||||||
<h2>{Tr("Saved prompt templates")}</h2>
|
<h2>
|
||||||
|
<span>{Tr("Saved prompt templates")}</span>
|
||||||
|
<button
|
||||||
|
className="mx-2 underline cursor-pointer"
|
||||||
|
onClick={() => {
|
||||||
|
chatStore.systemMessageContent = "";
|
||||||
|
chatStore.history = [];
|
||||||
|
setChatStore({ ...chatStore });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{Tr("Reset Current")}
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
<hr className="my-2" />
|
<hr className="my-2" />
|
||||||
<div className="flex flex-wrap">
|
<div className="flex flex-wrap">
|
||||||
{templates.map((t, index) => (
|
{templates.map((t, index) => (
|
||||||
@@ -422,9 +434,7 @@ export default function ChatBOX(props: {
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (
|
if (!confirm("Are you sure to delete this template?")) {
|
||||||
!confirm("Are you sure to delete this template?")
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
templates.splice(index, 1);
|
templates.splice(index, 1);
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ const LANG_MAP: Record<string, string> = {
|
|||||||
reset: "重置",
|
reset: "重置",
|
||||||
example: "示例",
|
example: "示例",
|
||||||
render: "渲染",
|
render: "渲染",
|
||||||
|
"reset current": "清空当前会话",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default LANG_MAP;
|
export default LANG_MAP;
|
||||||
|
|||||||
Reference in New Issue
Block a user