测试
This commit is contained in:
parent
e6dc6370d6
commit
4acfa11b81
@ -3,11 +3,7 @@
|
||||
<v-navigation-drawer v-model="drawer">
|
||||
<div class="pa-2">
|
||||
<v-btn-group rounded="lg">
|
||||
<v-btn
|
||||
density="default"
|
||||
icon="mdi-close"
|
||||
@click="drawer = !drawer"
|
||||
></v-btn>
|
||||
<v-btn density="default" icon="mdi-close" @click="drawer = !drawer"></v-btn>
|
||||
|
||||
<v-btn density="default" icon="mdi-plus" title="创建资料库" @click="to('libraries.create')">
|
||||
</v-btn>
|
||||
@ -28,24 +24,22 @@
|
||||
></v-list-item>
|
||||
</template> -->
|
||||
|
||||
<v-list-item
|
||||
rounded="lg"
|
||||
prepend-icon="mdi-home"
|
||||
title="首页"
|
||||
:to="{
|
||||
<v-list-item rounded="lg" prepend-icon="mdi-home" title="首页" :to="{
|
||||
name: 'home',
|
||||
}"
|
||||
></v-list-item>
|
||||
}"></v-list-item>
|
||||
|
||||
<v-list-item
|
||||
rounded="lg"
|
||||
prepend-icon="mdi-account"
|
||||
title="登录"
|
||||
:to="{
|
||||
<v-list-item rounded="lg" prepend-icon="mdi-account" title="登录" :to="{
|
||||
name: 'login',
|
||||
}"
|
||||
v-show="!logined"
|
||||
></v-list-item>
|
||||
}" v-show="!logined"></v-list-item>
|
||||
|
||||
<v-list-item v-if="libraries" v-for="i in libraries.libraries" rounded="lg" prepend-icon="mdi-home" :title="i.name" :to="{
|
||||
name: 'documents.list',
|
||||
params: {
|
||||
'LibraryId': i.id
|
||||
}
|
||||
}"></v-list-item>
|
||||
|
||||
|
||||
|
||||
<!-- <v-list-item
|
||||
prepend-icon="mdi-forum"
|
||||
@ -64,45 +58,52 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from "vue";
|
||||
import { useConfigStore } from "@/store/config";
|
||||
import keycloak from "@/plugins/keycloak";
|
||||
import rpcPlugin from "@/plugins/rpc";
|
||||
import * as libraryPb from "@/proto/library/library";
|
||||
import router from "@/router";
|
||||
import { ref } from "vue"
|
||||
import { useConfigStore } from "@/store/config"
|
||||
import keycloak from "@/plugins/keycloak"
|
||||
import rpcPlugin from "@/plugins/rpc"
|
||||
import * as libraryPb from "@/proto/library/library"
|
||||
import router from "@/router"
|
||||
|
||||
const configStore = useConfigStore();
|
||||
const configStore = useConfigStore()
|
||||
|
||||
const drawer = ref(false);
|
||||
const drawer = ref(false)
|
||||
|
||||
const logined = ref(false);
|
||||
const logined = ref(false)
|
||||
|
||||
const libraries = ref()
|
||||
|
||||
|
||||
let inter = setInterval(() => {
|
||||
logined.value = keycloak.authenticated === true;
|
||||
refreshLibraries()
|
||||
clearInterval(inter)
|
||||
|
||||
|
||||
logined.value = keycloak.authenticated === true
|
||||
|
||||
if (logined.value) {
|
||||
clearInterval(inter);
|
||||
clearInterval(inter)
|
||||
refreshLibraries()
|
||||
}
|
||||
}, 1000);
|
||||
}, 1000)
|
||||
|
||||
function refreshLibraries() {
|
||||
const useRpc = rpcPlugin()
|
||||
|
||||
let listLibrary: libraryPb.ListLibrariesRequest = {
|
||||
page: 1,
|
||||
};
|
||||
}
|
||||
useRpc.libraryServiceClient.listLibraries(listLibrary).then((res) => {
|
||||
console.log(res);
|
||||
});
|
||||
console.log(res)
|
||||
libraries.value = res.response
|
||||
console.log(libraries)
|
||||
})
|
||||
}
|
||||
|
||||
function to(name: string) {
|
||||
router.push({
|
||||
name: name,
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,7 +7,9 @@ const staticConfig = {
|
||||
checkLoginIframe: false,
|
||||
redirectUri: window.location.origin + "/auth/login",
|
||||
|
||||
rpc_base_url: "http://127.0.0.1:18081"
|
||||
rpcBaseUrl: "http://127.0.0.1:18081",
|
||||
|
||||
devMode: true
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,20 +1,20 @@
|
||||
|
||||
import { GrpcWebFetchTransport } from "@protobuf-ts/grpcweb-transport";
|
||||
import { GrpcWebFetchTransport } from "@protobuf-ts/grpcweb-transport"
|
||||
import keycloak from "@/plugins/keycloak"
|
||||
import { DocumentServiceClient } from "@/proto/document/document.client";
|
||||
import { LibraryServiceClient } from "@/proto/library/library.client";
|
||||
import { DocumentServiceClient } from "@/proto/document/document.client"
|
||||
import { LibraryServiceClient } from "@/proto/library/library.client"
|
||||
import config from "@/plugins/config"
|
||||
|
||||
export default () => {
|
||||
|
||||
const transport = new GrpcWebFetchTransport({
|
||||
baseUrl: config.rpc_base_url,
|
||||
baseUrl: config.rpcBaseUrl,
|
||||
format: "text",
|
||||
meta: {
|
||||
"Authorization": "Bearer " + keycloak.idToken,
|
||||
},
|
||||
timeout: 100 * 1000,
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
const libraryServiceClient = new LibraryServiceClient(transport)
|
||||
|
@ -1,28 +1,28 @@
|
||||
// @generated by protobuf-ts 2.9.4 with parameter generate_dependencies
|
||||
// @generated from protobuf file "proto/document/document.proto" (package "DocumentService", syntax proto3)
|
||||
// tslint:disable
|
||||
import type {RpcOptions, RpcTransport, ServiceInfo, UnaryCall} from "@protobuf-ts/runtime-rpc";
|
||||
import {stackIntercept} from "@protobuf-ts/runtime-rpc";
|
||||
import type {
|
||||
CreateDocumentBlockRequest,
|
||||
CreateDocumentRequest,
|
||||
DeleteDocumentBlockRequest,
|
||||
DeleteDocumentRequest,
|
||||
Document,
|
||||
DocumentBlock,
|
||||
DocumentBlockList,
|
||||
DocumentList,
|
||||
Empty,
|
||||
GetDocumentBlockRequest,
|
||||
GetDocumentBlocksRequest,
|
||||
GetDocumentRequest,
|
||||
ListDocumentsRequest,
|
||||
UpdateDocumentBlockRequest,
|
||||
UpdateDocumentRequest,
|
||||
VectorSearchByTextInDocumentRequest
|
||||
} from "./document";
|
||||
import {DocumentService} from "./document";
|
||||
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
||||
import { DocumentService } from "./document";
|
||||
import type { UpdateDocumentBlockRequest } from "./document";
|
||||
import type { DeleteDocumentBlockRequest } from "./document";
|
||||
import type { GetDocumentBlocksRequest } from "./document";
|
||||
import type { GetDocumentBlockRequest } from "./document";
|
||||
import type { DocumentBlock } from "./document";
|
||||
import type { CreateDocumentBlockRequest } from "./document";
|
||||
import type { DocumentBlockList } from "./document";
|
||||
import type { VectorSearchByTextInDocumentRequest } from "./document";
|
||||
import type { Empty } from "./document";
|
||||
import type { DeleteDocumentRequest } from "./document";
|
||||
import type { UpdateDocumentRequest } from "./document";
|
||||
import type { GetDocumentRequest } from "./document";
|
||||
import type { Document } from "./document";
|
||||
import type { CreateDocumentRequest } from "./document";
|
||||
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
||||
import type { DocumentList } from "./document";
|
||||
import type { ListDocumentsRequest } from "./document";
|
||||
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
|
||||
/**
|
||||
* @generated from protobuf service DocumentService.DocumentService
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,27 @@
|
||||
// @generated by protobuf-ts 2.9.4 with parameter generate_dependencies
|
||||
// @generated from protobuf file "proto/library/library.proto" (package "LibraryService", syntax proto3)
|
||||
// tslint:disable
|
||||
import type {RpcOptions, RpcTransport, ServiceInfo, UnaryCall} from "@protobuf-ts/runtime-rpc";
|
||||
import {stackIntercept} from "@protobuf-ts/runtime-rpc";
|
||||
import type {
|
||||
CreateLibraryRequest,
|
||||
DeleteLibraryRequest,
|
||||
DocumentTextSearchFromLibraryRequest,
|
||||
DocumentTextSearchFromLibraryResponse,
|
||||
DocumentVectorSearchByTextFromLibraryRequest,
|
||||
DocumentVectorSearchByTextFromLibraryResponse,
|
||||
GetLibraryRequest,
|
||||
GetLibraryResponse,
|
||||
Library,
|
||||
LibraryList,
|
||||
ListLibrariesRequest,
|
||||
UpdateLibraryRequest,
|
||||
UpdateLibraryResponse,
|
||||
VectorSearchByTextFromLibraryRequest,
|
||||
VectorSearchByTextFromLibraryResponse
|
||||
} from "./library";
|
||||
import {LibraryService} from "./library";
|
||||
|
||||
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
||||
import { LibraryService } from "./library";
|
||||
import type { VectorSearchByTextFromLibraryResponse } from "./library";
|
||||
import type { VectorSearchByTextFromLibraryRequest } from "./library";
|
||||
import type { DocumentTextSearchFromLibraryResponse } from "./library";
|
||||
import type { DocumentTextSearchFromLibraryRequest } from "./library";
|
||||
import type { DocumentVectorSearchByTextFromLibraryResponse } from "./library";
|
||||
import type { DocumentVectorSearchByTextFromLibraryRequest } from "./library";
|
||||
import type { DeleteLibraryRequest } from "./library";
|
||||
import type { UpdateLibraryResponse } from "./library";
|
||||
import type { UpdateLibraryRequest } from "./library";
|
||||
import type { GetLibraryResponse } from "./library";
|
||||
import type { GetLibraryRequest } from "./library";
|
||||
import type { Library } from "./library";
|
||||
import type { CreateLibraryRequest } from "./library";
|
||||
import { stackIntercept } from "@protobuf-ts/runtime-rpc";
|
||||
import type { LibraryList } from "./library";
|
||||
import type { ListLibrariesRequest } from "./library";
|
||||
import type { UnaryCall } from "@protobuf-ts/runtime-rpc";
|
||||
import type { RpcOptions } from "@protobuf-ts/runtime-rpc";
|
||||
/**
|
||||
* @generated from protobuf service LibraryService.LibraryService
|
||||
*/
|
||||
|
@ -1,23 +1,23 @@
|
||||
// @generated by protobuf-ts 2.9.4 with parameter generate_dependencies
|
||||
// @generated from protobuf file "proto/library/library.proto" (package "LibraryService", syntax proto3)
|
||||
// tslint:disable
|
||||
import {ServiceType} from "@protobuf-ts/runtime-rpc";
|
||||
import type {
|
||||
BinaryReadOptions,
|
||||
BinaryWriteOptions,
|
||||
IBinaryReader,
|
||||
IBinaryWriter,
|
||||
PartialMessage
|
||||
} from "@protobuf-ts/runtime";
|
||||
import {MessageType, reflectionMergePartial, UnknownFieldHandler, WireType} from "@protobuf-ts/runtime";
|
||||
import {DocumentList} from "../document/document";
|
||||
|
||||
import { ServiceType } from "@protobuf-ts/runtime-rpc";
|
||||
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
|
||||
import type { IBinaryWriter } from "@protobuf-ts/runtime";
|
||||
import { WireType } from "@protobuf-ts/runtime";
|
||||
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
|
||||
import type { IBinaryReader } from "@protobuf-ts/runtime";
|
||||
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
||||
import type { PartialMessage } from "@protobuf-ts/runtime";
|
||||
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
||||
import { MessageType } from "@protobuf-ts/runtime";
|
||||
import { DocumentList } from "../document/document";
|
||||
/**
|
||||
* @generated from protobuf message LibraryService.Library
|
||||
*/
|
||||
export interface Library {
|
||||
/**
|
||||
* @generated from protobuf field: uint32 id = 1;
|
||||
* @generated from protobuf field: int32 id = 1;
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
@ -59,9 +59,9 @@ export interface LibraryList {
|
||||
*/
|
||||
libraries: Library[];
|
||||
/**
|
||||
* @generated from protobuf field: int64 total = 2;
|
||||
* @generated from protobuf field: int32 total = 2;
|
||||
*/
|
||||
total: bigint;
|
||||
total: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message LibraryService.CreateLibraryRequest
|
||||
@ -89,7 +89,7 @@ export interface CreateLibraryRequest {
|
||||
*/
|
||||
export interface DeleteLibraryRequest {
|
||||
/**
|
||||
* @generated from protobuf field: uint32 id = 1;
|
||||
* @generated from protobuf field: int32 id = 1;
|
||||
*/
|
||||
id: number;
|
||||
}
|
||||
@ -98,7 +98,7 @@ export interface DeleteLibraryRequest {
|
||||
*/
|
||||
export interface UpdateLibraryRequest {
|
||||
/**
|
||||
* @generated from protobuf field: uint32 id = 1;
|
||||
* @generated from protobuf field: int32 id = 1;
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
@ -132,7 +132,7 @@ export interface UpdateLibraryResponse {
|
||||
*/
|
||||
export interface GetLibraryRequest {
|
||||
/**
|
||||
* @generated from protobuf field: uint32 id = 1;
|
||||
* @generated from protobuf field: int32 id = 1;
|
||||
*/
|
||||
id: number;
|
||||
}
|
||||
@ -154,7 +154,7 @@ export interface DocumentVectorSearchByTextFromLibraryRequest {
|
||||
*/
|
||||
query: string;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 library_id = 2;
|
||||
* @generated from protobuf field: int32 library_id = 2;
|
||||
*/
|
||||
libraryId: number;
|
||||
/**
|
||||
@ -184,7 +184,7 @@ export interface DocumentTextSearchFromLibraryRequest {
|
||||
*/
|
||||
query: string;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 library_id = 2;
|
||||
* @generated from protobuf field: int32 library_id = 2;
|
||||
*/
|
||||
libraryId: number;
|
||||
/**
|
||||
@ -201,9 +201,9 @@ export interface DocumentTextSearchFromLibraryResponse {
|
||||
*/
|
||||
hits?: DocumentList;
|
||||
/**
|
||||
* @generated from protobuf field: int64 total = 2;
|
||||
* @generated from protobuf field: int32 total = 2;
|
||||
*/
|
||||
total: bigint;
|
||||
total: number;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf message LibraryService.VectorSearchByTextFromLibraryRequest
|
||||
@ -214,7 +214,7 @@ export interface VectorSearchByTextFromLibraryRequest {
|
||||
*/
|
||||
query: string;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 library_id = 2;
|
||||
* @generated from protobuf field: int32 library_id = 2;
|
||||
*/
|
||||
libraryId: number;
|
||||
}
|
||||
@ -236,15 +236,15 @@ export interface DocumentBlockList {
|
||||
*/
|
||||
content: string;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 document_id = 2;
|
||||
* @generated from protobuf field: int32 document_id = 2;
|
||||
*/
|
||||
documentId: number;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 library_id = 3;
|
||||
* @generated from protobuf field: int32 library_id = 3;
|
||||
*/
|
||||
libraryId: number;
|
||||
/**
|
||||
* @generated from protobuf field: uint32 block_id = 4;
|
||||
* @generated from protobuf field: int32 block_id = 4;
|
||||
*/
|
||||
blockId: number;
|
||||
}
|
||||
@ -265,7 +265,7 @@ export enum LibraryAccessibility {
|
||||
class Library$Type extends MessageType<Library> {
|
||||
constructor() {
|
||||
super("LibraryService.Library", [
|
||||
{ no: 1, name: "id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 1, name: "id", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 2, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 3, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 4, name: "icon", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
@ -290,8 +290,8 @@ class Library$Type extends MessageType<Library> {
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* uint32 id */ 1:
|
||||
message.id = reader.uint32();
|
||||
case /* int32 id */ 1:
|
||||
message.id = reader.int32();
|
||||
break;
|
||||
case /* string name */ 2:
|
||||
message.name = reader.string();
|
||||
@ -320,9 +320,9 @@ class Library$Type extends MessageType<Library> {
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message: Library, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* uint32 id = 1; */
|
||||
/* int32 id = 1; */
|
||||
if (message.id !== 0)
|
||||
writer.tag(1, WireType.Varint).uint32(message.id);
|
||||
writer.tag(1, WireType.Varint).int32(message.id);
|
||||
/* string name = 2; */
|
||||
if (message.name !== "")
|
||||
writer.tag(2, WireType.LengthDelimited).string(message.name);
|
||||
@ -400,13 +400,13 @@ class LibraryList$Type extends MessageType<LibraryList> {
|
||||
constructor() {
|
||||
super("LibraryService.LibraryList", [
|
||||
{ no: 1, name: "libraries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Library },
|
||||
{ no: 2, name: "total", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 2, name: "total", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<LibraryList>): LibraryList {
|
||||
const message = globalThis.Object.create((this.messagePrototype!));
|
||||
message.libraries = [];
|
||||
message.total = 0n;
|
||||
message.total = 0;
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<LibraryList>(this, message, value);
|
||||
return message;
|
||||
@ -419,8 +419,8 @@ class LibraryList$Type extends MessageType<LibraryList> {
|
||||
case /* repeated LibraryService.Library libraries */ 1:
|
||||
message.libraries.push(Library.internalBinaryRead(reader, reader.uint32(), options));
|
||||
break;
|
||||
case /* int64 total */ 2:
|
||||
message.total = reader.int64().toBigInt();
|
||||
case /* int32 total */ 2:
|
||||
message.total = reader.int32();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
@ -437,9 +437,9 @@ class LibraryList$Type extends MessageType<LibraryList> {
|
||||
/* repeated LibraryService.Library libraries = 1; */
|
||||
for (let i = 0; i < message.libraries.length; i++)
|
||||
Library.internalBinaryWrite(message.libraries[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
||||
/* int64 total = 2; */
|
||||
if (message.total !== 0n)
|
||||
writer.tag(2, WireType.Varint).int64(message.total);
|
||||
/* int32 total = 2; */
|
||||
if (message.total !== 0)
|
||||
writer.tag(2, WireType.Varint).int32(message.total);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
@ -525,7 +525,7 @@ export const CreateLibraryRequest = new CreateLibraryRequest$Type();
|
||||
class DeleteLibraryRequest$Type extends MessageType<DeleteLibraryRequest> {
|
||||
constructor() {
|
||||
super("LibraryService.DeleteLibraryRequest", [
|
||||
{ no: 1, name: "id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
|
||||
{ no: 1, name: "id", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<DeleteLibraryRequest>): DeleteLibraryRequest {
|
||||
@ -540,8 +540,8 @@ class DeleteLibraryRequest$Type extends MessageType<DeleteLibraryRequest> {
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* uint32 id */ 1:
|
||||
message.id = reader.uint32();
|
||||
case /* int32 id */ 1:
|
||||
message.id = reader.int32();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
@ -555,9 +555,9 @@ class DeleteLibraryRequest$Type extends MessageType<DeleteLibraryRequest> {
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message: DeleteLibraryRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* uint32 id = 1; */
|
||||
/* int32 id = 1; */
|
||||
if (message.id !== 0)
|
||||
writer.tag(1, WireType.Varint).uint32(message.id);
|
||||
writer.tag(1, WireType.Varint).int32(message.id);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
@ -572,7 +572,7 @@ export const DeleteLibraryRequest = new DeleteLibraryRequest$Type();
|
||||
class UpdateLibraryRequest$Type extends MessageType<UpdateLibraryRequest> {
|
||||
constructor() {
|
||||
super("LibraryService.UpdateLibraryRequest", [
|
||||
{ no: 1, name: "id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 1, name: "id", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 2, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 3, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 4, name: "icon", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
@ -595,8 +595,8 @@ class UpdateLibraryRequest$Type extends MessageType<UpdateLibraryRequest> {
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* uint32 id */ 1:
|
||||
message.id = reader.uint32();
|
||||
case /* int32 id */ 1:
|
||||
message.id = reader.int32();
|
||||
break;
|
||||
case /* string name */ 2:
|
||||
message.name = reader.string();
|
||||
@ -622,9 +622,9 @@ class UpdateLibraryRequest$Type extends MessageType<UpdateLibraryRequest> {
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message: UpdateLibraryRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* uint32 id = 1; */
|
||||
/* int32 id = 1; */
|
||||
if (message.id !== 0)
|
||||
writer.tag(1, WireType.Varint).uint32(message.id);
|
||||
writer.tag(1, WireType.Varint).int32(message.id);
|
||||
/* string name = 2; */
|
||||
if (message.name !== "")
|
||||
writer.tag(2, WireType.LengthDelimited).string(message.name);
|
||||
@ -697,7 +697,7 @@ export const UpdateLibraryResponse = new UpdateLibraryResponse$Type();
|
||||
class GetLibraryRequest$Type extends MessageType<GetLibraryRequest> {
|
||||
constructor() {
|
||||
super("LibraryService.GetLibraryRequest", [
|
||||
{ no: 1, name: "id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
|
||||
{ no: 1, name: "id", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<GetLibraryRequest>): GetLibraryRequest {
|
||||
@ -712,8 +712,8 @@ class GetLibraryRequest$Type extends MessageType<GetLibraryRequest> {
|
||||
while (reader.pos < end) {
|
||||
let [fieldNo, wireType] = reader.tag();
|
||||
switch (fieldNo) {
|
||||
case /* uint32 id */ 1:
|
||||
message.id = reader.uint32();
|
||||
case /* int32 id */ 1:
|
||||
message.id = reader.int32();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
@ -727,9 +727,9 @@ class GetLibraryRequest$Type extends MessageType<GetLibraryRequest> {
|
||||
return message;
|
||||
}
|
||||
internalBinaryWrite(message: GetLibraryRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
|
||||
/* uint32 id = 1; */
|
||||
/* int32 id = 1; */
|
||||
if (message.id !== 0)
|
||||
writer.tag(1, WireType.Varint).uint32(message.id);
|
||||
writer.tag(1, WireType.Varint).int32(message.id);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
@ -791,7 +791,7 @@ class DocumentVectorSearchByTextFromLibraryRequest$Type extends MessageType<Docu
|
||||
constructor() {
|
||||
super("LibraryService.DocumentVectorSearchByTextFromLibraryRequest", [
|
||||
{ no: 1, name: "query", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "library_id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 2, name: "library_id", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 3, name: "page", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||
]);
|
||||
}
|
||||
@ -812,8 +812,8 @@ class DocumentVectorSearchByTextFromLibraryRequest$Type extends MessageType<Docu
|
||||
case /* string query */ 1:
|
||||
message.query = reader.string();
|
||||
break;
|
||||
case /* uint32 library_id */ 2:
|
||||
message.libraryId = reader.uint32();
|
||||
case /* int32 library_id */ 2:
|
||||
message.libraryId = reader.int32();
|
||||
break;
|
||||
case /* int32 page */ 3:
|
||||
message.page = reader.int32();
|
||||
@ -833,9 +833,9 @@ class DocumentVectorSearchByTextFromLibraryRequest$Type extends MessageType<Docu
|
||||
/* string query = 1; */
|
||||
if (message.query !== "")
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.query);
|
||||
/* uint32 library_id = 2; */
|
||||
/* int32 library_id = 2; */
|
||||
if (message.libraryId !== 0)
|
||||
writer.tag(2, WireType.Varint).uint32(message.libraryId);
|
||||
writer.tag(2, WireType.Varint).int32(message.libraryId);
|
||||
/* int32 page = 3; */
|
||||
if (message.page !== 0)
|
||||
writer.tag(3, WireType.Varint).int32(message.page);
|
||||
@ -908,7 +908,7 @@ class DocumentTextSearchFromLibraryRequest$Type extends MessageType<DocumentText
|
||||
constructor() {
|
||||
super("LibraryService.DocumentTextSearchFromLibraryRequest", [
|
||||
{ no: 1, name: "query", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "library_id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 2, name: "library_id", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 3, name: "page", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||
]);
|
||||
}
|
||||
@ -929,8 +929,8 @@ class DocumentTextSearchFromLibraryRequest$Type extends MessageType<DocumentText
|
||||
case /* string query */ 1:
|
||||
message.query = reader.string();
|
||||
break;
|
||||
case /* uint32 library_id */ 2:
|
||||
message.libraryId = reader.uint32();
|
||||
case /* int32 library_id */ 2:
|
||||
message.libraryId = reader.int32();
|
||||
break;
|
||||
case /* int32 page */ 3:
|
||||
message.page = reader.int32();
|
||||
@ -950,9 +950,9 @@ class DocumentTextSearchFromLibraryRequest$Type extends MessageType<DocumentText
|
||||
/* string query = 1; */
|
||||
if (message.query !== "")
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.query);
|
||||
/* uint32 library_id = 2; */
|
||||
/* int32 library_id = 2; */
|
||||
if (message.libraryId !== 0)
|
||||
writer.tag(2, WireType.Varint).uint32(message.libraryId);
|
||||
writer.tag(2, WireType.Varint).int32(message.libraryId);
|
||||
/* int32 page = 3; */
|
||||
if (message.page !== 0)
|
||||
writer.tag(3, WireType.Varint).int32(message.page);
|
||||
@ -971,12 +971,12 @@ class DocumentTextSearchFromLibraryResponse$Type extends MessageType<DocumentTex
|
||||
constructor() {
|
||||
super("LibraryService.DocumentTextSearchFromLibraryResponse", [
|
||||
{ no: 1, name: "hits", kind: "message", T: () => DocumentList },
|
||||
{ no: 2, name: "total", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
|
||||
{ no: 2, name: "total", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<DocumentTextSearchFromLibraryResponse>): DocumentTextSearchFromLibraryResponse {
|
||||
const message = globalThis.Object.create((this.messagePrototype!));
|
||||
message.total = 0n;
|
||||
message.total = 0;
|
||||
if (value !== undefined)
|
||||
reflectionMergePartial<DocumentTextSearchFromLibraryResponse>(this, message, value);
|
||||
return message;
|
||||
@ -989,8 +989,8 @@ class DocumentTextSearchFromLibraryResponse$Type extends MessageType<DocumentTex
|
||||
case /* DocumentService.DocumentList hits */ 1:
|
||||
message.hits = DocumentList.internalBinaryRead(reader, reader.uint32(), options, message.hits);
|
||||
break;
|
||||
case /* int64 total */ 2:
|
||||
message.total = reader.int64().toBigInt();
|
||||
case /* int32 total */ 2:
|
||||
message.total = reader.int32();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
@ -1007,9 +1007,9 @@ class DocumentTextSearchFromLibraryResponse$Type extends MessageType<DocumentTex
|
||||
/* DocumentService.DocumentList hits = 1; */
|
||||
if (message.hits)
|
||||
DocumentList.internalBinaryWrite(message.hits, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
|
||||
/* int64 total = 2; */
|
||||
if (message.total !== 0n)
|
||||
writer.tag(2, WireType.Varint).int64(message.total);
|
||||
/* int32 total = 2; */
|
||||
if (message.total !== 0)
|
||||
writer.tag(2, WireType.Varint).int32(message.total);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
@ -1025,7 +1025,7 @@ class VectorSearchByTextFromLibraryRequest$Type extends MessageType<VectorSearch
|
||||
constructor() {
|
||||
super("LibraryService.VectorSearchByTextFromLibraryRequest", [
|
||||
{ no: 1, name: "query", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "library_id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
|
||||
{ no: 2, name: "library_id", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<VectorSearchByTextFromLibraryRequest>): VectorSearchByTextFromLibraryRequest {
|
||||
@ -1044,8 +1044,8 @@ class VectorSearchByTextFromLibraryRequest$Type extends MessageType<VectorSearch
|
||||
case /* string query */ 1:
|
||||
message.query = reader.string();
|
||||
break;
|
||||
case /* uint32 library_id */ 2:
|
||||
message.libraryId = reader.uint32();
|
||||
case /* int32 library_id */ 2:
|
||||
message.libraryId = reader.int32();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
@ -1062,9 +1062,9 @@ class VectorSearchByTextFromLibraryRequest$Type extends MessageType<VectorSearch
|
||||
/* string query = 1; */
|
||||
if (message.query !== "")
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.query);
|
||||
/* uint32 library_id = 2; */
|
||||
/* int32 library_id = 2; */
|
||||
if (message.libraryId !== 0)
|
||||
writer.tag(2, WireType.Varint).uint32(message.libraryId);
|
||||
writer.tag(2, WireType.Varint).int32(message.libraryId);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
@ -1127,9 +1127,9 @@ class DocumentBlockList$Type extends MessageType<DocumentBlockList> {
|
||||
constructor() {
|
||||
super("LibraryService.DocumentBlockList", [
|
||||
{ no: 1, name: "content", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
||||
{ no: 2, name: "document_id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 3, name: "library_id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
|
||||
{ no: 4, name: "block_id", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
|
||||
{ no: 2, name: "document_id", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 3, name: "library_id", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
|
||||
{ no: 4, name: "block_id", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
|
||||
]);
|
||||
}
|
||||
create(value?: PartialMessage<DocumentBlockList>): DocumentBlockList {
|
||||
@ -1150,14 +1150,14 @@ class DocumentBlockList$Type extends MessageType<DocumentBlockList> {
|
||||
case /* string content */ 1:
|
||||
message.content = reader.string();
|
||||
break;
|
||||
case /* uint32 document_id */ 2:
|
||||
message.documentId = reader.uint32();
|
||||
case /* int32 document_id */ 2:
|
||||
message.documentId = reader.int32();
|
||||
break;
|
||||
case /* uint32 library_id */ 3:
|
||||
message.libraryId = reader.uint32();
|
||||
case /* int32 library_id */ 3:
|
||||
message.libraryId = reader.int32();
|
||||
break;
|
||||
case /* uint32 block_id */ 4:
|
||||
message.blockId = reader.uint32();
|
||||
case /* int32 block_id */ 4:
|
||||
message.blockId = reader.int32();
|
||||
break;
|
||||
default:
|
||||
let u = options.readUnknownField;
|
||||
@ -1174,15 +1174,15 @@ class DocumentBlockList$Type extends MessageType<DocumentBlockList> {
|
||||
/* string content = 1; */
|
||||
if (message.content !== "")
|
||||
writer.tag(1, WireType.LengthDelimited).string(message.content);
|
||||
/* uint32 document_id = 2; */
|
||||
/* int32 document_id = 2; */
|
||||
if (message.documentId !== 0)
|
||||
writer.tag(2, WireType.Varint).uint32(message.documentId);
|
||||
/* uint32 library_id = 3; */
|
||||
writer.tag(2, WireType.Varint).int32(message.documentId);
|
||||
/* int32 library_id = 3; */
|
||||
if (message.libraryId !== 0)
|
||||
writer.tag(3, WireType.Varint).uint32(message.libraryId);
|
||||
/* uint32 block_id = 4; */
|
||||
writer.tag(3, WireType.Varint).int32(message.libraryId);
|
||||
/* int32 block_id = 4; */
|
||||
if (message.blockId !== 0)
|
||||
writer.tag(4, WireType.Varint).uint32(message.blockId);
|
||||
writer.tag(4, WireType.Varint).int32(message.blockId);
|
||||
let u = options.writeUnknownFields;
|
||||
if (u !== false)
|
||||
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
||||
|
@ -3,6 +3,7 @@ import { createRouter, createWebHistory } from "vue-router";
|
||||
import { useConfigStore } from "@/store/config";
|
||||
import keycloak from "@/plugins/keycloak"
|
||||
import { useLoginUrlStore } from "@/store/login_url";
|
||||
import staticConfig from "@/plugins/config"
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@ -14,7 +15,7 @@ const routes = [
|
||||
// route level code-splitting
|
||||
// this generates a separate chunk (Home-[hash].js) for this route
|
||||
// which is lazy-loaded when the route is visited.
|
||||
component: () => import("@/views/Home.vue"),
|
||||
component: () => import("@/views/libraries/List.vue"),
|
||||
},
|
||||
{
|
||||
path: "/editor",
|
||||
@ -43,31 +44,10 @@ const routes = [
|
||||
component: () => import("@/views/libraries/Create.vue"),
|
||||
},
|
||||
{
|
||||
path: "/library/:LibraryId/documents",
|
||||
name: "library.documents",
|
||||
path: "/documents/:LibraryId/",
|
||||
name: "documents.list",
|
||||
component: () => import("@/views/documents/List.vue"),
|
||||
},
|
||||
{
|
||||
path: "/library/:LibraryId/query",
|
||||
name: "library.query",
|
||||
component: () => import("@/views/libraries/Query.vue"),
|
||||
},
|
||||
{
|
||||
path: "/library/:LibraryId/documents/create",
|
||||
name: "library.documents.create",
|
||||
component: () => import("@/views/documents/Create.vue"),
|
||||
},
|
||||
{
|
||||
path: "/library/:LibraryId/documents/:DocumentId/edit",
|
||||
name: "library.documents.edit",
|
||||
component: () => import("@/views/documents/Edit.vue"),
|
||||
},
|
||||
{
|
||||
path: "/library/:LibraryId/documents/:DocumentId",
|
||||
name: "library.documents.view",
|
||||
component: () => import("@/views/documents/View.vue"),
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
@ -112,7 +92,7 @@ router.beforeEach((to, from) => {
|
||||
}
|
||||
|
||||
if (to.meta.auth) {
|
||||
if (!keycloak.authenticated) {
|
||||
if (!keycloak.authenticated && !staticConfig.devMode) {
|
||||
router.push({ name: "login" });
|
||||
}
|
||||
} else {
|
||||
|
31
src/views/documents/List.vue
Normal file
31
src/views/documents/List.vue
Normal file
@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<h2>文档</h2>
|
||||
|
||||
<v-card class="mx-auto" max-width="300">
|
||||
<v-list :items="documents?.documents"></v-list>
|
||||
</v-card>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { VList, VCard } from 'vuetify/lib/components/index.mjs'
|
||||
import rpc from '@/plugins/rpc'
|
||||
import { DocumentList, ListDocumentsRequest } from '@/proto/document/document'
|
||||
const useRpc = rpc()
|
||||
const documents = ref<DocumentList>()
|
||||
|
||||
const listDocumentRequest: ListDocumentsRequest = {
|
||||
page: 1
|
||||
}
|
||||
|
||||
useRpc.documentClient.listDocuments(listDocumentRequest).then(r => {
|
||||
documents.value = r.response
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
@ -11,6 +11,8 @@
|
||||
></v-text-field>
|
||||
</div>
|
||||
|
||||
<p v-if="success" class="text-success">成功</p>
|
||||
|
||||
<div class="mt-3">
|
||||
<v-btn @click="create">新建</v-btn>
|
||||
</div>
|
||||
@ -24,6 +26,7 @@ import * as libraryPb from "@/proto/library/library";
|
||||
|
||||
const libraryName = ref("")
|
||||
const useRpc = rpc()
|
||||
const success = ref(false)
|
||||
|
||||
function create() {
|
||||
let createLibrary: libraryPb.CreateLibraryRequest = {
|
||||
@ -36,6 +39,10 @@ function create() {
|
||||
|
||||
useRpc.libraryServiceClient.createLibrary(createLibrary).then((res) => {
|
||||
console.log(res);
|
||||
|
||||
if (res.status.code == "OK") {
|
||||
success.value = true
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<p>资料库</p>
|
||||
<p>选择一个资料库以开始</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -12,14 +12,17 @@ import router from "@/router";
|
||||
import * as libraryProto from "@/proto/library/library";
|
||||
import * as documentProto from "@/proto/document/document";
|
||||
import keycloak from "@/plugins/keycloak"
|
||||
import {libraryServiceClient} from "@/plugins/rpc"
|
||||
import rpc from "@/plugins/rpc"
|
||||
|
||||
const useRpc = rpc()
|
||||
|
||||
|
||||
let listLibrary = {
|
||||
page: 1
|
||||
}
|
||||
|
||||
|
||||
libraryServiceClient.listLibraries(listLibrary).then(res => {
|
||||
useRpc.libraryServiceClient.listLibraries(listLibrary).then(res => {
|
||||
console.log(res)
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user