Skip to content

Commit 13b8567

Browse files
committed
Adding estimate cost operation
1 parent 97d837b commit 13b8567

16 files changed

Lines changed: 758 additions & 350 deletions

gooseai/dashboard/dashboard.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gooseai/engines/engines_pb.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@
1313

1414
var jspb = require('google-protobuf');
1515
var goog = jspb;
16-
var global = (function() {
17-
if (this) { return this; }
18-
if (typeof window !== 'undefined') { return window; }
19-
if (typeof global !== 'undefined') { return global; }
20-
if (typeof self !== 'undefined') { return self; }
21-
return Function('return this')();
22-
}.call(null));
16+
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);
2317

2418
goog.exportSymbol('proto.gooseai.EngineInfo', null, global);
2519
goog.exportSymbol('proto.gooseai.EngineTokenizer', null, global);

gooseai/generation/generation.pb.go

Lines changed: 363 additions & 292 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gooseai/generation/generation_grpc.pb.go

Lines changed: 38 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gooseai/generation/generation_grpc_pb.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ import * as grpc from "grpc";
99
interface IGenerationServiceService extends grpc.ServiceDefinition<grpc.UntypedServiceImplementation> {
1010
generate: grpc.MethodDefinition<generation_pb.Request, generation_pb.Answer>;
1111
chainGenerate: grpc.MethodDefinition<generation_pb.ChainRequest, generation_pb.Answer>;
12+
estimateCost: grpc.MethodDefinition<generation_pb.Request, generation_pb.EstimateCostResponse>;
1213
}
1314

1415
export const GenerationServiceService: IGenerationServiceService;
1516

1617
export interface IGenerationServiceServer extends grpc.UntypedServiceImplementation {
1718
generate: grpc.handleServerStreamingCall<generation_pb.Request, generation_pb.Answer>;
1819
chainGenerate: grpc.handleServerStreamingCall<generation_pb.ChainRequest, generation_pb.Answer>;
20+
estimateCost: grpc.handleUnaryCall<generation_pb.Request, generation_pb.EstimateCostResponse>;
1921
}
2022

