Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,31 @@ if (NOT ${EXIT_CODE} EQUAL 0)
endif()
set(NODE_BIN_DIRECTORY "${PROJECT_SOURCE_DIR}/node_modules/.bin")

set(javascript_exec "protoc")
set(javascript_exec "${PROJECT_SOURCE_DIR}/src/bin/protoc")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could cause the docker build to fail in the future, as well as failing on other platforms; I think it should either use a variable to point to protoc directly so that can be overridden by the build, or we should copy the binary to this location during the docker build.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The binary is actually already in that location, and the docker build works, other platforms could be an issue as it is a linux amd64 binary. This is just putting this back in a state that actually works, as without it some systems (like mine) have a system protoc version that is not able to be used for TS/JS generation.

I would prefer us to not be building the proto definitions manually most of the time anyhow and relying on Actions here to build them as it provides a more controlled environment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm aware it'll work fine in most scenarios, which is why I'm fine with this being merged as is - just wanted to make a note.

set(javascript_plugin "--plugin=protoc-gen-ts=${NODE_BIN_DIRECTORY}/protoc-gen-ts")
set(javascript_args "")
set(javascript_output "--js_out=import_style=commonjs,binary:")
set(javascript_output_dir "${PROJECT_SOURCE_DIR}/gooseai")
file(MAKE_DIRECTORY "${javascript_output_dir}")
set(javascript_exts "_pb.js")

set(javascript_grpc_exec "protoc")
set(javascript_grpc_exec "${PROJECT_SOURCE_DIR}/src/bin/protoc")
set(javascript_grpc_plugin "--plugin=protoc-gen-ts=${NODE_BIN_DIRECTORY}/protoc-gen-ts" "--plugin=protoc-gen-grpc=${NODE_BIN_DIRECTORY}/grpc_tools_node_protoc_plugin")
set(javascript_grpc_args "")
set(javascript_grpc_output "--grpc_out=import_style=commonjs,binary:")
set(javascript_grpc_output_dir "${PROJECT_SOURCE_DIR}/gooseai")
file(MAKE_DIRECTORY "${javascript_grpc_output_dir}")
set(javascript_grpc_exts "_grpc_pb.js")

set(typescript_web_exec "protoc")
set(typescript_web_exec "${PROJECT_SOURCE_DIR}/src/bin/protoc")
set(typescript_web_plugin "--plugin=protoc-gen-ts=${NODE_BIN_DIRECTORY}/protoc-gen-ts")
set(typescript_web_args "")
set(typescript_web_output "--ts_out=service=grpc-web:")
set(typescript_web_output_dir "${PROJECT_SOURCE_DIR}/gooseai")
file(MAKE_DIRECTORY "${typescript_output_dir}")
set(typescript_web_exts "_grpc_pb_service.d.ts;_grpc_pb_service.js")

set(typescript_node_exec "protoc")
set(typescript_node_exec "${PROJECT_SOURCE_DIR}/src/bin/protoc")
set(typescript_node_plugin "--plugin=protoc-gen-ts=${NODE_BIN_DIRECTORY}/protoc-gen-ts" "--plugin=protoc-gen-grpc=${NODE_BIN_DIRECTORY}/grpc_tools_node_protoc_plugin")
set(typescript_node_args "")
set(typescript_node_output "--ts_out=service=grpc-node:")
Expand Down Expand Up @@ -244,6 +244,7 @@ add_protobufs(${CMAKE_SOURCE_DIR}/src/proto/dashboard.proto)
add_protobufs(${CMAKE_SOURCE_DIR}/src/proto/generation.proto)
add_protobufs(${CMAKE_SOURCE_DIR}/src/proto/completion.proto)
add_protobufs(${CMAKE_SOURCE_DIR}/src/proto/engines.proto)
add_protobufs(${CMAKE_SOURCE_DIR}/src/proto/project.proto)
generate_interfaces()

