@re-ai/free-api
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -5,2 +5,3 @@ "use strict"; | ||
exports.FreeAIApiFactory = void 0; | ||
const baiduAgent_1 = require("../services/baiduAgent"); | ||
const dify_1 = require("../services/dify"); | ||
@@ -20,2 +21,4 @@ const ernie_1 = require("../services/ernie"); | ||
return new dify_1.DifyService(options); | ||
case types_1.APITypes.BAIDU_AGENT: | ||
return new baiduAgent_1.BaiduAgentService(options); | ||
default: | ||
@@ -22,0 +25,0 @@ throw new Error(`Unsupported API type: ${type}`); |
@@ -5,5 +5,6 @@ import { APIModel } from "./models"; | ||
ERNIE = "ernie", | ||
DIFY = "dify" | ||
DIFY = "dify", | ||
BAIDU_AGENT = "baidu_agent" | ||
} | ||
export type APIOptions = OptionsEnrie | OptionsFree | OptionsDify; | ||
export type APIOptions = OptionsEnrie | OptionsFree | OptionsDify | OptionsBaiduAgent; | ||
export type OptionsFree = { | ||
@@ -23,2 +24,8 @@ host?: string; | ||
}; | ||
export type OptionsBaiduAgent = { | ||
agentId: string; | ||
apiKey: string; | ||
apiSecret: string; | ||
user: string; | ||
}; | ||
export type ChatCompleteParams = { | ||
@@ -25,0 +32,0 @@ model: string | "glm4" | "kimi" | "dify" | APIModel; |
@@ -9,2 +9,3 @@ "use strict"; | ||
APITypes["DIFY"] = "dify"; | ||
APITypes["BAIDU_AGENT"] = "baidu_agent"; | ||
})(APITypes || (exports.APITypes = APITypes = {})); |
export type APIModel = ErnieModel | OneAPIModel; | ||
export type ErnieModel = "ernie-speed-128k"; | ||
export type OneAPIModel = "ERNIE-Speed-128K"; | ||
export type BAIDU_AGENT_MODEL = "baidu-agent-model"; |
{ | ||
"name": "@re-ai/free-api", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
// 使用工厂模式生成实例 | ||
import { IAIApi } from "../interfaces/IAIApi"; | ||
import { BaiduAgentService } from "../services/baiduAgent"; | ||
import { DifyService } from "../services/dify"; | ||
import { ErnieService } from "../services/ernie"; | ||
import { FreeService } from "../services/free"; | ||
import { APIOptions, APITypes, OptionsDify, OptionsEnrie, OptionsFree } from "../types"; | ||
import { APIOptions, APITypes, OptionsBaiduAgent, OptionsDify, OptionsEnrie, OptionsFree } from "../types"; | ||
@@ -20,2 +21,4 @@ export class FreeAIApiFactory { | ||
return new DifyService(options as OptionsDify) | ||
case APITypes.BAIDU_AGENT: | ||
return new BaiduAgentService(options as OptionsBaiduAgent) | ||
default: | ||
@@ -22,0 +25,0 @@ throw new Error(`Unsupported API type: ${type}`); |
@@ -6,6 +6,7 @@ import { APIModel } from "./models"; | ||
ERNIE = "ernie", | ||
DIFY = "dify" | ||
DIFY = "dify", | ||
BAIDU_AGENT = "baidu_agent" | ||
} | ||
export type APIOptions = OptionsEnrie | OptionsFree | OptionsDify; | ||
export type APIOptions = OptionsEnrie | OptionsFree | OptionsDify | OptionsBaiduAgent; | ||
@@ -29,2 +30,9 @@ export type OptionsFree = { | ||
export type OptionsBaiduAgent = { | ||
agentId: string, | ||
apiKey: string, | ||
apiSecret: string, | ||
user: string | ||
} | ||
export type ChatCompleteParams = { | ||
@@ -31,0 +39,0 @@ model: string | "glm4" | "kimi" | "dify" | APIModel, |
@@ -5,2 +5,4 @@ export type APIModel = ErnieModel | OneAPIModel | ||
export type OneAPIModel = "ERNIE-Speed-128K" | ||
export type OneAPIModel = "ERNIE-Speed-128K" | ||
export type BAIDU_AGENT_MODEL = "baidu-agent-model" |
66920
45
1830
4