File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
examples/nextjs-ai-chatbot Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import { useApp } from "@/contexts/app";
77import { useEffect , useRef } from "react" ;
88import { useParams } from "next/navigation" ;
99import Image from "next/image" ;
10- import { GetToolOutput } from "@/utils/helpers" ;
1110import ToolsOutput from "./tools" ;
1211
1312export default function Messages ( ) {
Original file line number Diff line number Diff line change @@ -112,7 +112,11 @@ function AppProviderInner({ children }: { children: ReactNode }) {
112112 . then ( ( data ) => {
113113 const messages = data . map ( ( message : any ) => ( {
114114 id : message . id ,
115- role : message . user . id === "ai-bot" ? "assistant" : "user" ,
115+ role :
116+ message . user . id === "ai-bot" ||
117+ message . message_type === "agent_response"
118+ ? "assistant"
119+ : "user" ,
116120 parts : [
117121 {
118122 type : "text" ,
Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ export class AISDKStreamStorage {
8686 await this . streamStorage . sendMessage ( channelId , {
8787 text,
8888 userId : this . streamStorage . getBotUserId ( ) ,
89+ metadata : {
90+ message_type : "agent_response" ,
91+ } ,
8992 } ) ;
9093 }
9194 }
@@ -106,6 +109,9 @@ export class AISDKStreamStorage {
106109 toolOutput
107110 ) } \n\`\`\``,
108111 userId : this . streamStorage . getBotUserId ( ) ,
112+ metadata : {
113+ message_type : "agent_response" ,
114+ } ,
109115 } ) ;
110116 }
111117 }
You can’t perform that action at this time.
0 commit comments