Skip to content

Commit

Permalink
Remove use of description in favour of API member
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Nov 25, 2024
1 parent 0071ee6 commit 8dbd1fd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 206 deletions.
7 changes: 0 additions & 7 deletions AiServer.ServiceModel/GenerationAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace AiServer.ServiceModel;

[Tag(Tags.AiInfo)]
[ValidateApiKey]
[Description("Media Providers")]
public class QueryMediaProviders : QueryDb<MediaProvider>
{
public int? Id { get; set; }
Expand All @@ -15,23 +14,17 @@ public class QueryMediaProviders : QueryDb<MediaProvider>

[Tag(Tags.Admin)]
[ValidateAuthSecret]
[Description("Add an API Provider to Generation API Providers")]
[AutoPopulate(nameof(MediaProvider.CreatedDate), Eval = "utcNow")]
public class CreateMediaProvider : ICreateDb<MediaProvider>, IReturn<IdResponse>
{
[Description("The name of the API Provider")]
public string Name { get; set; }

[Description("The API Key to use for this Provider")]
public string? ApiKey { get; set; }

[Description("Send the API Key in the Header instead of Authorization Bearer")]
public string? ApiKeyHeader { get; set; }

[Description("Base URL for the Generation Provider")]
public string? ApiBaseUrl { get; set; }

[Description("Url to check if the API is online")]
[Input(Type = "hidden")]
public string? HeartbeatUrl { get; set; }

Expand Down
15 changes: 0 additions & 15 deletions AiServer.ServiceModel/Generations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,80 +11,65 @@ public class ActiveMediaModels : IGet, IReturn<StringsResponse> {}
[ValidateApiKey]
[Tag(Tags.AI)]
[Api("Convert speech to text")]
[Description("Transcribe audio content to text")]
[SystemJson(UseSystemJson.Response)]
public class SpeechToText : IGeneration, IReturn<TextGenerationResponse>
{
[ApiMember(Description = "The audio stream containing the speech to be transcribed")]
[Description("The audio stream containing the speech to be transcribed")]
[Required]
[Input(Type = "file")]
public Stream Audio { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }
}

[ValidateApiKey]
[Tag(Tags.AI)]
[Api("Convert text to speech")]
[Description("Generate speech audio from text input")]
[SystemJson(UseSystemJson.Response)]
public class TextToSpeech : IGeneration, IReturn<ArtifactGenerationResponse>
{
[ApiMember(Description = "The text to be converted to speech")]
[Description("The text to be converted to speech")]
[ValidateNotEmpty]
public string Input { get; set; }

[ApiMember(Description = "Optional specific model and voice to use for speech generation")]
[Description("Optional specific model and voice to use for speech generation")]
public string? Model { get; set; }

[ApiMember(Description = "Optional seed for reproducible results in speech generation")]
[Description("Optional seed for reproducible results in speech generation")]
[Range(0, int.MaxValue)]
public int? Seed { get; set; }

[ApiMember(Description = "Optional client-provided identifier for the request")]
[Description("Optional client-provided identifier for the request")]
public string? RefId { get; set; }

[ApiMember(Description = "Tag to identify the request")]
[Description("Tag to identify the request")]
public string? Tag { get; set; }
}

[ValidateApiKey]
[Tag(Tags.AI)]
[Api("Generate image from text description")]
[Description("Create an image based on a text prompt")]
[SystemJson(UseSystemJson.Response)]
public class TextToImage : IGeneration, IReturn<ArtifactGenerationResponse>
{
[ApiMember(Description = "The main prompt describing the desired image")]
[Description("The main prompt describing the desired image")]
[ValidateNotEmpty]
[Input(Type = "textarea")]
public string PositivePrompt { get; set; }

[ApiMember(Description = "Optional prompt specifying what should not be in the image")]
[Description("Optional prompt specifying what should not be in the image")]
[Input(Type = "textarea")]
public string? NegativePrompt { get; set; }

[ApiMember(Description = "Desired width of the generated image")]
[Description("Desired width of the generated image")]
[Range(64, 2048)]
public int? Width { get; set; }

[ApiMember(Description = "Desired height of the generated image")]
[Description("Desired height of the generated image")]
[Range(64, 2048)]
public int? Height { get; set; }

Expand Down
6 changes: 0 additions & 6 deletions AiServer.ServiceModel/OpenAiChatServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,21 @@ public class GetOpenAiChatStatus : IGet, IReturn<GetOpenAiChatStatusResponse>
public class GetOpenAiChatStatusResponse
{
[ApiMember(Description = "Unique identifier of the background job")]
[Description("Unique identifier of the background job")]
public long JobId { get; set; }

[ApiMember(Description = "Client-provided identifier for the request")]
[Description("Client-provided identifier for the request")]
public string RefId { get; set; }

[ApiMember(Description = "Current state of the background job")]
[Description("Current state of the background job")]
public BackgroundJobState JobState { get; set; }

[ApiMember(Description = "Current status of the generation request")]
[Description("Current status of the generation request")]
public string? Status { get; set; }

[ApiMember(Description = "Detailed response status information")]
[Description("Detailed response status information")]
public ResponseStatus? ResponseStatus { get; set; }

[ApiMember(Description = "Chat result")]
[Description("Chat result")]
public OpenAiChatResponse? Result { get; set; }
}

Expand Down
Loading

0 comments on commit 8dbd1fd

Please sign in to comment.