mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-05-14 01:44:09 +00:00
21 lines
678 B
C#
21 lines
678 B
C#
|
|
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();
|
||
|
|
}
|
||
|
|
}
|