Skip to content

Commit

Permalink
remove duplicate descriptions + rename [Input(Type=file)] to use string?
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Nov 25, 2024
1 parent 8dbd1fd commit dcb0490
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 245 deletions.
2 changes: 0 additions & 2 deletions AiServer.ServiceInterface/ComfyApiServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class ComfyApiServices(AppData appData) : Service
{
public async Task<object> Any(GetComfyModels request)
{

try
{
var comfyClient = new ComfyClient(request.ApiBaseUrl!, request.ApiKey);
Expand Down Expand Up @@ -42,4 +41,3 @@ public async Task<object> Any(GetComfyModelMappings request)
};
}
}

64 changes: 32 additions & 32 deletions AiServer.ServiceModel/ApiAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,80 @@
namespace AiServer.ServiceModel;

[Tag(Tags.AiInfo)]
[Description("Different Models available in AI Server")]
[Api("Different Models available in AI Server")]
public class QueryAiModels : QueryDb<AiModel> {}

[Tag(Tags.AiInfo)]
[Description("The Type and behavior of different API Providers")]
[Api("The Type and behavior of different API Providers")]
public class QueryAiTypes : QueryDb<AiType> {}

[Tag(Tags.AiInfo)]
[Description("Active AI Worker Models available in AI Server")]
[Api("Active AI Worker Models available in AI Server")]
public class ActiveAiModels : IGet, IReturn<StringsResponse> {}


[Tag(Tags.AiInfo)]
[ValidateApiKey]
[Description("AI Providers")]
[Api("AI Providers")]
public class QueryAiProviders : QueryDb<AiProvider>
{
public string? Name { get; set; }
}

[Tag(Tags.Admin)]
[ValidateAuthSecret]
[Description("Add an AI Provider to process AI Requests")]
[Api("Add an AI Provider to process AI Requests")]
[AutoPopulate(nameof(AiProvider.CreatedDate), Eval = "utcNow")]
public class CreateAiProvider : ICreateDb<AiProvider>, IReturn<IdResponse>
{
[ValidateGreaterThan(0)]
[Input(Type = "hidden")]
[Description("The Type of this API Provider")]
[ApiMember(Description="The Type of this API Provider")]
public string AiTypeId { get; set; }

Check warning on line 36 in AiServer.ServiceModel/ApiAdmin.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'AiTypeId' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

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

[ValidateNotEmpty]
[Description("The unique name for this API Provider")]
[ApiMember(Description="The unique name for this API Provider")]
public string Name { get; set; }

Check warning on line 43 in AiServer.ServiceModel/ApiAdmin.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Name' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

[Input(Type = "hidden")]
[Description("The API Key to use for this Provider")]
[ApiMember(Description="The API Key to use for this Provider")]
public string? ApiKeyVar { get; set; }

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

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

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

[Input(Type = "hidden")]
[Description("Override API Paths for different AI Requests")]
[ApiMember(Description="Override API Paths for different AI Requests")]
public Dictionary<TaskType, string>? TaskPaths { get; set; }

[Input(Type = "hidden")]
[Description("How many requests should be made concurrently")]
[ApiMember(Description="How many requests should be made concurrently")]
public int Concurrency { get; set; }

[Input(Type = "select", EvalAllowableEntries = "{ '-1':'Low', '0':'Normal', 1:'High', 2:'Highest' }")]
[Description("What priority to give this Provider to use for processing models")]
[ApiMember(Description="What priority to give this Provider to use for processing models")]
public int Priority { get; set; }

[Description("Whether the Provider is enabled")]
[ApiMember(Description="Whether the Provider is enabled")]
public bool Enabled { get; set; }

[Input(Type = "hidden")]
[Description("The models this API Provider should process")]
[ApiMember(Description="The models this API Provider should process")]
public List<AiProviderModel>? Models { get; set; }

[Input(Type = "hidden")]
[Description("The selected models this API Provider should process")]
[ApiMember(Description="The selected models this API Provider should process")]
public List<string>? SelectedModels { get; set; }
}

Expand All @@ -88,54 +88,54 @@ public class UpdateAiProvider : IPatchDb<AiProvider>, IReturn<IdResponse>
public int Id { get; set; }

[Input(Type = "hidden")]
[Description("The Type of this API Provider")]
[ApiMember(Description="The Type of this API Provider")]
public string? AiTypeId { get; set; }

[Description("The Base URL for the API Provider")]
[ApiMember(Description="The Base URL for the API Provider")]
[Input(Type = "text", Placeholder = "e.g. http://localhost:11434")]
public string? ApiBaseUrl { get; set; }

[Description("The unique name for this API Provider")]
[ApiMember(Description="The unique name for this API Provider")]
public string? Name { get; set; }

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