add_custom_command(
Expand Down
1,016 changes: 556 additions & 460 deletions gooseai/generation/generation.pb.go

Large diffs are not rendered by default.

28 changes: 25 additions & 3 deletions gooseai/generation/generation_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export class Artifact extends jspb.Message {
getSeed(): number;
setSeed(value: number): void;

getUuid(): string;
setUuid(value: string): void;

getSize(): number;
setSize(value: number): void;

getDataCase(): Artifact.DataCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Artifact.AsObject;
Expand All @@ -127,6 +133,8 @@ export namespace Artifact {
index: number,
finishReason: FinishReasonMap[keyof FinishReasonMap],
seed: number,
uuid: string,
size: number,
}

export enum DataCase {
Expand Down Expand Up @@ -743,8 +751,11 @@ export class AssetParameters extends jspb.Message {
getAction(): AssetActionMap[keyof AssetActionMap];
setAction(value: AssetActionMap[keyof AssetActionMap]): void;

getProject(): number;
setProject(value: number): void;
getProjectId(): string;
setProjectId(value: string): void;

getUse(): AssetUseMap[keyof AssetUseMap];
setUse(value: AssetUseMap[keyof AssetUseMap]): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssetParameters.AsObject;
Expand All @@ -759,7 +770,8 @@ export class AssetParameters extends jspb.Message {
export namespace AssetParameters {
export type AsObject = {
action: AssetActionMap[keyof AssetActionMap],
project: number,
projectId: string,
use: AssetUseMap[keyof AssetUseMap],
}
}

Expand Down Expand Up @@ -1096,6 +1108,16 @@ export interface AssetActionMap {

export const AssetAction: AssetActionMap;

export interface AssetUseMap {
ASSET_USE_UNDEFINED: 0;
ASSET_USE_INPUT: 1;
ASSET_USE_OUTPUT: 2;
ASSET_USE_INTERMEDIATE: 3;
ASSET_USE_PROJECT: 4;
}

export const AssetUse: AssetUseMap;

export interface StageActionMap {
STAGE_ACTION_PASS: 0;
STAGE_ACTION_DISCARD: 1;
Expand Down
138 changes: 117 additions & 21 deletions gooseai/generation/generation_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@

var jspb = require('google-protobuf');
var goog = jspb;
var global = (function() {
if (this) { return this; }
if (typeof window !== 'undefined') { return window; }
if (typeof global !== 'undefined') { return global; }
if (typeof self !== 'undefined') { return self; }
return Function('return this')();
}.call(null));
var global = (function() { return this || window || global || self || Function('return this')(); }).call(null);

goog.exportSymbol('proto.gooseai.Action', null, global);
goog.exportSymbol('proto.gooseai.Answer', null, global);
Expand All @@ -29,6 +23,7 @@ goog.exportSymbol('proto.gooseai.Artifact.DataCase', null, global);
goog.exportSymbol('proto.gooseai.ArtifactType', null, global);
goog.exportSymbol('proto.gooseai.AssetAction', null, global);
goog.exportSymbol('proto.gooseai.AssetParameters', null, global);
goog.exportSymbol('proto.gooseai.AssetUse', null, global);
goog.exportSymbol('proto.gooseai.ChainRequest', null, global);
goog.exportSymbol('proto.gooseai.ClassifierCategory', null, global);
goog.exportSymbol('proto.gooseai.ClassifierConcept', null, global);
Expand Down Expand Up @@ -1063,7 +1058,9 @@ proto.gooseai.Artifact.toObject = function(includeInstance, msg) {
classifier: (f = msg.getClassifier()) && proto.gooseai.ClassifierParameters.toObject(includeInstance, f),
index: jspb.Message.getFieldWithDefault(msg, 8, 0),
finishReason: jspb.Message.getFieldWithDefault(msg, 9, 0),
seed: jspb.Message.getFieldWithDefault(msg, 10, 0)
seed: jspb.Message.getFieldWithDefault(msg, 10, 0),
uuid: jspb.Message.getFieldWithDefault(msg, 12, ""),
size: jspb.Message.getFieldWithDefault(msg, 13, 0)
};

if (includeInstance) {
Expand Down Expand Up @@ -1146,6 +1143,14 @@ proto.gooseai.Artifact.deserializeBinaryFromReader = function(msg, reader) {
var value = /** @type {number} */ (reader.readUint32());
msg.setSeed(value);
break;
case 12:
var value = /** @type {string} */ (reader.readString());
msg.setUuid(value);
break;
case 13:
var value = /** @type {number} */ (reader.readUint64());
msg.setSize(value);
break;
default:
reader.skipField();
break;
Expand Down Expand Up @@ -1254,6 +1259,20 @@ proto.gooseai.Artifact.serializeBinaryToWriter = function(message, writer) {
f
);
}
f = message.getUuid();
if (f.length > 0) {
writer.writeString(
12,
f
);
}
f = message.getSize();
if (f !== 0) {
writer.writeUint64(
13,
f
);
}
};


Expand Down Expand Up @@ -1571,6 +1590,42 @@ proto.gooseai.Artifact.prototype.setSeed = function(value) {
};


/**
* optional string uuid = 12;
* @return {string}
*/
proto.gooseai.Artifact.prototype.getUuid = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, ""));
};


/**
* @param {string} value
* @return {!proto.gooseai.Artifact} returns this
*/
proto.gooseai.Artifact.prototype.setUuid = function(value) {
return jspb.Message.setProto3StringField(this, 12, value);
};


/**
* optional uint64 size = 13;
* @return {number}
*/
proto.gooseai.Artifact.prototype.getSize = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0));
};


/**
* @param {number} value
* @return {!proto.gooseai.Artifact} returns this
*/
proto.gooseai.Artifact.prototype.setSize = function(value) {
return jspb.Message.setProto3IntField(this, 13, value);
};





Expand Down Expand Up @@ -5988,7 +6043,8 @@ proto.gooseai.AssetParameters.prototype.toObject = function(opt_includeInstance)
proto.gooseai.AssetParameters.toObject = function(includeInstance, msg) {
var f, obj = {
action: jspb.Message.getFieldWithDefault(msg, 1, 0),
project: jspb.Message.getFieldWithDefault(msg, 2, 0)
projectId: jspb.Message.getFieldWithDefault(msg, 2, ""),
use: jspb.Message.getFieldWithDefault(msg, 3, 0)
};

if (includeInstance) {
Expand Down Expand Up @@ -6030,8 +6086,12 @@ proto.gooseai.AssetParameters.deserializeBinaryFromReader = function(msg, reader
msg.setAction(value);
break;
case 2:
var value = /** @type {number} */ (reader.readUint64());
msg.setProject(value);
var value = /** @type {string} */ (reader.readString());
msg.setProjectId(value);
break;
case 3:
var value = /** @type {!proto.gooseai.AssetUse} */ (reader.readEnum());
msg.setUse(value);
break;
default:
reader.skipField();
Expand Down Expand Up @@ -6069,13 +6129,20 @@ proto.gooseai.AssetParameters.serializeBinaryToWriter = function(message, writer
f
);
}
f = message.getProject();
if (f !== 0) {
writer.writeUint64(
f = message.getProjectId();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getUse();
if (f !== 0.0) {
writer.writeEnum(
3,
f
);
}
};


Expand All @@ -6098,20 +6165,38 @@ proto.gooseai.AssetParameters.prototype.setAction = function(value) {


/**
* optional uint64 project = 2;
* @return {number}
* optional string project_id = 2;
* @return {string}
*/
proto.gooseai.AssetParameters.prototype.getProject = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
proto.gooseai.AssetParameters.prototype.getProjectId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};


/**
* @param {number} value
* @param {string} value
* @return {!proto.gooseai.AssetParameters} returns this
*/
proto.gooseai.AssetParameters.prototype.setProject = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
proto.gooseai.AssetParameters.prototype.setProjectId = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};


/**
* optional AssetUse use = 3;
* @return {!proto.gooseai.AssetUse}
*/
proto.gooseai.AssetParameters.prototype.getUse = function() {
return /** @type {!proto.gooseai.AssetUse} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};


/**
* @param {!proto.gooseai.AssetUse} value
* @return {!proto.gooseai.AssetParameters} returns this
*/
proto.gooseai.AssetParameters.prototype.setUse = function(value) {
return jspb.Message.setProto3EnumField(this, 3, value);
};


Expand Down Expand Up @@ -8007,6 +8092,17 @@ proto.gooseai.AssetAction = {
ASSET_DELETE: 2
};

/**
* @enum {number}
*/
proto.gooseai.AssetUse = {
ASSET_USE_UNDEFINED: 0,
ASSET_USE_INPUT: 1,
ASSET_USE_OUTPUT: 2,
ASSET_USE_INTERMEDIATE: 3,
ASSET_USE_PROJECT: 4
};

/**
* @enum {number}
*/
Expand Down
Loading