fix develop mode style
This commit is contained in:
@@ -51,7 +51,7 @@ export default function Message(props: Props) {
|
|||||||
chat.role === "assistant" ? "justify-start" : "justify-end"
|
chat.role === "assistant" ? "justify-start" : "justify-end"
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className=" bg-">
|
<div>
|
||||||
<div
|
<div
|
||||||
className={`relative w-fit p-2 rounded my-2 ${
|
className={`relative w-fit p-2 rounded my-2 ${
|
||||||
chat.role === "assistant"
|
chat.role === "assistant"
|
||||||
@@ -59,51 +59,38 @@ export default function Message(props: Props) {
|
|||||||
: "bg-green-400"
|
: "bg-green-400"
|
||||||
} ${chat.hide ? "opacity-50" : ""}`}
|
} ${chat.hide ? "opacity-50" : ""}`}
|
||||||
>
|
>
|
||||||
{chatStore.develop_mode ? (
|
<p className="message-content">
|
||||||
<textarea
|
{chat.hide
|
||||||
className="message-content"
|
? chat.content.split("\n")[0].slice(0, 16) + "... (deleted)"
|
||||||
value={
|
: chat.content}
|
||||||
chat.hide
|
</p>
|
||||||
? 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 />
|
<DeleteIcon />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
{chatStore.develop_mode && (
|
||||||
token {chatStore.history[messageIndex].token}
|
<div>
|
||||||
<button
|
token {chatStore.history[messageIndex].token}
|
||||||
onClick={() => {
|
<button
|
||||||
chatStore.history.splice(messageIndex, 1);
|
onClick={() => {
|
||||||
chatStore.postBeginIndex = Math.max(
|
chatStore.history.splice(messageIndex, 1);
|
||||||
chatStore.postBeginIndex - 1,
|
chatStore.postBeginIndex = Math.max(
|
||||||
0
|
chatStore.postBeginIndex - 1,
|
||||||
);
|
0
|
||||||
//chatStore.totalTokens =
|
);
|
||||||
chatStore.totalTokens = 0;
|
//chatStore.totalTokens =
|
||||||
for (const i of chatStore.history
|
chatStore.totalTokens = 0;
|
||||||
.filter(({ hide }) => !hide)
|
for (const i of chatStore.history
|
||||||
.slice(chatStore.postBeginIndex)
|
.filter(({ hide }) => !hide)
|
||||||
.map(({ token }) => token)) {
|
.slice(chatStore.postBeginIndex)
|
||||||
chatStore.totalTokens += i;
|
.map(({ token }) => token)) {
|
||||||
}
|
chatStore.totalTokens += i;
|
||||||
setChatStore({ ...chatStore });
|
}
|
||||||
}}
|
setChatStore({ ...chatStore });
|
||||||
>
|
}}
|
||||||
❌
|
>
|
||||||
</button>
|
❌
|
||||||
</div>
|
</button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user