admin08077/Githubgemini
0
1import{G as l,T as a}from"./@google-D80DdW2m.js";import{I as c}from"./index-Ck8YGBbR.js";const d="AIzaSyCl4hPv_njJ9qLytv1QNPE3MmCFZJr9Wgk",s=new l({apiKey:d});async function*t(e,o,i=.5){try{const r=await s.models.generateContentStream({model:"gemini-2.5-flash",contents:e,config:{systemInstruction:o,temperature:i}});for await(const n of r)yield n.text}catch(r){console.error("Error streaming from AI model:",r),c(r,{prompt:e,systemInstruction:o}),r instanceof Error?yield`An error occurred while communicating with the AI model: ${r.message}`:yield"An unknown error occurred while generating the response."}}async function p(e,o,i,r=.2){try{const n=await s.models.generateContent({model:"gemini-2.5-flash",contents:e,config:{systemInstruction:o,responseMimeType:"application/json",responseSchema:i,temperature:r}});return JSON.parse(n.text.trim())}catch(n){throw console.error("Error generating JSON from AI model:",n),c(n,{prompt:e,systemInstruction:o}),n}}const h=e=>t(`Generate a single valid JavaScript regex literal (e.g., /abc/gi) for the following description. Respond with ONLY the regex literal and nothing else: "${e}"`,"You are an expert in regular expressions. You only output valid JavaScript regex literals.",.7),f=e=>t({parts:[{text:"Generate a single-file React component using Tailwind CSS that looks like this image. Respond with only the code in a markdown block."},{inlineData:{mimeType:"image/png",data:e}}]},"You are an expert frontend developer specializing in React and Tailwind CSS. You create clean, functional components from screenshots."),u=e=>t(`Analyze this git log and create a changelog:2 3\`\`\`4${e}5\`\`\``,"You are a git expert and project manager. Analyze the provided git log and generate a clean, categorized changelog in Markdown format. Group changes under 'Features' and 'Fixes'.",.6),y=e=>t(`Enhance this code snippet. Add comments, improve variable names, and refactor for clarity or performance if possible.6 7\`\`\`8${e}9\`\`\``,"You are a senior software engineer who excels at improving code. Respond with only the enhanced code in a markdown block.",.5),S=e=>t(`Analyze this JavaScript code for potential concurrency issues, especially related to Web Workers. Identify race conditions, deadlocks, or inefficient data passing.10 11\`\`\`javascript12${e}13\`\`\``,"You are an expert in JavaScript concurrency, web workers, and multi-threaded programming concepts.",.6),x=e=>t(`Convert the following JSON to a simplified, XBRL-like XML format. Use meaningful tags based on the JSON keys. The root element should be <xbrl>. Do not include XML declarations or namespaces.14 15JSON:16${e}`,"You are an expert in data formats who converts JSON to clean, XBRL-like XML."),w=async e=>{const o="You are a UI/UX design expert specializing in color theory. Generate a color theme based on the user's description. Provide hex codes for each color.",i=`Generate a color theme for: "${e}"`,r={type:a.OBJECT,properties:{primary:{type:a.STRING,description:"The primary accent color."},background:{type:a.STRING,description:"The main background color."},surface:{type:a.STRING,description:"The color for card backgrounds or surfaces."},textPrimary:{type:a.STRING,description:"The color for primary text."},textSecondary:{type:a.STRING,description:"The color for secondary or muted text."}},required:["primary","background","surface","textPrimary","textSecondary"]};return p(i,o,r)};export{f as a,w as b,x as c,u as d,y as e,S as f,h as g};17//# sourceMappingURL=geminiService-Cgwdboli.js.map18 