Remove confirm tips of cost

This commit is contained in:
Rankin Zheng 2023-12-22 04:53:30 +08:00
parent ef80e19a61
commit ff4a8ce754
2 changed files with 5 additions and 59 deletions

View File

@ -59,7 +59,6 @@ const MessageList = observer((props: any) => {
type: messageType,
hash: messageHash,
contexts,
confirm,
} = item;
// setMessage(messageText);
return (
@ -89,46 +88,6 @@ const MessageList = observer((props: any) => {
},
}}
>
{messageType === "bot" && confirm && (
<Card
shadow="sm"
padding="xs"
radius="md"
withBorder
className={classes.card}
>
<Card.Section withBorder inheritPadding py="xs">
<Group position="left">
<IconInfoSquareRounded size={20} />
<Text fw={500}>GPT-4 Usage Required</Text>
</Group>
</Card.Section>
<Text className={classes.cardDescription}>
DevChat will make GPT-4 API calls to analyze up to ten
source files, costing{" "}
<strong>approximately $0.4 USD per question</strong>.
<br />
<br />
Would you like to proceed?
</Text>
<Group position="right">
<Button
size="compact-xs"
className={classes.button}
onClick={() => chat.sendLastUserMessage()}
>
Yes
</Button>
<Button
size="compact-xs"
className={classes.button}
onClick={() => chat.cancelDevchatAsk()}
>
No
</Button>
</Group>
</Card>
)}
<MessageContext
key={`message-context-${index}`}
contexts={contexts}

View File

@ -80,7 +80,6 @@ export const Message = types.model({
type: types.enumeration(["user", "bot", "system"]),
message: types.string,
contexts: types.maybe(types.array(ChatContext)),
confirm: types.maybe(types.boolean),
});
export const ChatStore = types
@ -214,7 +213,6 @@ DevChat key is missing from your environment or settings. Kindly input your DevC
const lastUserMessage = self.messages[self.messages.length - 2];
const lastBotMessage = self.messages[self.messages.length - 1];
if (lastUserMessage && lastUserMessage.type === "user") {
lastBotMessage.confirm = false;
startGenerating(lastUserMessage.message, lastUserMessage.contexts);
}
self.disabled = false;
@ -223,7 +221,6 @@ DevChat key is missing from your environment or settings. Kindly input your DevC
const cancelDevchatAsk = () => {
const lastBotMessage = self.messages[self.messages.length - 1];
if (lastBotMessage && lastBotMessage.type === "bot") {
lastBotMessage.confirm = false;
lastBotMessage.message =
"You've cancelled the question. Please let me know if you have any other questions or if there's anything else I can assist with.";
}
@ -281,22 +278,12 @@ Thinking...123
contexts: chatContexts,
message: userMessage,
});
const isInstalled = true;
if (isInstalled) {
// self.disabled = true;
// self.errorMessage = '';
// self.messages.push({
// type: 'bot',
// message: '',
// confirm: true
// });
self.messages.push({
type: "bot",
message: "",
});
startGenerating(userMessage, chatContexts);
}
self.messages.push({
type: "bot",
message: "",
});
startGenerating(userMessage, chatContexts);
// goto bottom
goScrollBottom();