Black Friday: Get 40% off Craft for Life!

用 Craft 創想

使用 Craft 的 API 建構OpenAI Codex

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

Craft
OpenAI Codex

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 OpenAI Codex.

Click the “Imagine” tab in the sidebar

步驟1

Open the “Imagine” tab
Click “Add Your First API Connection” button

步驟2

Click “Add Your First API Connection”
Configure API connection settings

步驟3

Configure your API connection with a name.
Click “Add Document” button

步驟4

Click “Add Document” to select which documents this API connection has access to.
API URL displayed at the top

步驟5

The API URL that will be used to interact with your document is now displayed at the top
Click the “Download AI Bundle” button

步驟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 OpenAI Codex Prompt

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

In order for OpenAI Codex 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.

Go to OpenAI Codex

步驟1

在電腦上打開終端機。在只包含下載的「bundle.md」檔案且不包含其他任何檔案的資料夾中啟動 OpenAI Codex。

現在您可以新增提示來描述您想要建立的應用程式。以下是一個非常通用的範例,可用於測試:

請建立一個網站,將我的 Craft 文件內容視覺化。附件中包含如何存取這些資料及其結構的說明。

Run the instructions

步驟2

按下回車鍵,等待 OpenAI Codex 實作您的應用程式。

一些入門建議

瀏覽範例