grpc web
This commit is contained in:
parent
32236ffcd9
commit
948779fdc3
@ -12,9 +12,13 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@notable/html2markdown": "^2.0.3",
|
||||
"@protobuf-ts/grpcweb-transport": "^2.9.4",
|
||||
"@protobuf-ts/runtime-rpc": "^2.9.4",
|
||||
"axios": "^1.6.2",
|
||||
"core-js": "^3.29.0",
|
||||
"event-source-polyfill": "^1.0.31",
|
||||
"google-protobuf": "^3.21.2",
|
||||
"grpc-web": "^1.5.0",
|
||||
"mammoth": "^1.6.0",
|
||||
"md-editor-v3": "^4.8.3",
|
||||
"pdfjs-dist": "^4.0.269",
|
||||
@ -30,6 +34,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.21.4",
|
||||
"@mdi/font": "^7.3.67",
|
||||
"@types/google-protobuf": "^3.15.12",
|
||||
"@types/node": "^18.15.0",
|
||||
"@types/turndown": "^5.0.4",
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
|
@ -8,6 +8,29 @@
|
||||
import { library } from "@/plugins/api";
|
||||
import { ref } from "vue";
|
||||
import { useUserStore } from "@/store/user";
|
||||
import {GrpcWebFetchTransport} from "@protobuf-ts/grpcweb-transport"
|
||||
import {LibraryServiceClient} from "@/proto/library/library.client.ts"
|
||||
import * as libraryProto from "@/proto/library/library.ts";
|
||||
|
||||
let listLibrary: libraryProto.ListLibrariesRequest = {
|
||||
page: 1
|
||||
}
|
||||
|
||||
let transport = new GrpcWebFetchTransport({
|
||||
baseUrl: "https://test.ivampiresp.com",
|
||||
format: "text",
|
||||
meta: {
|
||||
"Authorization": "Bearer 1",
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
let client = new LibraryServiceClient(transport)
|
||||
|
||||
|
||||
let out = client.listLibraries(listLibrary, {})
|
||||
out.then((r) => console.log(r))
|
||||
|
||||
const userStore = useUserStore();
|
||||
const token = ref("");
|
||||
|
||||
|
104
src/proto/document/document.client.ts
Normal file
104
src/proto/document/document.client.ts
Normal file
@ -0,0 +1,104 @@
|
||||
// @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 { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
||||
import { DocumentService } from "./document";
|
||||
import type { DocumentChunkList } 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
|
||||
*/
|
||||
export interface IDocumentServiceClient {
|
||||
/**
|
||||
* @generated from protobuf rpc: ListDocuments(DocumentService.ListDocumentsRequest) returns (DocumentService.DocumentList);
|
||||
*/
|
||||
listDocuments(input: ListDocumentsRequest, options?: RpcOptions): UnaryCall<ListDocumentsRequest, DocumentList>;
|
||||
/**
|
||||
* @generated from protobuf rpc: CreateDocument(DocumentService.CreateDocumentRequest) returns (DocumentService.Document);
|
||||
*/
|
||||
createDocument(input: CreateDocumentRequest, options?: RpcOptions): UnaryCall<CreateDocumentRequest, Document>;
|
||||
/**
|
||||
* @generated from protobuf rpc: GetDocument(DocumentService.GetDocumentRequest) returns (DocumentService.Document);
|
||||
*/
|
||||
getDocument(input: GetDocumentRequest, options?: RpcOptions): UnaryCall<GetDocumentRequest, Document>;
|
||||
/**
|
||||
* @generated from protobuf rpc: UpdateDocument(DocumentService.UpdateDocumentRequest) returns (DocumentService.Document);
|
||||
*/
|
||||
updateDocument(input: UpdateDocumentRequest, options?: RpcOptions): UnaryCall<UpdateDocumentRequest, Document>;
|
||||
/**
|
||||
* @generated from protobuf rpc: DeleteDocument(DocumentService.DeleteDocumentRequest) returns (DocumentService.Empty);
|
||||
*/
|
||||
deleteDocument(input: DeleteDocumentRequest, options?: RpcOptions): UnaryCall<DeleteDocumentRequest, Empty>;
|
||||
/**
|
||||
* rpc SearchTextInDocument(TextSearchInDocumentRequest) returns (SearchResponse) {}
|
||||
*
|
||||
* @generated from protobuf rpc: VectorSearchByTextInDocument(DocumentService.VectorSearchByTextInDocumentRequest) returns (DocumentService.DocumentChunkList);
|
||||
*/
|
||||
vectorSearchByTextInDocument(input: VectorSearchByTextInDocumentRequest, options?: RpcOptions): UnaryCall<VectorSearchByTextInDocumentRequest, DocumentChunkList>;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf service DocumentService.DocumentService
|
||||
*/
|
||||
export class DocumentServiceClient implements IDocumentServiceClient, ServiceInfo {
|
||||
typeName = DocumentService.typeName;
|
||||
methods = DocumentService.methods;
|
||||
options = DocumentService.options;
|
||||
constructor(private readonly _transport: RpcTransport) {
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: ListDocuments(DocumentService.ListDocumentsRequest) returns (DocumentService.DocumentList);
|
||||
*/
|
||||
listDocuments(input: ListDocumentsRequest, options?: RpcOptions): UnaryCall<ListDocumentsRequest, DocumentList> {
|
||||
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ListDocumentsRequest, DocumentList>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: CreateDocument(DocumentService.CreateDocumentRequest) returns (DocumentService.Document);
|
||||
*/
|
||||
createDocument(input: CreateDocumentRequest, options?: RpcOptions): UnaryCall<CreateDocumentRequest, Document> {
|
||||
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<CreateDocumentRequest, Document>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: GetDocument(DocumentService.GetDocumentRequest) returns (DocumentService.Document);
|
||||
*/
|
||||
getDocument(input: GetDocumentRequest, options?: RpcOptions): UnaryCall<GetDocumentRequest, Document> {
|
||||
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<GetDocumentRequest, Document>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: UpdateDocument(DocumentService.UpdateDocumentRequest) returns (DocumentService.Document);
|
||||
*/
|
||||
updateDocument(input: UpdateDocumentRequest, options?: RpcOptions): UnaryCall<UpdateDocumentRequest, Document> {
|
||||
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<UpdateDocumentRequest, Document>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: DeleteDocument(DocumentService.DeleteDocumentRequest) returns (DocumentService.Empty);
|
||||
*/
|
||||
deleteDocument(input: DeleteDocumentRequest, options?: RpcOptions): UnaryCall<DeleteDocumentRequest, Empty> {
|
||||
const method = this.methods[4], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<DeleteDocumentRequest, Empty>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* rpc SearchTextInDocument(TextSearchInDocumentRequest) returns (SearchResponse) {}
|
||||
*
|
||||
* @generated from protobuf rpc: VectorSearchByTextInDocument(DocumentService.VectorSearchByTextInDocumentRequest) returns (DocumentService.DocumentChunkList);
|
||||
*/
|
||||
vectorSearchByTextInDocument(input: VectorSearchByTextInDocumentRequest, options?: RpcOptions): UnaryCall<VectorSearchByTextInDocumentRequest, DocumentChunkList> {
|
||||
const method = this.methods[5], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<VectorSearchByTextInDocumentRequest, DocumentChunkList>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
1046
src/proto/document/document.ts
Normal file
1046
src/proto/document/document.ts
Normal file
File diff suppressed because it is too large
Load Diff
127
src/proto/library/library.client.ts
Normal file
127
src/proto/library/library.client.ts
Normal file
@ -0,0 +1,127 @@
|
||||
// @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 { RpcTransport } from "@protobuf-ts/runtime-rpc";
|
||||
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
|
||||
import { LibraryService } from "./library";
|
||||
import type { VectorChunkSearchByTextFromLibraryResponse } from "./library";
|
||||
import type { VectorChunkSearchByTextFromLibraryRequest } 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
|
||||
*/
|
||||
export interface ILibraryServiceClient {
|
||||
/**
|
||||
* @generated from protobuf rpc: ListLibraries(LibraryService.ListLibrariesRequest) returns (LibraryService.LibraryList);
|
||||
*/
|
||||
listLibraries(input: ListLibrariesRequest, options?: RpcOptions): UnaryCall<ListLibrariesRequest, LibraryList>;
|
||||
/**
|
||||
* @generated from protobuf rpc: CreateLibrary(LibraryService.CreateLibraryRequest) returns (LibraryService.Library);
|
||||
*/
|
||||
createLibrary(input: CreateLibraryRequest, options?: RpcOptions): UnaryCall<CreateLibraryRequest, Library>;
|
||||
/**
|
||||
* @generated from protobuf rpc: GetLibrary(LibraryService.GetLibraryRequest) returns (LibraryService.GetLibraryResponse);
|
||||
*/
|
||||
getLibrary(input: GetLibraryRequest, options?: RpcOptions): UnaryCall<GetLibraryRequest, GetLibraryResponse>;
|
||||
/**
|
||||
* @generated from protobuf rpc: UpdateLibrary(LibraryService.UpdateLibraryRequest) returns (LibraryService.UpdateLibraryResponse);
|
||||
*/
|
||||
updateLibrary(input: UpdateLibraryRequest, options?: RpcOptions): UnaryCall<UpdateLibraryRequest, UpdateLibraryResponse>;
|
||||
/**
|
||||
* @generated from protobuf rpc: DeleteLibrary(LibraryService.DeleteLibraryRequest) returns (LibraryService.Library);
|
||||
*/
|
||||
deleteLibrary(input: DeleteLibraryRequest, options?: RpcOptions): UnaryCall<DeleteLibraryRequest, Library>;
|
||||
/**
|
||||
* @generated from protobuf rpc: DocumentVectorSearchByTextFromLibrary(LibraryService.DocumentVectorSearchByTextFromLibraryRequest) returns (LibraryService.DocumentVectorSearchByTextFromLibraryResponse);
|
||||
*/
|
||||
documentVectorSearchByTextFromLibrary(input: DocumentVectorSearchByTextFromLibraryRequest, options?: RpcOptions): UnaryCall<DocumentVectorSearchByTextFromLibraryRequest, DocumentVectorSearchByTextFromLibraryResponse>;
|
||||
/**
|
||||
* @generated from protobuf rpc: DocumentTextSearchFromLibrary(LibraryService.DocumentTextSearchFromLibraryRequest) returns (LibraryService.DocumentTextSearchFromLibraryResponse);
|
||||
*/
|
||||
documentTextSearchFromLibrary(input: DocumentTextSearchFromLibraryRequest, options?: RpcOptions): UnaryCall<DocumentTextSearchFromLibraryRequest, DocumentTextSearchFromLibraryResponse>;
|
||||
/**
|
||||
* @generated from protobuf rpc: VectorChunkSearchByTextFromLibrary(LibraryService.VectorChunkSearchByTextFromLibraryRequest) returns (LibraryService.VectorChunkSearchByTextFromLibraryResponse);
|
||||
*/
|
||||
vectorChunkSearchByTextFromLibrary(input: VectorChunkSearchByTextFromLibraryRequest, options?: RpcOptions): UnaryCall<VectorChunkSearchByTextFromLibraryRequest, VectorChunkSearchByTextFromLibraryResponse>;
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf service LibraryService.LibraryService
|
||||
*/
|
||||
export class LibraryServiceClient implements ILibraryServiceClient, ServiceInfo {
|
||||
typeName = LibraryService.typeName;
|
||||
methods = LibraryService.methods;
|
||||
options = LibraryService.options;
|
||||
constructor(private readonly _transport: RpcTransport) {
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: ListLibraries(LibraryService.ListLibrariesRequest) returns (LibraryService.LibraryList);
|
||||
*/
|
||||
listLibraries(input: ListLibrariesRequest, options?: RpcOptions): UnaryCall<ListLibrariesRequest, LibraryList> {
|
||||
const method = this.methods[0], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<ListLibrariesRequest, LibraryList>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: CreateLibrary(LibraryService.CreateLibraryRequest) returns (LibraryService.Library);
|
||||
*/
|
||||
createLibrary(input: CreateLibraryRequest, options?: RpcOptions): UnaryCall<CreateLibraryRequest, Library> {
|
||||
const method = this.methods[1], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<CreateLibraryRequest, Library>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: GetLibrary(LibraryService.GetLibraryRequest) returns (LibraryService.GetLibraryResponse);
|
||||
*/
|
||||
getLibrary(input: GetLibraryRequest, options?: RpcOptions): UnaryCall<GetLibraryRequest, GetLibraryResponse> {
|
||||
const method = this.methods[2], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<GetLibraryRequest, GetLibraryResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: UpdateLibrary(LibraryService.UpdateLibraryRequest) returns (LibraryService.UpdateLibraryResponse);
|
||||
*/
|
||||
updateLibrary(input: UpdateLibraryRequest, options?: RpcOptions): UnaryCall<UpdateLibraryRequest, UpdateLibraryResponse> {
|
||||
const method = this.methods[3], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<UpdateLibraryRequest, UpdateLibraryResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: DeleteLibrary(LibraryService.DeleteLibraryRequest) returns (LibraryService.Library);
|
||||
*/
|
||||
deleteLibrary(input: DeleteLibraryRequest, options?: RpcOptions): UnaryCall<DeleteLibraryRequest, Library> {
|
||||
const method = this.methods[4], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<DeleteLibraryRequest, Library>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: DocumentVectorSearchByTextFromLibrary(LibraryService.DocumentVectorSearchByTextFromLibraryRequest) returns (LibraryService.DocumentVectorSearchByTextFromLibraryResponse);
|
||||
*/
|
||||
documentVectorSearchByTextFromLibrary(input: DocumentVectorSearchByTextFromLibraryRequest, options?: RpcOptions): UnaryCall<DocumentVectorSearchByTextFromLibraryRequest, DocumentVectorSearchByTextFromLibraryResponse> {
|
||||
const method = this.methods[5], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<DocumentVectorSearchByTextFromLibraryRequest, DocumentVectorSearchByTextFromLibraryResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: DocumentTextSearchFromLibrary(LibraryService.DocumentTextSearchFromLibraryRequest) returns (LibraryService.DocumentTextSearchFromLibraryResponse);
|
||||
*/
|
||||
documentTextSearchFromLibrary(input: DocumentTextSearchFromLibraryRequest, options?: RpcOptions): UnaryCall<DocumentTextSearchFromLibraryRequest, DocumentTextSearchFromLibraryResponse> {
|
||||
const method = this.methods[6], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<DocumentTextSearchFromLibraryRequest, DocumentTextSearchFromLibraryResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
/**
|
||||
* @generated from protobuf rpc: VectorChunkSearchByTextFromLibrary(LibraryService.VectorChunkSearchByTextFromLibraryRequest) returns (LibraryService.VectorChunkSearchByTextFromLibraryResponse);
|
||||
*/
|
||||
vectorChunkSearchByTextFromLibrary(input: VectorChunkSearchByTextFromLibraryRequest, options?: RpcOptions): UnaryCall<VectorChunkSearchByTextFromLibraryRequest, VectorChunkSearchByTextFromLibraryResponse> {
|
||||
const method = this.methods[7], opt = this._transport.mergeOptions(options);
|
||||
return stackIntercept<VectorChunkSearchByTextFromLibraryRequest, VectorChunkSearchByTextFromLibraryResponse>("unary", this._transport, method, opt, input);
|
||||
}
|
||||
}
|
1196
src/proto/library/library.ts
Normal file
1196
src/proto/library/library.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@
|
||||
"target": "esnext",
|
||||
"useDefineForClassFields": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"composite": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
@ -27,6 +28,6 @@
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue",
|
||||
"vite.config.ts"
|
||||
"vite.config.ts",
|
||||
]
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
|
||||
import ViteFonts from 'unplugin-fonts/vite'
|
||||
import vitePluginRequire from "vite-plugin-require";
|
||||
|
||||
// Utilities
|
||||
import { defineConfig } from 'vite'
|
||||
|
Loading…
Reference in New Issue
Block a user