{"version":3,"sources":["jsdelivr-header.js","/npm/git-ai-summary@1.3.0/src/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,eAAe,cAAc,GAC3B,MAAM,eACJ,EAAc,cACd,EAAa,mBACb,GACE,QAAQ,aAYN,EAAO,IAVO,CAClB,MAAO,QAAQ,IAAI,OAAS,aAC5B,SAAU,QAAQ,IAAI,UAAY,UAClC,OAAQ,QAAQ,IAAI,eACpB,SAAU,QAAQ,IAAI,UAAY,UAClC,SAAS,EACT,aAAc,CACZ,MAAO,EAAS,OAAS,wBAGK,GAclC,GAZA,EAAK,iBAAmB,EAAc,EAAK,OAC3C,EAAK,OAAS,EAAe,GAEzB,EAAK,SACP,QAAQ,IACN,2BACA,EAAK,OACL,kCACA,EAAK,WACL,KAGA,EAAmB,EAAK,aAAa,OAAQ,CAC/C,IAAI,QAAiB,EAAmB,EAAK,aAAa,OAAO,GAEjE,OADI,EAAK,SAAS,QAAQ,IAAI,yBAA0B,GACjD,CACL,WAAY,EAAK,cACd,EAEP,CACE,MAAM,IAAI,MACR,kBACA,EAAK,aAAa,MAClB,6FAEN,CAEA,OAAO,QAAU,CACf","file":"/npm/git-ai-summary@1.3.0/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/git-ai-summary@1.3.0/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","async function getGptSummary(userArgs) {\n  const {\n    generatePrompt,\n    getGitSummary,\n    getChatGptResponse,\n  } = require('./exports');\n\n  const defaultArgs = {\n    range: process.env.range || '7 days ago',\n    audience: process.env.audience || 'clients',\n    apiKey: process.env.OPENAI_API_KEY,\n    language: process.env.language || 'English',\n    verbose: false,\n    model_params: {\n      model: userArgs.model || 'text-davinci-003', // in case the user is using the cli or wants to put the model at the root of the options\n    },\n  };\n  const args = { ...defaultArgs, ...userArgs };\n\n  args.commit_log = await getGitSummary(args.range);\n  args.prompt = generatePrompt(args);\n\n  if (args.verbose)\n    console.log(\n      '===== Using prompt:\\n\\n\"',\n      args.prompt,\n      '\"\\n\\n===== and commit_log:\\n\\n\"',\n      args.commit_log,\n      '\"'\n    );\n\n  if (getChatGptResponse[args.model_params.model]) {\n    let response = await getChatGptResponse[args.model_params.model](args);\n    if (args.verbose) console.log('Response from ChatGPT:', response);\n    return {\n      commit_log: args.commit_log,\n      ...response,\n    };\n  } else\n    throw new Error(\n      'Specified model',\n      args.model_params.model,\n      'not a valid option. If this is a valid openai model, please open an issue or PR to add it.'\n    );\n}\n\nmodule.exports = {\n  getGptSummary,\n};\n"]}