2123
export class GenerationServiceClient extends grpc.Client {
@@ -24,4 +26,7 @@ export class GenerationServiceClient extends grpc.Client {
2426
generate(argument: generation_pb.Request, metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientReadableStream<generation_pb.Answer>;
2527
chainGenerate(argument: generation_pb.ChainRequest, metadataOrOptions?: grpc.Metadata | grpc.CallOptions | null): grpc.ClientReadableStream<generation_pb.Answer>;
2628
chainGenerate(argument: generation_pb.ChainRequest, metadata?: grpc.Metadata | null, options?: grpc.CallOptions | null): grpc.ClientReadableStream<generation_pb.Answer>;
29+
estimateCost(argument: generation_pb.Request, callback: grpc.requestCallback<generation_pb.EstimateCostResponse>): grpc.ClientUnaryCall;
30+
estimateCost(argument: generation_pb.Request, metadataOrOptions: grpc.Metadata | grpc.CallOptions | null, callback: grpc.requestCallback<generation_pb.EstimateCostResponse>): grpc.ClientUnaryCall;
31+
estimateCost(argument: generation_pb.Request, metadata: grpc.Metadata | null, options: grpc.CallOptions | null, callback: grpc.requestCallback<generation_pb.EstimateCostResponse>): grpc.ClientUnaryCall;
2732
}

gooseai/generation/generation_grpc_pb.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ function deserialize_gooseai_ChainRequest(buffer_arg) {
2626
return generation_pb.ChainRequest.deserializeBinary(new Uint8Array(buffer_arg));
2727
}
2828

29+
function serialize_gooseai_EstimateCostResponse(arg) {
30+
if (!(arg instanceof generation_pb.EstimateCostResponse)) {
31+
throw new Error('Expected argument of type gooseai.EstimateCostResponse');
32+
}
33+
return Buffer.from(arg.serializeBinary());
34+
}
35+
36+
function deserialize_gooseai_EstimateCostResponse(buffer_arg) {
37+
return generation_pb.EstimateCostResponse.deserializeBinary(new Uint8Array(buffer_arg));
38+
}
39+
2940
function serialize_gooseai_Request(arg) {
3041
if (!(arg instanceof generation_pb.Request)) {
3142
throw new Error('Expected argument of type gooseai.Request');
@@ -64,6 +75,17 @@ var GenerationServiceService = exports.GenerationServiceService = {
6475
responseSerialize: serialize_gooseai_Answer,
6576
responseDeserialize: deserialize_gooseai_Answer,
6677
},
78+
estimateCost: {
79+
path: '/gooseai.GenerationService/EstimateCost',
80+
requestStream: false,
81+
responseStream: false,
82+
requestType: generation_pb.Request,
83+
responseType: generation_pb.EstimateCostResponse,
84+
requestSerialize: serialize_gooseai_Request,
85+
requestDeserialize: deserialize_gooseai_Request,
86+
responseSerialize: serialize_gooseai_EstimateCostResponse,
87+
responseDeserialize: deserialize_gooseai_EstimateCostResponse,
88+
},
6789
};
6890

6991
exports.GenerationServiceClient = grpc.makeGenericClientConstructor(GenerationServiceService);

gooseai/generation/generation_pb.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,26 @@ export namespace ImageParameters {
643643
}
644644
}
645645

646+
export class EstimateCostResponse extends jspb.Message {
647+
getTotalCreditCost(): number;
648+
setTotalCreditCost(value: number): void;
649+
650+
serializeBinary(): Uint8Array;
651+
toObject(includeInstance?: boolean): EstimateCostResponse.AsObject;
652+
static toObject(includeInstance: boolean, msg: EstimateCostResponse): EstimateCostResponse.AsObject;
653+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
654+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
655+
static serializeBinaryToWriter(message: EstimateCostResponse, writer: jspb.BinaryWriter): void;
656+
static deserializeBinary(bytes: Uint8Array): EstimateCostResponse;
657+
static deserializeBinaryFromReader(message: EstimateCostResponse, reader: jspb.BinaryReader): EstimateCostResponse;
658+
}
659+
660+
export namespace EstimateCostResponse {
661+
export type AsObject = {
662+
totalCreditCost: number,
663+
}
664+
}
665+
646666
export class ClassifierConcept extends jspb.Message {
647667
getConcept(): string;
648668
setConcept(value: string): void;

gooseai/generation/generation_pb.js

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ goog.exportSymbol('proto.gooseai.ClassifierParameters', null, global);
3232
goog.exportSymbol('proto.gooseai.ConditionerParameters', null, global);
3333
goog.exportSymbol('proto.gooseai.CutoutParameters', null, global);
3434
goog.exportSymbol('proto.gooseai.DiffusionSampler', null, global);
35+
goog.exportSymbol('proto.gooseai.EstimateCostResponse', null, global);
3536
goog.exportSymbol('proto.gooseai.FinishReason', null, global);
3637
goog.exportSymbol('proto.gooseai.GuidanceInstanceParameters', null, global);
3738
goog.exportSymbol('proto.gooseai.GuidanceParameters', null, global);
@@ -392,6 +393,27 @@ if (goog.DEBUG && !COMPILED) {
392393
*/
393394
proto.gooseai.ImageParameters.displayName = 'proto.gooseai.ImageParameters';
394395
}
396+
/**
397+
* Generated by JsPbCodeGenerator.
398+
* @param {Array=} opt_data Optional initial data array, typically from a
399+
* server response, or constructed directly in Javascript. The array is used
400+
* in place and becomes part of the constructed object. It is not cloned.
401+
* If no data is provided, the constructed object will be empty, but still
402+
* valid.
403+
* @extends {jspb.Message}
404+
* @constructor
405+
*/
406+
proto.gooseai.EstimateCostResponse = function(opt_data) {
407+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
408+
};
409+
goog.inherits(proto.gooseai.EstimateCostResponse, jspb.Message);
410+
if (goog.DEBUG && !COMPILED) {
411+
/**
412+
* @public
413+
* @override
414+
*/
415+
proto.gooseai.EstimateCostResponse.displayName = 'proto.gooseai.EstimateCostResponse';
416+
}
395417
/**
396418
* Generated by JsPbCodeGenerator.
397419
* @param {Array=} opt_data Optional initial data array, typically from a
@@ -5240,6 +5262,136 @@ proto.gooseai.ImageParameters.prototype.clearParametersList = function() {
52405262

52415263

52425264

5265+
if (jspb.Message.GENERATE_TO_OBJECT) {
5266+
/**
5267+
* Creates an object representation of this proto.
5268+
* Field names that are reserved in JavaScript and will be renamed to pb_name.
5269+
* Optional fields that are not set will be set to undefined.
5270+
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
5271+
* For the list of reserved names please see:
5272+
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
5273+
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
5274+
* JSPB instance for transitional soy proto support:
5275+
* http://goto/soy-param-migration
5276+
* @return {!Object}
5277+
*/
5278+
proto.gooseai.EstimateCostResponse.prototype.toObject = function(opt_includeInstance) {
5279+
return proto.gooseai.EstimateCostResponse.toObject(opt_includeInstance, this);
5280+
};
5281+
5282+
5283+
/**
5284+
* Static version of the {@see toObject} method.
5285+
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
5286+
* the JSPB instance for transitional soy proto support:
5287+
* http://goto/soy-param-migration
5288+
* @param {!proto.gooseai.EstimateCostResponse} msg The msg instance to transform.
5289+
* @return {!Object}
5290+
* @suppress {unusedLocalVariables} f is only used for nested messages
5291+
*/
5292+
proto.gooseai.EstimateCostResponse.toObject = function(includeInstance, msg) {
5293+
var f, obj = {
5294+
totalCreditCost: jspb.Message.getFloatingPointFieldWithDefault(msg, 1, 0.0)
5295+
};
5296+
5297+
if (includeInstance) {
5298+
obj.$jspbMessageInstance = msg;
5299+
}
5300+
return obj;
5301+
};
5302+
}
5303+
5304+
5305+
/**
5306+
* Deserializes binary data (in protobuf wire format).
5307+
* @param {jspb.ByteSource} bytes The bytes to deserialize.
5308+
* @return {!proto.gooseai.EstimateCostResponse}
5309+
*/
5310+
proto.gooseai.EstimateCostResponse.deserializeBinary = function(bytes) {
5311+
var reader = new jspb.BinaryReader(bytes);
5312+
var msg = new proto.gooseai.EstimateCostResponse;
5313+
return proto.gooseai.EstimateCostResponse.deserializeBinaryFromReader(msg, reader);
5314+
};
5315+
5316+
5317+
/**
5318+
* Deserializes binary data (in protobuf wire format) from the
5319+
* given reader into the given message object.
5320+
* @param {!proto.gooseai.EstimateCostResponse} msg The message object to deserialize into.
5321+
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
5322+
* @return {!proto.gooseai.EstimateCostResponse}
5323+
*/
5324+
proto.gooseai.EstimateCostResponse.deserializeBinaryFromReader = function(msg, reader) {
5325+
while (reader.nextField()) {
5326+
if (reader.isEndGroup()) {
5327+
break;
5328+
}
5329+
var field = reader.getFieldNumber();
5330+
switch (field) {
5331+
case 1:
5332+
var value = /** @type {number} */ (reader.readDouble());
5333+
msg.setTotalCreditCost(value);
5334+
break;
5335+
default:
5336+
reader.skipField();
5337+
break;
5338+
}
5339+
}
5340+
return msg;
5341+
};
5342+
5343+
5344+
/**
5345+
* Serializes the message to binary data (in protobuf wire format).
5346+
* @return {!Uint8Array}
5347+
*/
5348+
proto.gooseai.EstimateCostResponse.prototype.serializeBinary = function() {
5349+
var writer = new jspb.BinaryWriter();
5350+
proto.gooseai.EstimateCostResponse.serializeBinaryToWriter(this, writer);
5351+
return writer.getResultBuffer();
5352+
};
5353+
5354+
5355+
/**
5356+
* Serializes the given message to binary data (in protobuf wire
5357+
* format), writing to the given BinaryWriter.
5358+
* @param {!proto.gooseai.EstimateCostResponse} message
5359+
* @param {!jspb.BinaryWriter} writer
5360+
* @suppress {unusedLocalVariables} f is only used for nested messages
5361+
*/
5362+
proto.gooseai.EstimateCostResponse.serializeBinaryToWriter = function(message, writer) {
5363+
var f = undefined;
5364+
f = message.getTotalCreditCost();
5365+
if (f !== 0.0) {
5366+
writer.writeDouble(
5367+
1,
5368+
f
5369+
);
5370+
}
5371+
};
5372+
5373+
5374+
/**
5375+
* optional double total_credit_cost = 1;
5376+
* @return {number}
5377+
*/
5378+
proto.gooseai.EstimateCostResponse.prototype.getTotalCreditCost = function() {
5379+
return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0));
5380+
};
5381+
5382+
5383+
/**
5384+
* @param {number} value
5385+
* @return {!proto.gooseai.EstimateCostResponse} returns this
5386+
*/
5387+
proto.gooseai.EstimateCostResponse.prototype.setTotalCreditCost = function(value) {
5388+
return jspb.Message.setProto3FloatField(this, 1, value);
5389+
};
5390+
5391+
5392+
5393+
5394+
52435395
if (jspb.Message.GENERATE_TO_OBJECT) {
52445396
/**
52455397
* Creates an object representation of this proto.

0 commit comments

Comments
 (0)