mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-10-10 07:23:23 +08:00
将ai接口移至quickcommand,支持在配置菜单全局配置ai接口
This commit is contained in:
@@ -51,7 +51,7 @@ const PRESET_PROMPTS = {
|
||||
* @param {string} content.presetPrompt - 预设提示词类型
|
||||
* @returns {Promise<Object>} 对话响应
|
||||
*/
|
||||
async function chat(apiConfig, content) {
|
||||
async function chat(content, apiConfig) {
|
||||
try {
|
||||
const { modelType, apiUrl, apiToken, model } = apiConfig;
|
||||
const { prompt, presetPrompt } = content;
|
@@ -5,6 +5,9 @@ const kill = require("tree-kill");
|
||||
const iconv = require("iconv-lite");
|
||||
const path = require("path");
|
||||
const axios = require("axios");
|
||||
const { chat, getModels } = require("./ai");
|
||||
|
||||
window.getModelsFromAiApi = getModels;
|
||||
|
||||
const systemDialog = require("./dialog/service");
|
||||
|
||||
@@ -184,6 +187,11 @@ const quickcommand = {
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
askAI: async function (content, apiConfig) {
|
||||
return await chat(content, apiConfig);
|
||||
},
|
||||
|
||||
...systemDialog,
|
||||
};
|
||||
|
||||
|
@@ -13,7 +13,6 @@ const quickcomposer = {
|
||||
status: require("./quickcomposer/status"),
|
||||
browser: require("./quickcomposer/browser"),
|
||||
video: require("./quickcomposer/video"),
|
||||
ai: require("./quickcomposer/ai"),
|
||||
};
|
||||
|
||||
module.exports = quickcomposer;
|
||||
|
@@ -1,6 +0,0 @@
|
||||
const { chat, getModels } = require("./chat");
|
||||
|
||||
module.exports = {
|
||||
chat,
|
||||
getModels,
|
||||
};
|
Reference in New Issue
Block a user