Merge pull request #3 from devchat-ai/remove_cost_confirm

Remove cost confirm
This commit is contained in:
Rankin Zheng 2023-12-22 04:54:15 +08:00 committed by GitHub
commit 46aca6809f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 60 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

@ -78,7 +78,7 @@ const MessageMarkdown = observer((props: MessageMarkdownProps) => {
Ask anything about your codebase and get answers from our AI agent.
DevChat intelligently navigates your codebase using GPT-4. It automatically selects and analyzes up to ten most relevant source files to answer your question, all at an approximate cost of $0.4 USD. Stay tuned we're soon integrating the more cost-efficient LLama 2 - 70B model.
DevChat intelligently navigates your codebase using GPT-4. It automatically selects and analyzes up to ten most relevant source files to answer your question. Stay tuned we're soon integrating the more cost-efficient LLama 2 - 70B model.
Sample questions:
- Why does the lead time for changes sometimes show as null?

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();