@directus-labs/ai-focal-point-detection-operation
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,1 +0,1 @@ | ||
import{request as e,log as t}from"directus:api";var o={id:"directus-labs-focal-point-detection-operation",handler:async({apiKey:o,url:r})=>{try{const t=await e("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({model:"gpt-4-vision-preview",max_tokens:300,messages:[{role:"user",content:[{type:"text",text:"Look at the image and tell me what the center point for cropping should be. If the top left is the origin, please provide x,y coordinates in a json object with three properties - focal_point_x, focal_point_y, and a reason for this being the center focal point. Provide no other text - just the object. Do not format it for publishing - I want the first character of your response to be { and the last to be }. Only JSON, ready to be used in an application. To clarify - the format should be { focal_point_x: int, focal_point_y: int, reason: string }"},{type:"image_url",image_url:{url:r}}]}]})});if(200!=t.status)throw new Error("An error occurred when accessing OpenAI");return JSON.parse(t.data.choices[0].message.content)}catch(e){throw t(JSON.stringify(e)),new Error(e.message)}}};export{o as default}; | ||
import{request as t,log as e}from"directus:api";var o={id:"directus-labs-focal-point-detection-operation",handler:async({apiKey:o,url:r})=>{try{const e=await t("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify({model:"gpt-4o",max_tokens:300,messages:[{role:"user",content:[{type:"text",text:"Look at the image and tell me what the center point for cropping should be. If the top left is the origin, please provide x,y coordinates in a json object with three properties - focal_point_x, focal_point_y, and a reason for this being the center focal point. Provide no other text - just the object. Do not format it for publishing - I want the first character of your response to be { and the last to be }. Only JSON, ready to be used in an application. To clarify - the format should be { focal_point_x: int, focal_point_y: int, reason: string }"},{type:"image_url",image_url:{url:r}}]}]})});if(200!=e.status)throw new Error("An error occurred when accessing OpenAI");return JSON.parse(e.data.choices[0].message.content)}catch(t){throw e(JSON.stringify(t)),new Error(t.message)}}};export{o as default}; |
@@ -1,1 +0,1 @@ | ||
var e={id:"directus-labs-focal-point-detection-operation",name:"AI Focal Point Detection",icon:"image_search",description:"Use OpenAI's Vision APIs to determine the point of interest in an image",overview:({url:e})=>[{label:"URL",text:e}],options:[{field:"apiKey",name:"OpenAI API Key",type:"string",meta:{width:"full",interface:"input",options:{masked:!0}}},{field:"url",name:"File URL",type:"string",required:!0,meta:{width:"full",interface:"input"}}]};export{e as default}; | ||
var e={id:"directus-labs-focal-point-detection-operation",name:"AI Focal Point Detection",icon:"image_search",description:"Use OpenAI's GPT-4o API to determine the point of interest in an image",overview:({url:e})=>[{label:"URL",text:e}],options:[{field:"apiKey",name:"OpenAI API Key",type:"string",meta:{width:"full",interface:"input",options:{masked:!0}}},{field:"url",name:"File URL",type:"string",required:!0,meta:{width:"full",interface:"input"}}]};export{e as default}; |
@@ -5,3 +5,3 @@ { | ||
"icon": "extension", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "directus", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5301