Skip to content

Commit 1e82083

Browse files
committed
[NEB-229] Nebula: follow-up prompt improvements, preserve reasoning UI on error (#6925)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the `ChatPageContent` and `Chats` components by managing message handling and improving the logic for sending prompts based on the presence of subsequent messages. ### Detailed summary - Removed logic to delete the last message if it is of type `presence` in `ChatPageContent.tsx`. - Added `nextMessage` prop to `RenderMessage` in `Chats.tsx`. - Updated `onTxSettled` to prevent sending prompts if the `nextMessage` is of type `action`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 20d182b commit 1e82083

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)