ProStack provides custom components for displaying user and assistant messages:
import { UserBubble } from "@/app/(app)/chat/components/chat-bubbles/user";import { AssistantBubble } from "@/app/(app)/chat/components/chat-bubbles/assistant";// User message<UserBubble content="How can I deploy ProStack to production?" />// Assistant message<AssistantBubble chatId="msg-123" content="You can deploy ProStack using Docker or Vercel. Here's how..." currentFeedback="neutral"/>
To integrate with the chat functionality in your code:
// Client-side chat interactionimport { createChat, sendMessage } from "@/app/actions/ai/actions";// Create a new chat conversationconst newConversation = await createChat();// Send a message to the conversationconst response = await sendMessage({ conversationId: newConversation.id, message: "How can I deploy ProStack to production?"});
// Define a new tool in app/actions/ai/index.tsexport const agentTools = { // Existing tools... weather: { description: "Get current weather information", parameters: { type: "object", properties: { location: { type: "string", description: "The city and state, e.g. San Francisco, CA" } }, required: ["location"] } }};// Implement the tool handler// In app/actions/ai/tools/weather.tsexport async function handleWeatherTool(args: { location: string }) { // Fetch weather data from an API const weatherData = await fetchWeatherData(args.location); return weatherData;}