PluginProbe
Extendify / 1.9.1
Extendify v1.9.1
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Draft / api / Data.js

Data.js in Extendify 1.9.1, at src/Draft/api/Data.js

22 lines 690 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n'
2
3 const DRAFT_URL = 'https://ai.extendify.com/api/draft'
4 // const DRAFT_URL = 'http://localhost:3000/api/draft'
5
6 export const completion = async (prompt, promptType, systemMessageKey) => {
7 const response = await fetch(`${DRAFT_URL}/completion`, {
8 method: 'POST',
9 headers: { 'Content-Type': 'application/json' },
10 body: JSON.stringify({ prompt, promptType, systemMessageKey }),
11 })
12
13 if (!response.ok) {
14 if (response.status === 429) {
15 throw new Error(__('Service temporarily unavailable', 'extendify'))
16 }
17 throw new Error(`Server error: ${response.status}`)
18 }
19
20 return response
21 }
22