Skip to content

Commit 1bfb597

Browse files
committed
[NEB-229] Nebula: Do not send follow-up prompt if there's another tx to be executed after current tx
1 parent 20d182b commit 1bfb597

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

apps/dashboard/src/app/nebula-app/(app)/components/ChatPageContent.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,6 @@ export function ChatPageContent(props: {
375375
chatAbortController?.abort();
376376
setChatAbortController(undefined);
377377
setIsChatStreaming(false);
378-
// if last message is presence, remove it
379-
if (messages[messages.length - 1]?.type === "presence") {
380-
setMessages((prev) => prev.slice(0, -1));
381-
}
382378
}}
383379
context={contextFilters}
384380
setContext={(v) => {

apps/dashboard/src/app/nebula-app/(app)/components/Chats.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export function Chats(props: {
173173
isMessagePending={isMessagePending}
174174
client={props.client}
175175
sendMessage={props.sendMessage}
176+
nextMessage={props.messages[index + 1]}
176177
/>
177178
</ScrollShadow>
178179

@@ -207,8 +208,9 @@ function RenderMessage(props: {
207208
isMessagePending: boolean;
208209
client: ThirdwebClient;
209210
sendMessage: (message: string) => void;
211+
nextMessage: ChatMessage | undefined;
210212
}) {
211-
const { message, isMessagePending, client, sendMessage } = props;
213+
const { message, isMessagePending, client, sendMessage, nextMessage } = props;
212214

213215
switch (message.type) {
214216
case "assistant":
@@ -237,6 +239,11 @@ function RenderMessage(props: {
237239
txData={message.data}
238240
client={client}
239241
onTxSettled={(txHash) => {
242+
// do not send automatic prompt if there is another transaction after this one
243+
if (nextMessage?.type === "action") {
244+
return;
245+
}
246+
240247
sendMessage(getTransactionSettledPrompt(txHash));
241248
}}
242249
/>
@@ -254,8 +261,13 @@ function RenderMessage(props: {
254261
<SwapTransactionCard
255262
swapData={message.data}
256263
client={client}
257-
onTxSettled={() => {
258-
// no op
264+
onTxSettled={(txHash) => {
265+
// do not send automatic prompt if there is another transaction after this one
266+
if (nextMessage?.type === "action") {
267+
return;
268+
}
269+
270+
sendMessage(getTransactionSettledPrompt(txHash));
259271
}}
260272
/>
261273
);

0 commit comments

Comments
 (0)