mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-16 11:13:48 +00:00
added possibility to add tokenizer via plugin and refactored earlier changes
This commit is contained in:
1 parent
95fb213069
commit
aa554d4a53
15 files changed
+306
-41
No files matched your search
@@ -0,0 +1,20 @@
|
||||
namespace AIStudio.Tools.Services;
|
||||
|
||||
public static class TokenizerModelId
|
||||
{
|
||||
public static string ForProvider(Settings.Provider provider) => ForProviderId(provider.Id);
|
||||
|
||||
public static string ForProviderId(string guid) => "chat_" + NormalizeGuid(guid);
|
||||
|
||||
public static string ForEmbeddingProvider(Settings.EmbeddingProvider provider) => ForEmbeddingProviderId(provider.Id);
|
||||
|
||||
public static string ForEmbeddingProviderId(string guid) => "embedding_" + NormalizeGuid(guid);
|
||||
|
||||
private static string NormalizeGuid(string guid)
|
||||
{
|
||||
if (Guid.TryParse(guid, out var parsedGuid))
|
||||
return parsedGuid.ToString("D");
|
||||
|
||||
return guid.Trim();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user