-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into auto_download
- Loading branch information
Showing
108 changed files
with
11,127 additions
and
64,283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
namespace LLama.Web.Common | ||
using System.ComponentModel; | ||
|
||
namespace LLama.Web.Common; | ||
|
||
public interface ISessionConfig | ||
{ | ||
public interface ISessionConfig | ||
{ | ||
string AntiPrompt { get; set; } | ||
List<string> AntiPrompts { get; set; } | ||
LLamaExecutorType ExecutorType { get; set; } | ||
string Model { get; set; } | ||
string OutputFilter { get; set; } | ||
List<string> OutputFilters { get; set; } | ||
string Prompt { get; set; } | ||
} | ||
string AntiPrompt { get; set; } | ||
|
||
[DisplayName("Anti Prompts")] | ||
List<string> AntiPrompts { get; set; } | ||
|
||
[DisplayName("Executor Type")] | ||
LLamaExecutorType ExecutorType { get; set; } | ||
|
||
string Model { get; set; } | ||
|
||
[DisplayName("Output Filter")] | ||
string OutputFilter { get; set; } | ||
|
||
List<string> OutputFilters { get; set; } | ||
|
||
string Prompt { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
namespace LLama.Web.Common | ||
{ | ||
public class LLamaOptions | ||
{ | ||
public ModelLoadType ModelLoadType { get; set; } | ||
public List<ModelOptions> Models { get; set; } | ||
namespace LLama.Web.Common; | ||
|
||
public void Initialize() | ||
{ | ||
} | ||
} | ||
public class LLamaOptions | ||
{ | ||
public ModelLoadType ModelLoadType { get; set; } | ||
public List<ModelOptions> Models { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
namespace LLama.Web.Common | ||
namespace LLama.Web.Common; | ||
|
||
public class SessionConfig : ISessionConfig | ||
{ | ||
public class SessionConfig : ISessionConfig | ||
{ | ||
public string Model { get; set; } | ||
public string Prompt { get; set; } | ||
public string Model { get; set; } | ||
public string Prompt { get; set; } | ||
|
||
public string AntiPrompt { get; set; } | ||
public List<string> AntiPrompts { get; set; } | ||
public string OutputFilter { get; set; } | ||
public List<string> OutputFilters { get; set; } | ||
public LLamaExecutorType ExecutorType { get; set; } | ||
} | ||
public string AntiPrompt { get; set; } | ||
public List<string> AntiPrompts { get; set; } | ||
public string OutputFilter { get; set; } | ||
public List<string> OutputFilters { get; set; } | ||
public LLamaExecutorType ExecutorType { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,52 @@ | ||
using LLama.Web.Common; | ||
using LLama.Web.Common; | ||
|
||
namespace LLama.Web | ||
namespace LLama.Web; | ||
|
||
public static class Extensions | ||
{ | ||
public static class Extensions | ||
/// <summary> | ||
/// Combines the AntiPrompts list and AntiPrompt csv | ||
/// </summary> | ||
/// <param name="sessionConfig">The session configuration.</param> | ||
/// <returns>Combined AntiPrompts with duplicates removed</returns> | ||
public static List<string> GetAntiPrompts(this ISessionConfig sessionConfig) | ||
{ | ||
/// <summary> | ||
/// Combines the AntiPrompts list and AntiPrompt csv | ||
/// </summary> | ||
/// <param name="sessionConfig">The session configuration.</param> | ||
/// <returns>Combined AntiPrompts with duplicates removed</returns> | ||
public static List<string> GetAntiPrompts(this ISessionConfig sessionConfig) | ||
{ | ||
return CombineCSV(sessionConfig.AntiPrompts, sessionConfig.AntiPrompt); | ||
} | ||
|
||
/// <summary> | ||
/// Combines the OutputFilters list and OutputFilter csv | ||
/// </summary> | ||
/// <param name="sessionConfig">The session configuration.</param> | ||
/// <returns>Combined OutputFilters with duplicates removed</returns> | ||
public static List<string> GetOutputFilters(this ISessionConfig sessionConfig) | ||
{ | ||
return CombineCSV(sessionConfig.OutputFilters, sessionConfig.OutputFilter); | ||
} | ||
return CombineCSV(sessionConfig.AntiPrompts, sessionConfig.AntiPrompt); | ||
} | ||
|
||
/// <summary> | ||
/// Combines the OutputFilters list and OutputFilter csv | ||
/// </summary> | ||
/// <param name="sessionConfig">The session configuration.</param> | ||
/// <returns>Combined OutputFilters with duplicates removed</returns> | ||
public static List<string> GetOutputFilters(this ISessionConfig sessionConfig) | ||
{ | ||
return CombineCSV(sessionConfig.OutputFilters, sessionConfig.OutputFilter); | ||
} | ||
|
||
/// <summary> | ||
/// Combines a string list and a csv and removes duplicates | ||
/// </summary> | ||
/// <param name="list">The list.</param> | ||
/// <param name="csv">The CSV.</param> | ||
/// <returns>Combined list with duplicates removed</returns> | ||
private static List<string> CombineCSV(List<string> list, string csv) | ||
{ | ||
var results = list is null || list.Count == 0 | ||
? CommaSeparatedToList(csv) | ||
: CommaSeparatedToList(csv).Concat(list); | ||
return results | ||
.Distinct() | ||
.ToList(); | ||
} | ||
/// <summary> | ||
/// Combines a string list and a csv and removes duplicates | ||
/// </summary> | ||
/// <param name="list">The list.</param> | ||
/// <param name="csv">The CSV.</param> | ||
/// <returns>Combined list with duplicates removed</returns> | ||
private static List<string> CombineCSV(List<string> list, string csv) | ||
{ | ||
var results = list is null || list.Count == 0 | ||
? CommaSeparatedToList(csv) | ||
: CommaSeparatedToList(csv).Concat(list); | ||
return results | ||
.Distinct() | ||
.ToList(); | ||
} | ||
|
||
private static List<string> CommaSeparatedToList(string value) | ||
{ | ||
if (string.IsNullOrEmpty(value)) | ||
return new List<string>(); | ||
private static List<string> CommaSeparatedToList(string value) | ||
{ | ||
if (string.IsNullOrEmpty(value)) | ||
return new List<string>(); | ||
|
||
return value.Split(",", StringSplitOptions.RemoveEmptyEntries) | ||
.Select(x => x.Trim()) | ||
.ToList(); | ||
} | ||
return value.Split(",", StringSplitOptions.RemoveEmptyEntries) | ||
.Select(x => x.Trim()) | ||
.ToList(); | ||
} | ||
} |
Oops, something went wrong.