update
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts";
|
||||
import { CNBCore, CNBCoreOptions, Result } from "../cnb-core.ts";
|
||||
|
||||
type RepoOptions = CNBCoreOptions<{
|
||||
group?: string;
|
||||
}>
|
||||
export class KnowledgeBase extends CNBCore {
|
||||
group: string;
|
||||
constructor(options: RepoOptions) {
|
||||
constructor(options: CNBCoreOptions) {
|
||||
super({ token: options.token, cookie: options.cookie });
|
||||
this.group = options.group || '';
|
||||
}
|
||||
|
||||
queryKnowledgeBase(repo: string, data: {
|
||||
@@ -16,28 +11,24 @@ export class KnowledgeBase extends CNBCore {
|
||||
top_k?: number,
|
||||
metadata_filtering_conditions?: MetadataFilteringConditions
|
||||
}): Promise<any> {
|
||||
const group = this.group || '';
|
||||
const url = `/${group}/${repo}/-/knowledge/base/query`;
|
||||
const url = `/${repo}/-/knowledge/base/query`;
|
||||
let postData = {
|
||||
query: data.query,
|
||||
};
|
||||
return this.post({ url, data: postData });
|
||||
}
|
||||
getEmbeddingModels(repo: string): Promise<Result<Array<{ name: string, dimensions: number }>>> {
|
||||
const group = this.group || '';
|
||||
const url = `/${group}/${repo}/-/knowledge/embedding/models`;
|
||||
const url = `/${repo}/-/knowledge/embedding/models`;
|
||||
// bg3-m3 1024
|
||||
// hunyuan 1024
|
||||
return this.get({ url });
|
||||
}
|
||||
getBase(repo: string): Promise<Result<any>> {
|
||||
const group = this.group || '';
|
||||
const url = `/${group}/${repo}/-/knowledge/base`;
|
||||
const url = `/${repo}/-/knowledge/base`;
|
||||
return this.get({ url });
|
||||
}
|
||||
deleteBase(repo: string): Promise<Result<any>> {
|
||||
const group = this.group || '';
|
||||
const url = `/${group}/${repo}/-/knowledge/base`;
|
||||
const url = `/${repo}/-/knowledge/base`;
|
||||
return this.request({ url, method: 'DELETE' });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user