1.4.0 dev mode support more ops and args

This commit is contained in:
2023-07-07 18:20:14 +08:00
parent ecfa32f75e
commit 1da4d38799
6 changed files with 176 additions and 30 deletions

View File

@@ -51,19 +51,59 @@ export default function Message(props: Props) {
chat.role === "assistant" ? "justify-start" : "justify-end"
}`}
>
<div
className={`relative w-fit p-2 rounded my-2 ${
chat.role === "assistant"
? "bg-white dark:bg-gray-700 dark:text-white"
: "bg-green-400"
} ${chat.hide ? "opacity-50" : ""}`}
>
<p className="message-content">
{chat.hide
? chat.content.split("\n")[0].slice(0, 16) + "... (deleted)"
: chat.content}
</p>
<DeleteIcon />
<div className=" bg-">
<div
className={`relative w-fit p-2 rounded my-2 ${
chat.role === "assistant"
? "bg-white dark:bg-gray-700 dark:text-white"
: "bg-green-400"
} ${chat.hide ? "opacity-50" : ""}`}
>
{chatStore.develop_mode ? (
<textarea
className="message-content"
value={
chat.hide
? chat.content.split("\n")[0].slice(0, 16) + "... (deleted)"
: chat.content
}
onChange={(event: any) => {
chatStore.history[messageIndex].content = event.target.value;
setChatStore({ ...chatStore });
}}
></textarea>
) : (
<p className="message-content">
{chat.hide
? chat.content.split("\n")[0].slice(0, 16) + "... (deleted)"
: chat.content}
</p>
)}
<DeleteIcon />
</div>
<div>
token {chatStore.history[messageIndex].token}
<button
onClick={() => {
chatStore.history.splice(messageIndex, 1);
chatStore.postBeginIndex = Math.max(
chatStore.postBeginIndex - 1,
0
);
//chatStore.totalTokens =
chatStore.totalTokens = 0;
for (const i of chatStore.history
.filter(({ hide }) => !hide)
.slice(chatStore.postBeginIndex)
.map(({ token }) => token)) {
chatStore.totalTokens += i;
}
setChatStore({ ...chatStore });
}}
>
</button>
</div>
</div>
</div>
</>