新增 文档处理精度
This commit is contained in:
parent
fc130065d9
commit
afbea843b4
@ -385,6 +385,67 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/library/{LibraryId}/document/{DocumentId}/chunks": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerToken": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Documents"
|
||||
],
|
||||
"summary": "查看处理状态",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "资料库 ID",
|
||||
"name": "LibraryId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "文档 ID",
|
||||
"name": "DocumentId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.chunkStatusResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pkg.ResponseError"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pkg.ResponseError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/pkg.ResponseError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/library/{LibraryId}/documents": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -563,6 +624,20 @@
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"controller.chunkStatusResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"chunked": {
|
||||
"type": "integer"
|
||||
},
|
||||
"completed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"gorm.DeletedAt": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -23,6 +23,31 @@ import type { RequestArgs } from './base';
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError, operationServerMap } from './base';
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface ControllerChunkStatusResponse
|
||||
*/
|
||||
export interface ControllerChunkStatusResponse {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ControllerChunkStatusResponse
|
||||
*/
|
||||
'chunked'?: number;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ControllerChunkStatusResponse
|
||||
*/
|
||||
'completed'?: boolean;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ControllerChunkStatusResponse
|
||||
*/
|
||||
'total'?: number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@ -234,6 +259,47 @@ export interface PkgResponsePaginated {
|
||||
*/
|
||||
export const DocumentsApiAxiosParamCreator = function (configuration?: Configuration) {
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 查看处理状态
|
||||
* @param {string} libraryId 资料库 ID
|
||||
* @param {string} documentId 文档 ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
libraryLibraryIdDocumentDocumentIdChunksGet: async (libraryId: string, documentId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'libraryId' is not null or undefined
|
||||
assertParamExists('libraryLibraryIdDocumentDocumentIdChunksGet', 'libraryId', libraryId)
|
||||
// verify required parameter 'documentId' is not null or undefined
|
||||
assertParamExists('libraryLibraryIdDocumentDocumentIdChunksGet', 'documentId', documentId)
|
||||
const localVarPath = `/library/{LibraryId}/document/{DocumentId}/chunks`
|
||||
.replace(`{${"LibraryId"}}`, encodeURIComponent(String(libraryId)))
|
||||
.replace(`{${"DocumentId"}}`, encodeURIComponent(String(documentId)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication BearerToken required
|
||||
await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)
|
||||
|
||||
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除文档
|
||||
@ -512,6 +578,20 @@ export const DocumentsApiAxiosParamCreator = function (configuration?: Configura
|
||||
export const DocumentsApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = DocumentsApiAxiosParamCreator(configuration)
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 查看处理状态
|
||||
* @param {string} libraryId 资料库 ID
|
||||
* @param {string} documentId 文档 ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async libraryLibraryIdDocumentDocumentIdChunksGet(libraryId: string, documentId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ControllerChunkStatusResponse>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.libraryLibraryIdDocumentDocumentIdChunksGet(libraryId, documentId, options);
|
||||
const index = configuration?.serverIndex ?? 0;
|
||||
const operationBasePath = operationServerMap['DocumentsApi.libraryLibraryIdDocumentDocumentIdChunksGet']?.[index]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除文档
|
||||
@ -608,6 +688,17 @@ export const DocumentsApiFp = function(configuration?: Configuration) {
|
||||
export const DocumentsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = DocumentsApiFp(configuration)
|
||||
return {
|
||||
/**
|
||||
*
|
||||
* @summary 查看处理状态
|
||||
* @param {string} libraryId 资料库 ID
|
||||
* @param {string} documentId 文档 ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
libraryLibraryIdDocumentDocumentIdChunksGet(libraryId: string, documentId: string, options?: any): AxiosPromise<ControllerChunkStatusResponse> {
|
||||
return localVarFp.libraryLibraryIdDocumentDocumentIdChunksGet(libraryId, documentId, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @summary 删除文档
|
||||
@ -686,6 +777,19 @@ export const DocumentsApiFactory = function (configuration?: Configuration, base
|
||||
* @extends {BaseAPI}
|
||||
*/
|
||||
export class DocumentsApi extends BaseAPI {
|
||||
/**
|
||||
*
|
||||
* @summary 查看处理状态
|
||||
* @param {string} libraryId 资料库 ID
|
||||
* @param {string} documentId 文档 ID
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof DocumentsApi
|
||||
*/
|
||||
public libraryLibraryIdDocumentDocumentIdChunksGet(libraryId: string, documentId: string, options?: AxiosRequestConfig) {
|
||||
return DocumentsApiFp(this.configuration).libraryLibraryIdDocumentDocumentIdChunksGet(libraryId, documentId, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary 删除文档
|
||||
|
@ -6,7 +6,8 @@ export const useConfigStore = defineStore('app', {
|
||||
appName: "资料库",
|
||||
description: "Leaf Library",
|
||||
accountServer: "https://oauth.leaflow.cn",
|
||||
apiServer: "https://document-api.leaflow.cn/api",
|
||||
// apiServer: "https://document-api.leaflow.cn/api",
|
||||
apiServer: "http://localhost:8080/api",
|
||||
}),
|
||||
actions: {
|
||||
getAppName(): string {
|
||||
|
@ -15,12 +15,39 @@ const docu = ref({
|
||||
Content: "",
|
||||
});
|
||||
|
||||
const status = ref({
|
||||
Total: 0,
|
||||
Chunked: 0,
|
||||
Completed: null,
|
||||
});
|
||||
|
||||
document
|
||||
.libraryLibraryIdDocumentDocumentIdGet(libraryId, documentId)
|
||||
.then((r) => {
|
||||
docu.value = r.data;
|
||||
|
||||
console.log(r.data);
|
||||
|
||||
document
|
||||
.libraryLibraryIdDocumentDocumentIdChunksGet(libraryId, documentId)
|
||||
.then((r) => {
|
||||
status.value.Total = r.data.Total;
|
||||
status.value.Chunked = r.data.Chunked;
|
||||
status.value.Completed = r.data.Completed;
|
||||
|
||||
console.log(status.value);
|
||||
|
||||
// calc percent
|
||||
if (status.value.Completed !== null) {
|
||||
if (status.value.Completed) {
|
||||
status.value.Chunked = status.value.Total;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(
|
||||
"percent: " + (status.value.Chunked / status.value.Total) * 100
|
||||
);
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
@ -61,7 +88,19 @@ function goto_edit_document() {
|
||||
<v-btn class="ml-2" @click="goto_create_document">新建文档</v-btn>
|
||||
<v-btn class="ml-2" @click="goto_edit_document">修改文档</v-btn>
|
||||
<v-btn class="ml-2" @click="goto_query_library">查询</v-btn>
|
||||
|
||||
<v-tooltip text="文档处理进度">
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-progress-circular
|
||||
v-bind="props"
|
||||
class="ml-2"
|
||||
:indeterminate="status.Completed == null"
|
||||
:model-value="(status.Chunked / status.Total) * 100"
|
||||
></v-progress-circular>
|
||||
</template>
|
||||
</v-tooltip>
|
||||
|
||||
<!-- <v-progress-circular class="ml-2" v-else indeterminate></v-progress-circular> -->
|
||||
|
||||
<div v-if="loading">
|
||||
<LoadingComponent> </LoadingComponent>
|
||||
</div>
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user