用 Craft 創想

使用 Craft 的 API 建構Craft Agents

啟用 API 後,您的 Craft 文件即可用於支援您建立的應用程式。之後,您可以存取Craft Agents並使用文件資料建立新的應用程式。

Craft
Craft Agents

Enabling the API for Documents

First, you have to enable the API in order for Craft to setup an API endpoint for your documents. Then, you use the API endpoint URL to connect to the server from Craft Agents.

步驟1

Open the “Imagine” tab

步驟2

Click “Add Your First API Connection”

步驟3

Configure your API connection with a name.

步驟4

Click “Add Document” to select which documents this API connection has access to.

步驟5

The API URL that will be used to interact with your document is now displayed at the top

步驟6

Click the “Download AI Bundle” button. This will download a folder containing the API documentation and the content of your doc.

Using the API in a Craft Agents Prompt

Once the API is enabled for your Craft docs, you can now focus on writing a prompt that Craft Agents will use to generate your project.

In order for Craft Agents to see how to use the API and understand the structure of your document, you attach the AI bundle to your prompt. This bundle is a markdown document that contains the current content of your Craft doc as well as the API documentation.

步驟1

打開Craft Agents,然後在側邊欄中找到「來源」。點擊“新增來源”或“+”按鈕開始。

步驟2

在聊天輸入框中貼上 API 端點 URL。例如:「連接到 https://api.craft.do/...」。代理會自動處理其餘操作。

步驟3

代理建立來源配置,設定權限,並驗證與 Craft API 的連線。

步驟4

在 Craft 授權頁面上,選擇要連接的空間,然後按一下「核准」。您的代理現已連線並可使用。

一些入門建議

瀏覽範例