[Description("The API Key to use for this Provider")]
[ApiMember(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")]
[ApiMember(Description="Send the API Key in the Header instead of Authorization Bearer")]
public string? ApiKeyHeader { get; set; }

[Description("The URL to check if the API Provider is still online")]
[ApiMember(Description="The URL to check if the API Provider is still online")]
public string? HeartbeatUrl { get; set; }

[Input(Type = "hidden")]
[Description("Override API Paths for different AI Requests")]
[ApiMember(Description="Override API Paths for different AI Requests")]
public Dictionary<TaskType, string>? TaskPaths { get; set; }

[Description("How many requests should be made concurrently")]
[ApiMember(Description="How many requests should be made concurrently")]
public int? Concurrency { get; set; }

[Input(Type = "select", EvalAllowableEntries = "{ '-1':'Low', '0':'Normal', 1:'High', 2:'Highest' }")]
[Description("What priority to give this Provider to use for processing models")]
[ApiMember(Description="What priority to give this Provider to use for processing models")]
public int? Priority { get; set; }

[Description("Whether the Provider is enabled")]
[ApiMember(Description="Whether the Provider is enabled")]
public bool? Enabled { get; set; }

[Input(Type = "hidden")]
[Description("The models this API Provider should process")]
[ApiMember(Description="The models this API Provider should process")]
public List<AiProviderModel>? Models { get; set; }

[Input(Type = "hidden")]
[Description("The selected models this API Provider should process")]
[ApiMember(Description="The selected models this API Provider should process")]
public List<string>? SelectedModels { get; set; }
}

[Tag(Tags.Admin)]
[ValidateAuthSecret]
[Description("Delete API Provider")]
[Api("Delete API Provider")]
public class DeleteAiProvider : IDeleteDb<AiProvider>, IReturnVoid
{
public int Id { get; set; }
Expand Down
34 changes: 17 additions & 17 deletions AiServer.ServiceModel/GenerationAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ public class CreateMediaProvider : ICreateDb<MediaProvider>, IReturn<IdResponse>
public string? HeartbeatUrl { get; set; }


[Description("How many requests should be made concurrently")]
[ApiMember(Description="How many requests should be made concurrently")]
[Input(Type = "hidden")]
public int Concurrency { get; set; }


[Description("What priority to give this Provider to use for processing models")]
[ApiMember(Description="What priority to give this Provider to use for processing models")]
[Input(Type = "hidden")]
public int Priority { get; set; }

[Description("Whether the Provider is enabled")]
[ApiMember(Description="Whether the Provider is enabled")]
public bool Enabled { get; set; }

[Description("The date the Provider was last online")]
[ApiMember(Description="The date the Provider was last online")]
[Input(Type = "hidden")]
public DateTime? OfflineDate { get; set; }

[Description("Models this API Provider should process")]
[ApiMember(Description="Models this API Provider should process")]
[Input(Type = "hidden")]
public List<string>? Models { get; set; }

Expand All @@ -54,7 +54,7 @@ public class CreateMediaProvider : ICreateDb<MediaProvider>, IReturn<IdResponse>
}

[Tag(Tags.AiInfo)]
[Description("Media Models")]
[Api("Media Models")]
public class QueryMediaModels : QueryDb<MediaModel>
{
public string? Id { get; set; }
Expand All @@ -64,49 +64,49 @@ public class QueryMediaModels : QueryDb<MediaModel>

[Tag(Tags.Admin)]
[ValidateAuthSecret]
[Description("Update a Generation API Provider")]
[Api("Update a Generation API Provider")]
public class UpdateMediaProvider : IPatchDb<MediaProvider>, IReturn<IdResponse>
{
public int Id { get; set; }

[Description("The API Key to use for this Provider")]
[ApiMember(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")]
[ApiMember(Description="Send the API Key in the Header instead of Authorization Bearer")]
public string? ApiKeyHeader { get; set; }

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

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

[Description("How many requests should be made concurrently")]
[ApiMember(Description="How many requests should be made concurrently")]
public int? Concurrency { get; set; }

[Input(Type = "select", EvalAllowableEntries = "{ '-1':'Low', '0':'Normal', 1:'High', 2:'Highest' }")]
[Description("What priority to give this Provider to use for processing models")]
[ApiMember(Description="What priority to give this Provider to use for processing models")]
public int? Priority { get; set; }

[Description("Whether the Provider is enabled")]
[ApiMember(Description="Whether the Provider is enabled")]
public bool? Enabled { get; set; }

[Input(Type = "hidden")]
[Description("The models this API Provider should process")]
[ApiMember(Description="The models this API Provider should process")]
public List<string>? Models { get; set; }
}

[Tag(Tags.Admin)]
[ValidateAuthSecret]
[Description("Delete a Generation API Provider")]
[Api("Delete a Generation API Provider")]
public class DeleteMediaProvider : IDeleteDb<MediaProvider>, IReturn<IdResponse>
{
public int? Id { get; set; }
public string? Name { get; set; }
}

[Tag(Tags.AiInfo)]
[Description("Text to Speech Voice models")]
[Api("Text to Speech Voice models")]
public class QueryTextToSpeechVoices : QueryDb<TextToSpeechVoice>
{
}
Loading

0 comments on commit dcb0490

Please sign in to comment.