Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ The following is the user's message:
return (
<>
<NebulaChatButton
networks={chain.testnet ? "testnet" : "mainnet"}
isFloating={true}
pageType="chain"
authToken={authToken ?? undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ The following is the user's message:`;
client={client}
>
<NebulaChatButton
networks={info.chainMetadata.testnet ? "testnet" : "mainnet"}
isFloating={true}
pageType="contract"
authToken={authToken ?? undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export default async function SupportPage() {
</p>
<div className="mt-6 flex w-full flex-col items-center gap-3">
<NebulaChatButton
networks="all"
isFloating={false}
pageType="support"
authToken={authToken ?? undefined}
Expand Down
4 changes: 4 additions & 0 deletions apps/dashboard/src/app/nebula-app/(app)/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { NebulaTxData } from "../components/Chats";
export type NebulaContext = {
chainIds: string[] | null;
walletAddress: string | null;
networks: "mainnet" | "testnet" | "all" | null;
};

export async function promptNebula(params: {
Expand All @@ -26,6 +27,7 @@ export async function promptNebula(params: {
body.context = {
chain_ids: params.context.chainIds || [],
wallet_address: params.context.walletAddress,
networks: params.context.networks,
};
}

Expand Down Expand Up @@ -116,6 +118,7 @@ export async function promptNebula(params: {
const contextData = JSON.parse(data.data) as {
wallet_address: string;
chain_ids: number[];
networks: NebulaContext["networks"];
};

params.handleStream({
Expand Down Expand Up @@ -165,6 +168,7 @@ type ChatStreamedResponse =
data: {
wallet_address: string;
chain_ids: number[];
networks: NebulaContext["networks"];
};
};

Expand Down
2 changes: 2 additions & 0 deletions apps/dashboard/src/app/nebula-app/(app)/api/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export async function createSession(params: {
body.context = {
chain_ids: params.context.chainIds || [],
wallet_address: params.context.walletAddress,
networks: params.context.networks,
};
}

Expand Down Expand Up @@ -47,6 +48,7 @@ export async function updateSession(params: {
body.context = {
chain_ids: params.contextFilters.chainIds || [],
wallet_address: params.contextFilters.walletAddress,
networks: params.contextFilters.networks,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export function ChatBar(props: {
props.setContext({
walletAddress: props.context?.walletAddress || null,
chainIds: values.map((x) => x.toString()),
networks: props.context?.networks || null,
});
}}
priorityChains={[
Expand All @@ -156,6 +157,7 @@ export function ChatBar(props: {
props.setContext({
walletAddress: walletMeta.address,
chainIds: props.context?.chainIds || [],
networks: props.context?.networks || null,
});
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export function ChatPageContent(props: {
props.initialParams?.chainIds.map((x) => x.toString()) ||
[],
walletAddress: contextRes?.wallet_address || props.accountAddress || null,
networks: "mainnet",
};

return value;
Expand Down Expand Up @@ -131,6 +132,7 @@ export function ChatPageContent(props: {
: {
chainIds: [],
walletAddress: null,
networks: null,
};

if (!updatedContextFilters.walletAddress && address) {
Expand Down Expand Up @@ -594,6 +596,7 @@ export async function handleNebulaPrompt(params: {
setContextFilters({
chainIds: res.data.chain_ids.map((x) => x.toString()),
walletAddress: res.data.wallet_address,
networks: res.data.networks,
});
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function Story() {
isStreaming={false}
context={{
chainIds: ["1"],
networks: null,
walletAddress: null,
}}
showContextSelector={true}
Expand All @@ -60,6 +61,7 @@ function Story() {
isStreaming={false}
context={{
chainIds: ["1", "137", "10"],
networks: null,
walletAddress: null,
}}
showContextSelector={true}
Expand All @@ -72,6 +74,7 @@ function Story() {
isStreaming={false}
context={{
chainIds: ["1", "137", "10", "146", "80094"],
networks: null,
walletAddress: null,
}}
showContextSelector={true}
Expand All @@ -89,6 +92,7 @@ function Story() {
isStreaming={false}
context={{
chainIds: ["1", "137", "10", "146", "80094"],
networks: null,
walletAddress: null,
}}
showContextSelector={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useState,
} from "react";
import type { ThirdwebClient } from "thirdweb";
import type { NebulaContext } from "../../api/chat";
import type { ExamplePrompt } from "../../data/examplePrompts";
import { NebulaIcon } from "../../icons/NebulaIcon";

Expand All @@ -25,6 +26,7 @@ export function NebulaChatButton(props: {
pageType: "chain" | "contract" | "support";
authToken: string | undefined;
examplePrompts: ExamplePrompt[];
networks: NebulaContext["networks"];
label: string;
client: ThirdwebClient;
isFloating: boolean;
Expand Down Expand Up @@ -91,6 +93,7 @@ export function NebulaChatButton(props: {
</div>

<NebulaChatUIContainer
networks={props.networks}
onClose={closeModal}
isOpen={isOpen}
hasBeenOpened={hasBeenOpened}
Expand All @@ -112,6 +115,7 @@ function NebulaChatUIContainer(props: {
examplePrompts: ExamplePrompt[];
pageType: "chain" | "contract" | "support";
client: ThirdwebClient;
networks: NebulaContext["networks"];
nebulaParams:
| {
messagePrefix: string;
Expand Down Expand Up @@ -187,6 +191,7 @@ function NebulaChatUIContainer(props: {
}
>
<LazyFloatingChatContent
networks={props.networks}
authToken={props.authToken}
client={props.client}
nebulaParams={props.nebulaParams}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default function FloatingChatContent(props: {
client: ThirdwebClient;
examplePrompts: ExamplePrompt[];
pageType: "chain" | "contract" | "support";
networks: NebulaContext["networks"];
nebulaParams:
| {
messagePrefix: string;
Expand All @@ -40,6 +41,7 @@ export default function FloatingChatContent(props: {

return (
<FloatingChatContentLoggedIn
networks={props.networks}
authToken={props.authToken}
client={props.client}
nebulaParams={props.nebulaParams}
Expand All @@ -54,6 +56,7 @@ function FloatingChatContentLoggedIn(props: {
client: ThirdwebClient;
pageType: "chain" | "contract" | "support";
examplePrompts: ExamplePrompt[];
networks: NebulaContext["networks"];
nebulaParams:
| {
messagePrefix: string;
Expand Down Expand Up @@ -82,6 +85,7 @@ function FloatingChatContentLoggedIn(props: {
props.nebulaParams?.chainIds.map((chainId) => chainId.toString()) ||
null,
walletAddress: props.nebulaParams?.wallet || null,
networks: props.networks,
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function NebulaLoggedOutStatePage(props: {
context={{
walletAddress: null,
chainIds: chainIds.map((x) => x.toString()),
networks: null,
}}
setContext={(v) => {
if (v?.chainIds) {
Expand Down
Loading