对 kevisual 相关的query router 的模块整理
包含的模块:
提供配置的增删改查功能,支持默认配置项管理。
主要功能:
使用示例:
import { QueryConfig } from './query-config/query-config';
const config = new QueryConfig();
await config.getConfig({ key: 'upload.json' });
await config.updateConfig({ key: 'config.json', data: { setting: true } });
用于管理敏感信息和密钥的存储与检索。
主要功能:
提供动态路由代理功能,可以将请求转发到不同的后端服务。
主要功能:
使用示例:
import { QueryProxy } from './query-proxy/index';
const proxy = new QueryProxy({
query: new Query(),
token: 'your-token'
});
await proxy.init(); // 初始化路由
const result = await proxy.run({ path: 'api', key: 'getData' });
功能完整的文件上传解决方案,支持多种上传方式。
主要功能:
核心组件:
uploadFiles - 基础文件上传uploadFileChunked - 分片上传UploadProgress - 进度管理filterFiles - 文件过滤toFile - 格式转换使用示例:
import { uploadFiles, UploadProgress } from './query-upload/query-upload';
const progress = new UploadProgress();
await uploadFiles(files, {
onProgress: (loaded, total) => {
console.log(`上传进度: ${loaded}/${total}`);
}
});
管理应用的注册、获取和列表功能。
主要功能:
应用商店功能,处理应用的安装和获取。
主要功能:
集成AI聊天功能,支持多种模型和对话管理。
主要功能:
使用示例:
import { QueryAI } from './query-ai/query-ai';
const ai = new QueryAI({ query: new Query() });
const models = await ai.getModelList();
const response = await ai.chat(
{ message: '你好' },
{ username: 'user', model: 'gpt-3.5', group: 'default' }
);
完整的登录认证解决方案,支持token管理和缓存。
主要功能:
核心组件:
QueryLogin - 主登录类LoginCacheStore - 登录缓存Cache - 通用缓存接口管理用户资源的访问和获取。
主要功能:
使用示例:
import { QueryResources } from './query-resources/index';
const resources = new QueryResources({ username: 'user' });
const fileList = await resources.getList('images/');
const fileContent = await resources.fetchFile('document.pdf');
@kevisual/query 的统一查询接口