UNPKG

directus-extension-ai-sdk-bundle

Version:

A small bundle of Flow Operations which enable interaction with the [OpenAI](https://beta.openai.com/overview) and [Stability](https://stability.ai/) API's.

2 lines (1 loc) 9.14 kB
import{defineOperationApp as e}from"@directus/extensions-sdk";const t=[],a=[],l=[],i=[],n=[],s=[],o=[{id:"dall-e-operation",name:"DALL-E Image Generator",icon:"image",description:"DALL-E Image Generator!",overview:({text:e,save_assets:t=!0})=>[{label:"Prompt",text:e},{label:"Save To File Library",text:t?"Yes":"No"}],options:[{field:"text",name:"Prompt",type:"text",meta:{width:"full",interface:"input-multiline",options:{trim:!0}}},{field:"save_assets",name:"Save To File Library",type:"boolean",schema:{default_value:!0},meta:{field:"save_assets",special:["cast-boolean"],interface:"boolean",options:null}},{field:"amount",name:"# of pictures",type:"integer",schema:{default_value:1},meta:{field:"amount",special:null,interface:"slider",options:{minValue:1,maxValue:10,stepInterval:1,alwaysShowValue:!0},width:"half",group:"advanced"}},{field:"size",name:"Image Size",type:"string",schema:{default_value:"1024x1024"},meta:{field:"size",special:null,interface:"select-dropdown",options:{choices:[{text:"256x256",value:"256x256"},{text:"512x512",value:"512x512"},{text:"1024x1024",value:"1024x1024"}]},width:"half",group:"advanced"}},{field:"api_key",name:"OpenAI API Key Override",type:"string",meta:{width:"full",interface:"input",special:null,options:{masked:!0,placeholder:"Use globally set key..."},group:"advanced"}},{field:"advanced",name:"Advanced Settings",type:"alias",meta:{field:"advanced",special:["alias","no-data","group"],interface:"group-detail",options:{start:"closed"},width:"full"}}]},e({id:"stable-diffusion-operation",name:"Stable Diffusion Image Generator",icon:"image",description:"Stable Diffusion Image Generator",overview:({prompt:e,negative:t="blurry, bad",style:a="cinematic",engine:l="stable-diffusion-512-v2-1"})=>[{label:"Prompt",text:e},{label:"Negative Prompt",text:t},{label:"Style",text:a},{label:"Engine",text:l}],options:[{field:"prompt",name:"Prompt",type:"string",meta:{width:"full",interface:"input"}},{field:"style",name:"Style",type:"string",meta:{width:"full",interface:"input"},schema:{default_value:"cinematic"}},{field:"width",name:"Width",type:"integer",meta:{width:"half",interface:"slider",options:{minValue:512,maxValue:1024,stepInterval:64,alwaysShowValue:!0},group:"advanced"},schema:{default_value:512}},{field:"height",name:"Height",type:"integer",meta:{width:"half",interface:"slider",options:{minValue:512,maxValue:1024,stepInterval:64,alwaysShowValue:!0},group:"advanced"},schema:{default_value:512}},{field:"cfg_scale",name:"CFG Scale",type:"integer",meta:{width:"half",interface:"slider",options:{minValue:0,maxValue:20,stepInterval:1,alwaysShowValue:!0},group:"advanced"},schema:{default_value:7}},{field:"steps",name:"Steps",type:"integer",meta:{width:"half",interface:"slider",options:{minValue:10,maxValue:150,stepInterval:1,alwaysShowValue:!0},group:"advanced"},schema:{default_value:50}},{field:"engine",name:"Engine",type:"string",schema:{default_value:"stable-diffusion-512-v2-1"},meta:{width:"full",interface:"select-dropdown",options:{choices:[{value:"stable-diffusion-xl-1024-v0-9",text:"stable-diffusion-xl-1024-v0-9"},{value:"stable-diffusion-xl-1024-v1-0",text:"stable-diffusion-xl-1024-v1-0"},{value:"stable-diffusion-v1",text:"stable-diffusion-v1"},{value:"stable-diffusion-v1-5",text:"stable-diffusion-v1-5"},{value:"stable-diffusion-512-v2-0",text:"stable-diffusion-512-v2-0"},{value:"stable-diffusion-768-v2-0",text:"stable-diffusion-768-v2-0"},{value:"stable-diffusion-depth-v2-0",text:"stable-diffusion-depth-v2-0"},{value:"stable-diffusion-512-v2-1",text:"stable-diffusion-512-v2-1"},{value:"stable-diffusion-768-v2-1",text:"stable-diffusion-768-v2-1"}]},group:"advanced"}},{field:"negative",name:"Negative Prompt",type:"string",meta:{width:"full",interface:"input",group:"advanced"},schema:{default_value:"blurry, bad"}},{field:"location",name:"Storage Location",type:"string",meta:{width:"full",interface:"input",group:"advanced"},schema:{default_value:"local"}},{field:"api_key",name:"Stable Diffusion API Key Override",type:"string",meta:{width:"full",interface:"input",special:null,options:{masked:!0,placeholder:"Use globally set key..."},group:"advanced"}},{field:"advanced",name:"Advanced Settings",type:"alias",meta:{field:"advanced",special:["alias","no-data","group"],interface:"group-detail",options:{start:"closed"},width:"full"}}]}),e({id:"chatgpt-operation",name:"ChatGPT Text Generator",icon:"textsms",description:"ChatGPT Text Generator!",overview:({text:e})=>[{label:"Prompt",text:e}],options:[{field:"system",name:"System Prompt",type:"text",meta:{width:"full",interface:"input-multiline",options:{trim:!0}}},{field:"text",name:"Prompt",type:"text",meta:{width:"full",interface:"input-multiline",options:{trim:!0}}},{field:"engine",name:"Model",type:"string",schema:{default_value:"gpt-4o"},meta:{width:"full",interface:"select-dropdown",options:{choices:[{value:"gpt-4o-mini",text:"gpt-4o-mini"},{value:"gpt-4o",text:"gpt-4o"},{value:"gpt-4",text:"GPT-4"},{value:"gpt-4-32k",text:"GPT-4-32k"}]}}},{field:"json_mode",name:"JSON Mode",type:"boolean",meta:{width:"full",note:"Always return a JSON object. See the [OpenAI docs on JSON mode](https://platform.openai.com/docs/guides/text-generation/json-mode) for more information."},schema:{default_value:!1}},{field:"stream",name:"Stream",type:"boolean",meta:{width:"full",note:"Stream the response before returning",group:"advanced"},schema:{default_value:!1}},{field:"temperature",name:"Temperature",type:"float",schema:{default_value:.5},meta:{field:"temperature",special:null,interface:"slider",options:{minValue:0,maxValue:0,stepInterval:.01,alwaysShowValue:!0},width:"half",group:"advanced"}},{field:"max_tokens",name:"Maximum Length",type:"integer",schema:{default_value:2048},meta:{field:"max_tokens",special:null,interface:"slider",options:{minValue:1,maxValue:4e3,stepInterval:1,alwaysShowValue:!0},width:"half",group:"advanced"}},{field:"top_p",name:"Top P",type:"float",schema:{default_value:1},meta:{field:"top_p",special:null,interface:"slider",options:{minValue:0,maxValue:1,stepInterval:.01,alwaysShowValue:!0},width:"half",group:"advanced"}},{field:"frequency_penalty",name:"Frequency Penalty",type:"float",schema:{default_value:0},meta:{field:"frequency_penalty",special:null,interface:"slider",options:{minValue:0,maxValue:2,stepInterval:.01,alwaysShowValue:!0},width:"half",group:"advanced"}},{field:"presence_penalty",name:"Presence Penalty",type:"float",schema:{default_value:0},meta:{field:"presence_penalty",special:null,interface:"slider",options:{minValue:0,maxValue:2,stepInterval:.01,alwaysShowValue:!0},width:"half",group:"advanced"}},{field:"api_key",name:"OpenAI API Key",type:"string",meta:{width:"full",interface:"input",special:null,options:{masked:!0,placeholder:"Use globally set key..."},group:"advanced"}},{field:"base_url",name:"Base Url",type:"string",meta:{width:"full",interface:"input",special:null,options:{masked:!1,placeholder:"Override the default base URL for the API"},group:"advanced"}},{field:"amodel",name:"Model",type:"string",meta:{width:"full",interface:"input",special:null,options:{masked:!1,placeholder:"If not using ChatGPT"},group:"advanced"}},{field:"advanced",name:"Advanced Settings",type:"alias",meta:{field:"advanced",special:["alias","no-data","group"],interface:"group-detail",options:{start:"closed"},width:"full"}},{field:"thread",name:"Messages",type:"json",meta:{width:"full",interface:"list",options:{fields:[{field:"role",name:"Role",type:"string",meta:{interface:"select-dropdown",options:{choices:[{text:"System",value:"system"},{text:"Assistant",value:"assistant"},{text:"User",value:"user"}]},width:"full"}},{field:"content",name:"Message",type:"text",meta:{interface:"textarea",width:"full"}}]},note:"Visit the [docs of the AI Writer Operation extension](https://github.com/directus-labs/extension-ai-writer-operation/blob/main/README.md) to learn how to use the Messages field"}}]}),{id:"whisper-operation",name:"Whisper Speech to Text",icon:"mic",description:"Whisper Speech to Text",overview:({asset_id:e,translate:t=!1,prompt:a=""})=>[a?{label:"Prompt",text:a}:{},{label:"File",text:e},{label:"Translate to EN",text:t?"Yes":"No"}],options:[{field:"asset_id",name:"File",type:"string",meta:{width:"full",interface:"input"}},{field:"translate",name:"Translate to EN",type:"boolean",meta:{width:"full",interface:"toggle"}},{field:"prompt",name:"Prompt",type:"string",meta:{width:"full",interface:"input",group:"advanced"}},{field:"temperature",name:"Temperature",type:"float",schema:{default_value:0},meta:{field:"temperature",special:null,interface:"slider",options:{minValue:0,maxValue:1,stepInterval:.01,alwaysShowValue:!0},group:"advanced"}},{field:"api_key",name:"OpenAI API Key",type:"string",meta:{width:"full",interface:"input",special:null,options:{masked:!0,placeholder:"Use globally set key..."},group:"advanced"}},{field:"advanced",name:"Advanced Settings",type:"alias",meta:{field:"advanced",special:["alias","no-data","group"],interface:"group-detail",options:{start:"closed"},width:"full"}}]}];export{a as displays,t as interfaces,l as layouts,i as modules,o as operations,n as panels,s as themes};