Skip to content

Commit 724e7d9

Browse files
committed
[TOOL-3419] Nebula: Add hardcoded reply for Nebula Capabilities (#6298)
<!-- ## 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 user interface and functionality of various components in the dashboard application, particularly in handling links, chat interactions, and example prompts for a feature called Nebula. ### Detailed summary - Updated `className` for improved styling in `markdown-renderer.tsx`. - Changed `backgroundImage` gradient in `EmptyStateChatPageContent.tsx`. - Added `target` attribute for external links in `Sidebar.tsx`. - Introduced `examplePrompts` with new responses in `ChatPageContent.tsx`. - Added `interceptedReply` to `ExamplePrompt` interface in `examplePrompts.ts`. - Provided detailed descriptions of Nebula's capabilities in `examplePrompts.ts`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent c30b6d7 commit 724e7d9

File tree

5 files changed

+80
-9
lines changed

5 files changed

+80
-9
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { useActiveAccount, useActiveWalletChain } from "thirdweb/react";
1717
import { type NebulaContext, promptNebula } from "../api/chat";
1818
import { createSession, updateSession } from "../api/session";
1919
import type { SessionInfo } from "../api/types";
20+
import { examplePrompts } from "../data/examplePrompts";
2021
import { newChatPageUrlStore, newSessionsStore } from "../stores";
2122
import { ChatBar } from "./ChatBar";
2223
import { type ChatMessage, Chats } from "./Chats";
@@ -181,6 +182,23 @@ export function ChatPageContent(props: {
181182
},
182183
]);
183184

