PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
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 / AutoLaunch / functions / extendify-code.js

extendify-code.js in Extendify 3.1.5, at src/AutoLaunch/functions/extendify-code.js

28 lines 923 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { fetchWithTimeout } from '@auto-launch/functions/helpers';
2 import { AI_HOST } from '@constants';
3 import { reqDataBasics } from '@shared/lib/data';
4
5 // Any non-1 answer, bad status, or network failure resolves to 0
6 export const getExtendifyCodeRecommendation = async (description) => {
7 const response = await fetchWithTimeout(
8 `${AI_HOST}/api/launch-decisions/code-recommendation`,
9 {
10 method: 'POST',
11 headers: { 'Content-Type': 'application/json' },
12 body: JSON.stringify({ ...reqDataBasics, description }),
13 },
14 )
15 .then((res) => res.ok && res.json())
16 .catch(() => null);
17 return response?.recommend === 1 ? 1 : 0;
18 };
19
20 export const buildExtendifyCodeLink = (link, { description, title } = {}) => {
21 if (!link) return '';
22 const prompt = [title, description]
23 .map((part) => part?.trim())
24 .filter(Boolean)
25 .join('');
26 return link.replace(/\{DESCRIPTION\}/g, encodeURIComponent(prompt));
27 };
28