AiPrompt component
The AiPrompt component is a platform framework component that functions independently with its own platform provider. You can input the Team and a text prompt; use the onResponse callback function to perform actions in your app with the response.
| Callout | Element | Description |
|---|---|---|
| A | Team selector | |
| B | Chat | Starts a new conversation chat |
| C | Prompt | Click to select from a previous conversation to continue |
The following code demonstrates a simple implementation in the Reference App:
import { AiPrompt, PlatformProvider } from "@dtplatform/iaf-ai-components";
const ModelElemChat = ({ onResponse }) => { return ( <div style={{ height: "100%", padding: "1rem" }}> <PlatformProvider> <AiPrompt onResponse={({ ok, request, response, error, convId }) => { console.log( "AI response", { ok, request, convId, response, error } ); onResponse(response.message) }} /> </PlatformProvider> </div> );};
export default ModelElemChat;