185+
const lowerCaseMessage = message.toLowerCase();
186+
// handle hardcoded replies first
187+
const interceptedReply = examplePrompts.find(
188+
(prompt) => prompt.message.toLowerCase() === lowerCaseMessage,
189+
)?.interceptedReply;
190+
191+
if (interceptedReply) {
192+
// slight delay to match other response times
193+
await new Promise((resolve) => setTimeout(resolve, 1000));
194+
setMessages((prev) => [
195+
...prev.slice(0, -1),
196+
{ type: "assistant", text: interceptedReply, request_id: undefined },
197+
]);
198+
199+
return;
200+
}
201+
184202
setIsChatStreaming(true);
185203
setEnableAutoScroll(true);
186204
const abortController = new AbortController();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function DashedBgDiv(props: {
105105
<div
106106
className={props.className}
107107
style={{
108-
backgroundImage: `linear-gradient(${props.type === "horizontal" ? "90deg" : "180deg"}, hsl(var(--foreground)/20%) 0 30%, transparent 0 100%)`,
108+
backgroundImage: `linear-gradient(${props.type === "horizontal" ? "90deg" : "180deg"}, hsl(var(--active-border)) 0 30%, transparent 0 100%)`,
109109
backgroundRepeat: "repeat",
110110
backgroundSize: "10px 10px",
111111
maskImage: `linear-gradient(${

apps/dashboard/src/app/nebula-app/(app)/data/examplePrompts.ts

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,68 @@
11
type ExamplePrompt = {
22
title: string;
33
message: string;
4+
interceptedReply?: string;
45
};
56

6-
// Note:
7-
// Keep the title as short as possible so 2 of them can fit in a single row on desktop viewport
8-
// title is only used for displaying the example - the `message` is sent to server when user clicks on the example - it can be as long and descriptive as needed
7+
const whatCanNebulaDoReply = `
8+
Nebula is a natural language model with improved blockchain reasoning, autonomous transaction capabilities, and real-time access to the blockchain.
9+
[Learn more about Nebula](https://portal.thirdweb.com/nebula)
10+
11+
Here are some example actions you can perform with Nebula:
12+
13+
### Bridge & Swap
14+
Bridge and swap native currencies
15+
- Swap 1 USDC to 1 USDT on the Ethereum Mainnet
16+
- Bridge 0.5 ETH from Ethereum Mainnet to Polygon
17+
18+
### Transfer
19+
Send native and ERC-20 currencies
20+
- Send 0.1 ETH to vitalik.eth
21+
- Transfer 1 USDC to saminacodes.eth on Base
22+
23+
### Deploy
24+
Deploy published contracts
25+
- Deploy a Token ERC20 Contract
26+
- Deploy a Split contract with two recipients.
27+
- Deploy an ERC1155 Contract named 'Hello World' with description 'Hello badges on Ethereum'
28+
29+
### Understand
30+
Retrieve information about smart contracts.
31+
- What ERC standards are implemented by contract address 0x59325733eb952a92e069C87F0A6168b29E80627f on Ethereum?
32+
- What functions can I use to mint more of my contract's NFTs?
33+
- What is the total supply of NFTs for my contract?
34+
35+
### Interact
36+
Query wallet balances, addresses, and token holdings.
37+
- How much ETH is in my wallet?
38+
- What is the wallet address of vitalik.eth?
39+
- Does my wallet hold USDC on Base?
40+
41+
### Explore
42+
Access blockchain-specific data.
43+
- What is the last block on zkSync?
44+
- What is the current gas price on Avalanche C-Chain?
45+
- Can you show me transaction details for 0xdfc450bb39e44bd37c22e0bfd0e5212edbea571e4e534d87b5cbbf06f10b9e04 on Optimism?
46+
47+
### Research
48+
Obtain details about tokens, their addresses, and current prices.
49+
- What is the address of USDC on Ethereum?
50+
- Is there a UNI token on Arbitrum?
51+
- What is the current price of ARB?
52+
53+
### Build
54+
Implement features using Web3 SDKs and tools.
55+
- How can I add a connect wallet button to my web app? I want to support users connecting with both email/social wallets and MetaMask and use smart wallets.
56+
- Can you show me how to claim an NFT from an ERC721 using TypeScript?
57+
- I have an ERC1155 contract from thirdweb. Can you show me how to generate and mint with a signature?
58+
`;
959

1060
export const examplePrompts: ExamplePrompt[] = [
61+
{
62+
title: "What can Nebula do?",
63+
message: "What can Nebula do?",
64+
interceptedReply: whatCanNebulaDoReply,
65+
},
1166
{
1267
title: "Deploy an ERC-20 Token",
1368
message:
@@ -25,8 +80,4 @@ export const examplePrompts: ExamplePrompt[] = [
2580
title: "Transfer 0.001 ETH to thirdweb.eth",
2681
message: "Transfer 0.001 ETH to thirdweb.eth",
2782
},
28-
{
29-
title: "Using session keys in Unity",
30-
message: "How to use session key in Unity?",
31-
},
3283
];

apps/dashboard/src/components/contract-components/published-contract/markdown-renderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const MarkdownRenderer: React.FC<{
9898
href={props.href ?? "#"}
9999
target="_blank"
100100
{...cleanedProps(props)}
101-
className="mt-4 text-link-foreground hover:text-foreground"
101+
className="mt-4 underline decoration-muted-foreground/50 decoration-dotted underline-offset-[5px] hover:text-foreground hover:decoration-foreground hover:decoration-solid"
102102
/>
103103
),
104104

apps/portal/src/components/others/Sidebar.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) {
110110
<Link
111111
href={link.href}
112112
onClick={props.onLinkClick}
113+
target={link.href.startsWith("http") ? "_blank" : undefined}
113114
className={clsx(
114115
"overflow-hidden text-ellipsis py-1.5 font-medium text-base transition-colors duration-300 hover:text-foreground",
115116
isActive ? "font-medium text-foreground" : "text-muted-foreground",
@@ -127,6 +128,7 @@ function SidebarItem(props: { link: SidebarLink; onLinkClick?: () => void }) {
127128
return (
128129
<Link
129130
href={link.href}
131+
target={link.href.startsWith("http") ? "_blank" : undefined}
130132
onClick={props.onLinkClick}
131133
className={clsx(
132134
"block overflow-hidden text-ellipsis py-1.5 font-medium text-base transition-colors duration-300 hover:text-foreground",

0 commit comments

Comments
 (0)