Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 570fa82

Browse files
committed
feat: make it works with startling
1 parent 97025a7 commit 570fa82

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/app/[lang]/chatgpt-startling-by-each-step/[id]/StartlingStepDetail.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ function StartlingStepDetail({
5757

5858
const handleResponse = (response: ResponseSend) => {
5959
const assistantMessage = response.filter((message) => message.role === "assistant");
60-
console.log(assistantMessage);
6160
const assistantResponse = assistantMessage[0].content;
6261
setResponse(assistantResponse);
6362

src/components/ClickPrompt/ExecutePromptButton.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,30 @@ function ExecutePromptButton(props: ExecButtonProps) {
2929
const [isLoading, setIsLoading] = useState(props.loading);
3030
const { isOpen, onOpen, onClose } = useDisclosure();
3131
const [hasLogin, setHasLogin] = useState(false);
32-
const [localId, setLocalId] = useState(props.conversationId);
3332

3433
const handleClick = async () => {
3534
try {
3635
await UserAPI.isLoggedIn();
36+
setHasLogin(true);
3737
} catch (e) {
3838
onOpen();
3939
setHasLogin(false);
4040
}
4141

42-
if (!localId) {
42+
let conversationId = props.conversationId;
43+
if (!props.conversationId) {
4344
setIsLoading(true);
4445
const conversation: ResponseCreateConversation = await createConversation();
4546
if (!conversation) {
4647
return;
4748
}
4849

49-
const conversationId = conversation.id || 0;
50-
setLocalId(conversationId);
50+
conversationId = conversation.id as number;
5151
props.updateConversationId ? props.updateConversationId(conversationId) : null;
5252
}
5353

54-
if (localId) {
55-
const response: any = await sendMessage(localId, props.text);
54+
if (conversationId) {
55+
const response: any = await sendMessage(conversationId, props.text);
5656
if (response && props.handleResponse) {
5757
props.handleResponse(response as ResponseSend);
5858
}

0 commit comments

Comments
 (0)