Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Oct 8, 2024
2 parents 4346e43 + d0dc488 commit 96e815d
Show file tree
Hide file tree
Showing 11 changed files with 2,466 additions and 1,865 deletions.
5 changes: 3 additions & 2 deletions AiServer.ServiceInterface/AppData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ public MediaModel GetMediaModelByApiModel(MediaProvider provider, string apiMode
throw HttpError.NotFound($"{apiModel} is not a supported model for {provider.Name} ({provider.MediaType?.Id})");
}

public string? GetQualifiedMediaModel(MediaProvider provider, string apiModel)
public string? GetQualifiedMediaModel(ModelType modelType, string apiModel)
{
foreach (var mediaModel in MediaModels)
foreach (var mediaModel in MediaModels
.Where(x => x.ModelType == modelType))
{
foreach (var entry in mediaModel.ApiModels)
{
Expand Down
12 changes: 5 additions & 7 deletions AiServer.ServiceInterface/GenerationServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,15 @@ public async Task<object> Any(GetJobStatus request)

public object Any(ActiveMediaModels request)
{
var imageModels = appData.MediaModels
.Where(x => x.ModelType == ModelType.TextToImage)
.Select(x => x.Id);

var activeModels = appData.MediaProviders
.OrderByDescending(x => x.Priority)
.ThenBy(x => x.Id)
.ThenBy(x => x.Name)
.SelectMany(x =>
x.Models.Select(m => appData.GetQualifiedMediaModel(x, m)))
x.Models.Select(m => appData.GetQualifiedMediaModel(ModelType.TextToImage, m)))
.Where(x => x != null)
.Select(x => x!) // Non-null assertion after filtering out null values
.Distinct()
.OrderBy(x => x);
.Distinct();

return new StringsResponse
{
Expand Down
7 changes: 7 additions & 0 deletions AiServer.ServiceModel/Generations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ActiveMediaModels : IGet, IReturn<StringsResponse> {}
[Tag("AI")]
[Api("Convert speech to text")]
[Description("Transcribe audio content to text")]
[SystemJson(UseSystemJson.Response)]
public class SpeechToText : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The audio stream containing the speech to be transcribed")]
Expand All @@ -33,6 +34,7 @@ public class SpeechToText : IGeneration, IReturn<GenerationResponse>
[Tag("AI")]
[Api("Convert text to speech")]
[Description("Generate speech audio from text input")]
[SystemJson(UseSystemJson.Response)]
public class TextToSpeech : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The text to be converted to speech")]
Expand All @@ -58,6 +60,7 @@ public class TextToSpeech : IGeneration, IReturn<GenerationResponse>
[Tag("AI")]
[Api("Generate image from text description")]
[Description("Create an image based on a text prompt")]
[SystemJson(UseSystemJson.Response)]
public class TextToImage : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The main prompt describing the desired image")]
Expand Down Expand Up @@ -108,6 +111,7 @@ public class TextToImage : IGeneration, IReturn<GenerationResponse>
[Tag("AI")]
[Api("Generate image from another image")]
[Description("Create a new image based on an existing image and a text prompt")]
[SystemJson(UseSystemJson.Response)]
public class ImageToImage : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The image to use as input")]
Expand Down Expand Up @@ -155,6 +159,7 @@ public class ImageToImage : IGeneration, IReturn<GenerationResponse>
[Tag("AI")]
[Api("Upscale an image")]
[Description("Increase the resolution and quality of an input image")]
[SystemJson(UseSystemJson.Response)]
public class ImageUpscale : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The image to upscale")]
Expand All @@ -181,6 +186,7 @@ public class ImageUpscale : IGeneration, IReturn<GenerationResponse>
[Tag("AI")]
[Api("Generate image with masked area")]
[Description("Create a new image by applying a mask to an existing image and generating content for the masked area")]
[SystemJson(UseSystemJson.Response)]
public class ImageWithMask : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "Prompt describing the desired output in the masked area")]
Expand Down Expand Up @@ -229,6 +235,7 @@ public class ImageWithMask : IGeneration, IReturn<GenerationResponse>
[Tag("AI")]
[Api("Convert image to text")]
[Description("Extract text content from an image")]
[SystemJson(UseSystemJson.Response)]
public class ImageToText : IGeneration, IReturn<GenerationResponse>
{
[ApiMember(Description = "The image to convert to text")]
Expand Down
139 changes: 129 additions & 10 deletions AiServer/wwwroot/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,14 @@ select{
grid-column: span 6 / span 6;
}

.col-span-2 {
grid-column: span 2 / span 2;
}

.row-span-2 {
grid-row: span 2 / span 2;
}

.-m-2\.5 {
margin: -0.625rem;
}
Expand Down Expand Up @@ -1189,6 +1197,26 @@ select{
margin-top: auto;
}

.mb-32 {
margin-bottom: 8rem;
}

.mt-1\.5 {
margin-top: 0.375rem;
}

.mt-20 {
margin-top: 5rem;
}

.ml-8 {
margin-left: 2rem;
}

.mb-20 {
margin-bottom: 5rem;
}

.block {
display: block;
}
Expand Down Expand Up @@ -1381,6 +1409,10 @@ select{
width: 100vw;
}

.w-7 {
width: 1.75rem;
}

.min-w-0 {
min-width: 0px;
}
Expand Down Expand Up @@ -1980,6 +2012,11 @@ select{
border-color: rgb(250 204 21 / var(--tw-border-opacity));
}

.border-yellow-300 {
--tw-border-opacity: 1;
border-color: rgb(253 224 71 / var(--tw-border-opacity));
}

.bg-\[\#f4f4f4\] {
--tw-bg-opacity: 1;
background-color: rgb(244 244 244 / var(--tw-bg-opacity));
Expand Down Expand Up @@ -2166,16 +2203,35 @@ select{
background-image: linear-gradient(to top right, var(--tw-gradient-stops));
}

.bg-\[radial-gradient\(ellipse_at_center\2c _var\(--tw-gradient-stops\)\)\] {
background-image: radial-gradient(ellipse at center, var(--tw-gradient-stops));
}

.from-\[\#ff80b5\] {
--tw-gradient-from: #ff80b5 var(--tw-gradient-from-position);
--tw-gradient-to: rgb(255 128 181 / 0) var(--tw-gradient-to-position);
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.from-gray-700 {
--tw-gradient-from: #374151 var(--tw-gradient-from-position);
--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

.via-gray-900 {
--tw-gradient-to: rgb(17 24 39 / 0) var(--tw-gradient-to-position);
--tw-gradient-stops: var(--tw-gradient-from), #111827 var(--tw-gradient-via-position), var(--tw-gradient-to);
}

.to-\[\#9089fc\] {
--tw-gradient-to: #9089fc var(--tw-gradient-to-position);
}

.to-black {
--tw-gradient-to: #000 var(--tw-gradient-to-position);
}

.fill-gray-300 {
fill: #d1d5db;
}
Expand Down Expand Up @@ -2816,10 +2872,19 @@ select{
color: rgb(161 98 7 / var(--tw-text-opacity));
}

.text-zinc-100 {
--tw-text-opacity: 1;
color: rgb(244 244 245 / var(--tw-text-opacity));
}

.underline {
text-decoration-line: underline;
}

.underline-offset-4 {
text-underline-offset: 4px;
}

.placeholder-red-300::-moz-placeholder {
--tw-placeholder-opacity: 1;
color: rgb(252 165 165 / var(--tw-placeholder-opacity));
Expand Down Expand Up @@ -2966,6 +3031,11 @@ select{
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}

.drop-shadow {
--tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06));
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}

.\!invert {
--tw-invert: invert(100%) !important;
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow) !important;
Expand Down Expand Up @@ -3318,6 +3388,10 @@ select{
color: rgb(7 89 133 / var(--tw-text-opacity));
}

.hover\:underline:hover {
text-decoration-line: underline;
}

.hover\:opacity-70:hover {
opacity: 0.7;
}
Expand Down Expand Up @@ -3565,6 +3639,10 @@ select{
opacity: 1;
}

.group:hover .group-hover\:visible {
visibility: visible;
}

.group:hover .group-hover\:inline {
display: inline;
}
Expand All @@ -3583,6 +3661,10 @@ select{
opacity: 1;
}

.group:hover .group-hover\:opacity-40 {
opacity: 0.4;
}

.dark\:divide-gray-700:is(.dark *) > :not([hidden]) ~ :not([hidden]) {
--tw-divide-opacity: 1;
border-color: rgb(55 65 81 / var(--tw-divide-opacity));
Expand Down Expand Up @@ -4034,24 +4116,20 @@ select{
top: calc(100% - 30rem);
}

.sm\:col-span-3 {
grid-column: span 3 / span 3;
.sm\:col-span-1 {
grid-column: span 1 / span 1;
}

.sm\:col-span-2 {
grid-column: span 2 / span 2;
}

.sm\:col-span-4 {
grid-column: span 4 / span 4;
}

.sm\:col-span-1 {
grid-column: span 1 / span 1;
.sm\:col-span-3 {
grid-column: span 3 / span 3;
}

.sm\:col-span-5 {
grid-column: span 5 / span 5;
.sm\:col-span-4 {
grid-column: span 4 / span 4;
}

.sm\:-mx-6 {
Expand Down Expand Up @@ -4086,6 +4164,10 @@ select{
margin-top: 4rem;
}

.sm\:mb-1 {
margin-bottom: 0.25rem;
}

.sm\:block {
display: block;
}
Expand Down Expand Up @@ -4118,6 +4200,10 @@ select{
width: 100%;
}

.sm\:w-72 {
width: 18rem;
}

.sm\:max-w-3xl {
max-width: 48rem;
}
Expand All @@ -4130,6 +4216,10 @@ select{
max-width: 65ch;
}

.sm\:max-w-sm {
max-width: 24rem;
}

.sm\:translate-y-0 {
--tw-translate-y: 0px;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
Expand All @@ -4155,6 +4245,10 @@ select{
grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sm\:grid-cols-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sm\:flex-row-reverse {
flex-direction: row-reverse;
}
Expand Down Expand Up @@ -4194,6 +4288,10 @@ select{
border-top-right-radius: 0px;
}

.sm\:border-2 {
border-width: 2px;
}

.sm\:p-0 {
padding: 0px;
}
Expand All @@ -4212,6 +4310,11 @@ select{
padding-right: 1.5rem;
}

.sm\:px-2 {
padding-left: 0.5rem;
padding-right: 0.5rem;
}

.sm\:pb-0 {
padding-bottom: 0px;
}
Expand All @@ -4228,6 +4331,10 @@ select{
padding-right: 1.5rem;
}

.sm\:pb-2 {
padding-bottom: 0.5rem;
}

.sm\:text-left {
text-align: left;
}
Expand Down Expand Up @@ -4268,6 +4375,14 @@ select{
width: 18rem;
}

.md\:w-80 {
width: 20rem;
}

.md\:w-96 {
width: 24rem;
}

.md\:max-w-3xl {
max-width: 48rem;
}
Expand Down Expand Up @@ -4458,6 +4573,10 @@ select{
grid-template-columns: repeat(4, minmax(0, 1fr));
}

.xl\:grid-cols-5 {
grid-template-columns: repeat(5, minmax(0, 1fr));
}

.xl\:px-5 {
padding-left: 1.25rem;
padding-right: 1.25rem;
Expand Down
16 changes: 8 additions & 8 deletions AiServer/wwwroot/lib/mjs/servicestack-vue.min.mjs

Large diffs are not rendered by default.

Loading

0 comments on commit 96e815d

Please sign in to comment.