diff --git a/Chats.sln b/Chats.sln index 8fffdd2d..d940d086 100644 --- a/Chats.sln +++ b/Chats.sln @@ -14,22 +14,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chats.BE", "src\BE\Chats.BE EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chats.BE.Tests", "src\BE.Tests\Chats.BE.Tests.csproj", "{B785B397-23AB-4782-807B-C5D5001C1ECC}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{04AEF080-BF5C-4CD7-BB7E-3D509A0FD3F6}" - ProjectSection(SolutionItems) = preProject - src\scripts\20240902-db-migration.linq = src\scripts\20240902-db-migration.linq - src\scripts\20241101-model-reference-sql.linq = src\scripts\20241101-model-reference-sql.linq - src\scripts\20241112-db-migration.linq = src\scripts\20241112-db-migration.linq - src\scripts\20241115-db-migration.sql = src\scripts\20241115-db-migration.sql - src\scripts\20241121-int-migration.sql = src\scripts\20241121-int-migration.sql - src\scripts\20241127-ref.sql = src\scripts\20241127-ref.sql - src\scripts\20241129-file.sql = src\scripts\20241129-file.sql - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github-actions", "github-actions", "{29CC0F58-0B4E-4F4F-A084-7C461F7A4E60}" ProjectSection(SolutionItems) = preProject .github\workflows\build-container.yml = .github\workflows\build-container.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "scripts", "src\scripts\scripts.csproj", "{1AE54C98-13A3-408B-B428-1FD975C02AF2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -44,12 +35,15 @@ Global {B785B397-23AB-4782-807B-C5D5001C1ECC}.Debug|Any CPU.Build.0 = Debug|Any CPU {B785B397-23AB-4782-807B-C5D5001C1ECC}.Release|Any CPU.ActiveCfg = Release|Any CPU {B785B397-23AB-4782-807B-C5D5001C1ECC}.Release|Any CPU.Build.0 = Release|Any CPU + {1AE54C98-13A3-408B-B428-1FD975C02AF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1AE54C98-13A3-408B-B428-1FD975C02AF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1AE54C98-13A3-408B-B428-1FD975C02AF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1AE54C98-13A3-408B-B428-1FD975C02AF2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {04AEF080-BF5C-4CD7-BB7E-3D509A0FD3F6} = {6C78A2EB-D01E-4634-BBA7-85F12BF86232} {29CC0F58-0B4E-4F4F-A084-7C461F7A4E60} = {6C78A2EB-D01E-4634-BBA7-85F12BF86232} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/BE/Chats.BE.csproj b/src/BE/Chats.BE.csproj index 22774063..97cb4b4f 100644 --- a/src/BE/Chats.BE.csproj +++ b/src/BE/Chats.BE.csproj @@ -9,7 +9,7 @@ - + @@ -26,12 +26,12 @@ - + - - + + diff --git a/src/BE/Controllers/Chats/Chats/ChatController.cs b/src/BE/Controllers/Chats/Chats/ChatController.cs index d9734cfe..e643ff10 100644 --- a/src/BE/Controllers/Chats/Chats/ChatController.cs +++ b/src/BE/Controllers/Chats/Chats/ChatController.cs @@ -6,6 +6,7 @@ using Chats.BE.Services; using Chats.BE.Services.ChatServices; using Chats.BE.Services.ChatServices.Dtos; +using Chats.BE.Services.ChatServices.Extensions; using Chats.BE.Services.FileServices; using Chats.BE.Services.UrlEncryption; using Microsoft.AspNetCore.Authorization; @@ -155,12 +156,8 @@ ..await GetMessageTree(existingMessages, messageId).ToAsyncEnumerable().SelectAw throw new InvalidModelException(request.ModelId.ToString()); } + ChatCompletionOptions cco = request.UserModelConfig.ToChatCompletionOptions(currentUser.Id); using ChatService s = conversationFactory.CreateConversationService(userModel.Model); - ChatCompletionOptions cco = new() - { - Temperature = request.UserModelConfig.Temperature, - EndUserId = currentUser.Id.ToString(), - }; await foreach (InternalChatSegment seg in icc.Run(userBalance.Balance, userModel, s.ChatStreamedFEProcessed(messageToSend, cco, cancellationToken))) { if (seg.TextSegment == string.Empty) continue; diff --git a/src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs b/src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs index fed215eb..2f17c432 100644 --- a/src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs +++ b/src/BE/Controllers/Chats/UserChats/Dtos/ChatsResponse.cs @@ -1,7 +1,6 @@ using Chats.BE.DB; using Chats.BE.DB.Enums; using Chats.BE.DB.Jsons; -using Chats.BE.Services.ChatServices; using Chats.BE.Services.UrlEncryption; using System.Text.Json.Serialization; @@ -21,9 +20,6 @@ public record ChatsResponse [JsonPropertyName("modelName")] public required string ModelName { get; init; } - [JsonPropertyName("modelConfig")] - public required JsonModelConfig ModelConfig { get; init; } - [JsonPropertyName("userModelConfig")] public required JsonUserModelConfig UserModelConfig { get; init; } @@ -41,16 +37,11 @@ public static ChatsResponse FromDB(Chat chat, IUrlEncryptionService idEncryption Title = chat.Title, ModelId = chat.ModelId, ModelName = chat.Model.Name, - ModelConfig = new JsonModelConfig - { - DeploymentName = chat.Model.DeploymentName, - EnableSearch = chat.Model.ModelReference.AllowSearch, - MaxLength = chat.Model.ModelReference.MaxResponseTokens, - Temperature = ChatService.DefaultTemperature, - Version = chat.Model.ModelKey.ModelProvider.Name, - Prompt = ChatService.DefaultPrompt, + UserModelConfig = new JsonUserModelConfig + { + EnableSearch = chat.EnableSearch, + Temperature = chat.Temperature, }, - UserModelConfig = new JsonUserModelConfig { EnableSearch = chat.EnableSearch, Temperature = chat.Temperature }, IsShared = chat.IsShared, ModelProviderId = (DBModelProvider)chat.Model.ModelKey.ModelProviderId, }; @@ -85,11 +76,6 @@ public ChatsResponse ToResponse(IUrlEncryptionService idEncryption) Title = Title, ModelId = ChatModelId, ModelName = ModelName, - ModelConfig = new JsonModelConfig - { - Prompt = ChatService.DefaultPrompt, - Temperature = Temperature ?? ChatService.DefaultTemperature, - }, UserModelConfig = UserModelConfig, IsShared = IsShared, ModelProviderId = ModelProvider, diff --git a/src/BE/Controllers/Chats/UserChats/UserChatsController.cs b/src/BE/Controllers/Chats/UserChats/UserChatsController.cs index fef28546..a359c35f 100644 --- a/src/BE/Controllers/Chats/UserChats/UserChatsController.cs +++ b/src/BE/Controllers/Chats/UserChats/UserChatsController.cs @@ -76,6 +76,12 @@ public async Task>> GetChats([FromQuery] { EnableSearch = x.EnableSearch, Temperature = x.Temperature, + Prompt = x.Messages + .FirstOrDefault(x => x.ChatRoleId == (byte)DBChatRole.System) + !.MessageContents + .FirstOrDefault() + !.MessageContentText + !.Content }, }), request, diff --git a/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelProviderDto.cs b/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelProviderDto.cs deleted file mode 100644 index 0fe01ebc..00000000 --- a/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelProviderDto.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Chats.BE.DB.Jsons; -using System.Text.Json.Serialization; - -namespace Chats.BE.Controllers.Public.ModelInfo.DTOs; - -[Obsolete("for old frontend compatibility")] -public record LegacyModelProviderDto -{ - [JsonPropertyName("name")] - public required string Name{ get; init; } - - [JsonPropertyName("models")] - public required string[] Models { get; init; } - - [JsonPropertyName("apiConfig")] - public required JsonModelKey ApiConfig { get; init; } - - [JsonPropertyName("displayName")] - public required string DisplayName { get; init; } - - [JsonPropertyName("icon")] - public required string Icon { get; init; } -} diff --git a/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelReferenceDto.cs b/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelReferenceDto.cs deleted file mode 100644 index b4d9b6dd..00000000 --- a/src/BE/Controllers/Public/ModelInfo/DTOs/LegacyModelReferenceDto.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Chats.BE.Controllers.Chats.Models.Dtos; -using Chats.BE.DB.Jsons; -using System.Text.Json.Serialization; - -namespace Chats.BE.Controllers.Public.ModelInfo.DTOs; - -[Obsolete("for old frontend compatibility")] -public record LegacyModelReferenceDto -{ - #region new fields - [JsonPropertyName("id")] - public required short Id { get; init; } - #endregion - - [JsonPropertyName("type")] - public required string ProviderName { get; init; } - - [JsonPropertyName("config")] - public required TemperatureOptions Config { get; init; } - - [JsonPropertyName("modelConfig")] - public required JsonModelConfig ModelConfig { get; init; } - - [JsonPropertyName("fileConfig")] - public required JsonFileConfig? FileConfig { get; init; } - - [JsonPropertyName("priceConfig")] - public required JsonPriceConfig PriceConfig { get; init; } -} diff --git a/src/BE/DB/Enums/DBModelProvider.cs b/src/BE/DB/Enums/DBModelProvider.cs index c5f47d14..2c2f90bc 100644 --- a/src/BE/DB/Enums/DBModelProvider.cs +++ b/src/BE/DB/Enums/DBModelProvider.cs @@ -13,4 +13,6 @@ public enum DBModelProvider Sparkdesk = 8, ZhiPuAI = 9, DeepSeek = 10, + xAI = 11, + GithubModels = 12, } diff --git a/src/BE/DB/Init/BasicData.cs b/src/BE/DB/Init/BasicData.cs index 4e9fb5fe..a93ec198 100644 --- a/src/BE/DB/Init/BasicData.cs +++ b/src/BE/DB/Init/BasicData.cs @@ -107,140 +107,162 @@ private static void InsertTransactionTypes(ChatsDB db) private static void InsertModelReferences(ChatsDB db) { - // Generated from data, hash: ebf7fc3a8c4f38d7efc44b0e1b38633c2af4fea6ec8a42ad73d72299dfdbf6d4 + // Generated from data, hash: 50473f0ad8469aee50b0d5d7ed3f13df8fe5cfd80a3c1f1a7aea825865492349 db.ModelReferences.AddRange( [ - new(){ Id=0, ProviderId=0, Name="Test", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=2048, TokenizerId=1, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=100, ProviderId=1, Name="gpt-35-turbo-0301", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=101, ProviderId=1, Name="gpt-35-turbo-16k-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, - new(){ Id=102, ProviderId=1, Name="gpt-35-turbo-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=103, ProviderId=1, Name="gpt-35-turbo-1106", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=104, ProviderId=1, Name="gpt-35-turbo-instruct", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=105, ProviderId=1, Name="gpt-35-turbo-0125", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.50000M, CurrencyCode="USD", }, - new(){ Id=106, ProviderId=1, Name="gpt-4-vision-preview", ShortName="gpt-4-vision", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=107, ProviderId=1, Name="gpt-4-1106-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=108, ProviderId=1, Name="gpt-4-0125-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=109, ProviderId=1, Name="gpt-4-32k", ShortName="gpt-4-32k", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=1, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="USD", }, - new(){ Id=110, ProviderId=1, Name="gpt-4", ShortName="gpt-4", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=1, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, - new(){ Id=111, ProviderId=1, Name="gpt-4-turbo-2024-04-09", ShortName="gpt-4-turbo", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=112, ProviderId=1, Name="o1-preview-2024-09-12", ShortName="o1-preview", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=32768, TokenizerId=2, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, - new(){ Id=113, ProviderId=1, Name="o1-mini-2024-09-12", ShortName="o1-mini", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=65536, TokenizerId=2, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="USD", }, - new(){ Id=114, ProviderId=1, Name="gpt-4o-mini-2024-07-18", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=0.15000M, OutputTokenPrice1M=0.60000M, CurrencyCode="USD", }, - new(){ Id=115, ProviderId=1, Name="gpt-4o-2024-05-13", ShortName="gpt-4o", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, - new(){ Id=116, ProviderId=1, Name="gpt-4o-2024-08-06", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, - new(){ Id=117, ProviderId=1, Name="gpt-4o-2024-11-20", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, - new(){ Id=200, ProviderId=2, Name="hunyuan-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, - new(){ Id=201, ProviderId=2, Name="hunyuan-pro", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=100.00000M, CurrencyCode="RMB", }, - new(){ Id=202, ProviderId=2, Name="hunyuan-standard-256K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=262144, MaxResponseTokens=6144, TokenizerId=null, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, - new(){ Id=203, ProviderId=2, Name="hunyuan-standard", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.50000M, OutputTokenPrice1M=5.00000M, CurrencyCode="RMB", }, - new(){ Id=204, ProviderId=2, Name="hunyuan-lite", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=262144, MaxResponseTokens=6144, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=205, ProviderId=2, Name="hunyuan-role", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=206, ProviderId=2, Name="hunyuan-functioncall ", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=207, ProviderId=2, Name="hunyuan-code", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=208, ProviderId=2, Name="hunyuan-vision", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=18.00000M, OutputTokenPrice1M=18.00000M, CurrencyCode="RMB", }, - new(){ Id=300, ProviderId=3, Name="yi-lightning", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=0.99000M, OutputTokenPrice1M=0.99000M, CurrencyCode="RMB", }, - new(){ Id=301, ProviderId=3, Name="yi-large", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, - new(){ Id=302, ProviderId=3, Name="yi-medium", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=2.50000M, CurrencyCode="RMB", }, - new(){ Id=303, ProviderId=3, Name="yi-vision", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=6.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, - new(){ Id=304, ProviderId=3, Name="yi-medium-200k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=204800, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=305, ProviderId=3, Name="yi-spark", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, - new(){ Id=306, ProviderId=3, Name="yi-large-rag", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=25.00000M, OutputTokenPrice1M=25.00000M, CurrencyCode="RMB", }, - new(){ Id=307, ProviderId=3, Name="yi-large-fc", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, - new(){ Id=308, ProviderId=3, Name="yi-large-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=400, ProviderId=4, Name="moonshot-v1-8k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=401, ProviderId=4, Name="moonshot-v1-32k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=null, InputTokenPrice1M=24.00000M, OutputTokenPrice1M=24.00000M, CurrencyCode="RMB", }, - new(){ Id=402, ProviderId=4, Name="moonshot-v1-128k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=131072, TokenizerId=null, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, - new(){ Id=500, ProviderId=5, Name="gpt-3.5-turbo-0301", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=501, ProviderId=5, Name="gpt-3.5-turbo-16k-0613", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, - new(){ Id=502, ProviderId=5, Name="gpt-3.5-turbo-0613", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=503, ProviderId=5, Name="gpt-3.5-turbo-1106", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=504, ProviderId=5, Name="gpt-3.5-turbo-instruct", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, - new(){ Id=505, ProviderId=5, Name="gpt-3.5-turbo-0125", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.50000M, CurrencyCode="USD", }, - new(){ Id=506, ProviderId=5, Name="gpt-4-vision-preview", ShortName="gpt-4-vision", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=507, ProviderId=5, Name="gpt-4-1106-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=508, ProviderId=5, Name="gpt-4-0125-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=509, ProviderId=5, Name="gpt-4-32k", ShortName="gpt-4-32k", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=1, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="USD", }, - new(){ Id=510, ProviderId=5, Name="gpt-4", ShortName="gpt-4", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=1, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, - new(){ Id=511, ProviderId=5, Name="gpt-4-turbo-2024-04-09", ShortName="gpt-4-turbo", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, - new(){ Id=512, ProviderId=5, Name="o1-preview-2024-09-12", ShortName="o1-preview", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=32768, TokenizerId=2, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, - new(){ Id=513, ProviderId=5, Name="o1-mini-2024-09-12", ShortName="o1-mini", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=65536, TokenizerId=2, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="USD", }, - new(){ Id=514, ProviderId=5, Name="gpt-4o-mini-2024-07-18", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=0.15000M, OutputTokenPrice1M=0.60000M, CurrencyCode="USD", }, - new(){ Id=515, ProviderId=5, Name="gpt-4o-2024-05-13", ShortName="gpt-4o", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, - new(){ Id=516, ProviderId=5, Name="gpt-4o-2024-08-06", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, - new(){ Id=517, ProviderId=5, Name="gpt-4o-2024-11-20", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, - new(){ Id=600, ProviderId=6, Name="ERNIE-4.0-Turbo-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=90.00000M, CurrencyCode="RMB", }, - new(){ Id=601, ProviderId=6, Name="ERNIE-4.0-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, - new(){ Id=602, ProviderId=6, Name="ERNIE-3.5-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=603, ProviderId=6, Name="ERNIE-3.5-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=604, ProviderId=6, Name="ERNIE-Speed-Pro-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.30000M, OutputTokenPrice1M=0.60000M, CurrencyCode="RMB", }, - new(){ Id=605, ProviderId=6, Name="ERNIE-Novel-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=40.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="RMB", }, - new(){ Id=606, ProviderId=6, Name="ERNIE-Speed-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=607, ProviderId=6, Name="ERNIE-Speed-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=608, ProviderId=6, Name="ERNIE-Lite-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=609, ProviderId=6, Name="ERNIE-Lite-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=610, ProviderId=6, Name="ERNIE-Tiny-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=611, ProviderId=6, Name="ERNIE-Tiny-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=612, ProviderId=6, Name="ERNIE-Character-Fiction-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=613, ProviderId=6, Name="ERNIE-Functions-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=614, ProviderId=6, Name="ERNIE-Lite-Pro-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.20000M, OutputTokenPrice1M=0.40000M, CurrencyCode="RMB", }, - new(){ Id=700, ProviderId=7, Name="qwen-max", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, - new(){ Id=701, ProviderId=7, Name="qwen-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=702, ProviderId=7, Name="qwen-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.30000M, OutputTokenPrice1M=0.60000M, CurrencyCode="RMB", }, - new(){ Id=703, ProviderId=7, Name="qwen-long", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=10000000, MaxResponseTokens=6000, TokenizerId=null, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=704, ProviderId=7, Name="qwen-vl-max", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, - new(){ Id=705, ProviderId=7, Name="qwen-vl-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=706, ProviderId=7, Name="qwen-math-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=707, ProviderId=7, Name="qwen-math-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, - new(){ Id=708, ProviderId=7, Name="qwen-coder-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, - new(){ Id=709, ProviderId=7, Name="qwen2.5-72b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=710, ProviderId=7, Name="qwen2.5-32b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=3.50000M, OutputTokenPrice1M=7.00000M, CurrencyCode="RMB", }, - new(){ Id=711, ProviderId=7, Name="qwen2.5-14b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, - new(){ Id=712, ProviderId=7, Name="qwen2.5-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=713, ProviderId=7, Name="qwen2.5-3b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=714, ProviderId=7, Name="qwen2.5-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=715, ProviderId=7, Name="qwen2.5-0.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=716, ProviderId=7, Name="qwen2-vl-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=717, ProviderId=7, Name="qwen2-vl-2b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, - new(){ Id=718, ProviderId=7, Name="qwen2.5-math-72b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, - new(){ Id=719, ProviderId=7, Name="qwen2.5-math-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=720, ProviderId=7, Name="qwen2.5-math-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=721, ProviderId=7, Name="qwen2.5-coder-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, - new(){ Id=722, ProviderId=7, Name="qwen2.5-coder-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=800, ProviderId=8, Name="lite", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=801, ProviderId=8, Name="generalv3", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=7.00000M, OutputTokenPrice1M=7.00000M, CurrencyCode="RMB", }, - new(){ Id=802, ProviderId=8, Name="pro-128k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=13.00000M, OutputTokenPrice1M=13.00000M, CurrencyCode="RMB", }, - new(){ Id=803, ProviderId=8, Name="generalv3.5", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="RMB", }, - new(){ Id=804, ProviderId=8, Name="max-32k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=32.00000M, OutputTokenPrice1M=32.00000M, CurrencyCode="RMB", }, - new(){ Id=805, ProviderId=8, Name="4.0Ultra", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=70.00000M, OutputTokenPrice1M=70.00000M, CurrencyCode="RMB", }, - new(){ Id=900, ProviderId=9, Name="glm-4-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=50.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, - new(){ Id=901, ProviderId=9, Name="glm-4-0520", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=100.00000M, OutputTokenPrice1M=100.00000M, CurrencyCode="RMB", }, - new(){ Id=902, ProviderId=9, Name="glm-4-air", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, - new(){ Id=903, ProviderId=9, Name="glm-4-airx", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=10.00000M, CurrencyCode="RMB", }, - new(){ Id=904, ProviderId=9, Name="glm-4-long", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=1048576, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, - new(){ Id=905, ProviderId=9, Name="glm-4-flashx", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.10000M, OutputTokenPrice1M=0.10000M, CurrencyCode="RMB", }, - new(){ Id=906, ProviderId=9, Name="glm-4-flash", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, - new(){ Id=907, ProviderId=9, Name="glm-4v-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=10.00000M, CurrencyCode="RMB", }, - new(){ Id=908, ProviderId=9, Name="glm-4v", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=50.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, - new(){ Id=1000, ProviderId=10, Name="deepseek-chat", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=64000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", } + new(){ Id=0, ProviderId=0, Name="Test", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=2048, TokenizerId=1, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=100, ProviderId=1, Name="gpt-35-turbo-0301", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=101, ProviderId=1, Name="gpt-35-turbo-16k-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, + new(){ Id=102, ProviderId=1, Name="gpt-35-turbo-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=103, ProviderId=1, Name="gpt-35-turbo-1106", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=104, ProviderId=1, Name="gpt-35-turbo-instruct", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=105, ProviderId=1, Name="gpt-35-turbo-0125", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.50000M, CurrencyCode="USD", }, + new(){ Id=106, ProviderId=1, Name="gpt-4-vision-preview", ShortName="gpt-4-vision", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=107, ProviderId=1, Name="gpt-4-1106-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=108, ProviderId=1, Name="gpt-4-0125-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=109, ProviderId=1, Name="gpt-4-32k", ShortName="gpt-4-32k", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=1, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="USD", }, + new(){ Id=110, ProviderId=1, Name="gpt-4", ShortName="gpt-4", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=1, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, + new(){ Id=111, ProviderId=1, Name="gpt-4-turbo-2024-04-09", ShortName="gpt-4-turbo", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=112, ProviderId=1, Name="o1-preview-2024-09-12", ShortName="o1-preview", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=32768, TokenizerId=2, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, + new(){ Id=113, ProviderId=1, Name="o1-mini-2024-09-12", ShortName="o1-mini", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=65536, TokenizerId=2, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="USD", }, + new(){ Id=114, ProviderId=1, Name="gpt-4o-mini-2024-07-18", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=0.15000M, OutputTokenPrice1M=0.60000M, CurrencyCode="USD", }, + new(){ Id=115, ProviderId=1, Name="gpt-4o-2024-05-13", ShortName="gpt-4o", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=116, ProviderId=1, Name="gpt-4o-2024-08-06", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, + new(){ Id=117, ProviderId=1, Name="gpt-4o-2024-11-20", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, + new(){ Id=200, ProviderId=2, Name="hunyuan-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, + new(){ Id=201, ProviderId=2, Name="hunyuan-pro", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=100.00000M, CurrencyCode="RMB", }, + new(){ Id=202, ProviderId=2, Name="hunyuan-standard-256K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=262144, MaxResponseTokens=6144, TokenizerId=null, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, + new(){ Id=203, ProviderId=2, Name="hunyuan-standard", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.50000M, OutputTokenPrice1M=5.00000M, CurrencyCode="RMB", }, + new(){ Id=204, ProviderId=2, Name="hunyuan-lite", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=262144, MaxResponseTokens=6144, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=205, ProviderId=2, Name="hunyuan-role", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=206, ProviderId=2, Name="hunyuan-functioncall ", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=207, ProviderId=2, Name="hunyuan-code", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=208, ProviderId=2, Name="hunyuan-vision", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=18.00000M, OutputTokenPrice1M=18.00000M, CurrencyCode="RMB", }, + new(){ Id=300, ProviderId=3, Name="yi-lightning", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=0.99000M, OutputTokenPrice1M=0.99000M, CurrencyCode="RMB", }, + new(){ Id=301, ProviderId=3, Name="yi-large", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, + new(){ Id=302, ProviderId=3, Name="yi-medium", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=2.50000M, CurrencyCode="RMB", }, + new(){ Id=303, ProviderId=3, Name="yi-vision", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=6.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, + new(){ Id=304, ProviderId=3, Name="yi-medium-200k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=204800, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=305, ProviderId=3, Name="yi-spark", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, + new(){ Id=306, ProviderId=3, Name="yi-large-rag", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=25.00000M, OutputTokenPrice1M=25.00000M, CurrencyCode="RMB", }, + new(){ Id=307, ProviderId=3, Name="yi-large-fc", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, + new(){ Id=308, ProviderId=3, Name="yi-large-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16384, MaxResponseTokens=16384, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=400, ProviderId=4, Name="moonshot-v1-8k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=12.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=401, ProviderId=4, Name="moonshot-v1-32k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=null, InputTokenPrice1M=24.00000M, OutputTokenPrice1M=24.00000M, CurrencyCode="RMB", }, + new(){ Id=402, ProviderId=4, Name="moonshot-v1-128k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=131072, TokenizerId=null, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, + new(){ Id=500, ProviderId=5, Name="gpt-3.5-turbo-0301", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=501, ProviderId=5, Name="gpt-3.5-turbo-16k-0613", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, + new(){ Id=502, ProviderId=5, Name="gpt-3.5-turbo-0613", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=503, ProviderId=5, Name="gpt-3.5-turbo-1106", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=504, ProviderId=5, Name="gpt-3.5-turbo-instruct", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=505, ProviderId=5, Name="gpt-3.5-turbo-0125", ShortName="gpt-3.5-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.50000M, CurrencyCode="USD", }, + new(){ Id=506, ProviderId=5, Name="gpt-4-vision-preview", ShortName="gpt-4-vision", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=507, ProviderId=5, Name="gpt-4-1106-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=508, ProviderId=5, Name="gpt-4-0125-preview", ShortName="gpt-4-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=509, ProviderId=5, Name="gpt-4-32k", ShortName="gpt-4-32k", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=32768, TokenizerId=1, InputTokenPrice1M=60.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="USD", }, + new(){ Id=510, ProviderId=5, Name="gpt-4", ShortName="gpt-4", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=1, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, + new(){ Id=511, ProviderId=5, Name="gpt-4-turbo-2024-04-09", ShortName="gpt-4-turbo", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="USD", }, + new(){ Id=512, ProviderId=5, Name="o1-preview-2024-09-12", ShortName="o1-preview", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=32768, TokenizerId=2, InputTokenPrice1M=15.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="USD", }, + new(){ Id=513, ProviderId=5, Name="o1-mini-2024-09-12", ShortName="o1-mini", IsLegacy=false, MinTemperature=1.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=false, AllowStreaming=false, ContextWindow=128000, MaxResponseTokens=65536, TokenizerId=2, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="USD", }, + new(){ Id=514, ProviderId=5, Name="gpt-4o-mini-2024-07-18", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=0.15000M, OutputTokenPrice1M=0.60000M, CurrencyCode="USD", }, + new(){ Id=515, ProviderId=5, Name="gpt-4o-2024-05-13", ShortName="gpt-4o", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=516, ProviderId=5, Name="gpt-4o-2024-08-06", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, + new(){ Id=517, ProviderId=5, Name="gpt-4o-2024-11-20", ShortName="gpt-4o", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=16384, TokenizerId=2, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=10.00000M, CurrencyCode="USD", }, + new(){ Id=600, ProviderId=6, Name="ERNIE-4.0-Turbo-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=90.00000M, CurrencyCode="RMB", }, + new(){ Id=601, ProviderId=6, Name="ERNIE-4.0-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, + new(){ Id=602, ProviderId=6, Name="ERNIE-3.5-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=603, ProviderId=6, Name="ERNIE-3.5-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=604, ProviderId=6, Name="ERNIE-Speed-Pro-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.30000M, OutputTokenPrice1M=0.60000M, CurrencyCode="RMB", }, + new(){ Id=605, ProviderId=6, Name="ERNIE-Novel-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=40.00000M, OutputTokenPrice1M=120.00000M, CurrencyCode="RMB", }, + new(){ Id=606, ProviderId=6, Name="ERNIE-Speed-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=607, ProviderId=6, Name="ERNIE-Speed-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=608, ProviderId=6, Name="ERNIE-Lite-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=609, ProviderId=6, Name="ERNIE-Lite-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=610, ProviderId=6, Name="ERNIE-Tiny-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=611, ProviderId=6, Name="ERNIE-Tiny-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=612, ProviderId=6, Name="ERNIE-Character-Fiction-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=613, ProviderId=6, Name="ERNIE-Functions-8K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=2048, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=614, ProviderId=6, Name="ERNIE-Lite-Pro-128K", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.20000M, OutputTokenPrice1M=0.40000M, CurrencyCode="RMB", }, + new(){ Id=700, ProviderId=7, Name="qwen-max", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=60.00000M, CurrencyCode="RMB", }, + new(){ Id=701, ProviderId=7, Name="qwen-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.80000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=702, ProviderId=7, Name="qwen-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.30000M, OutputTokenPrice1M=0.60000M, CurrencyCode="RMB", }, + new(){ Id=703, ProviderId=7, Name="qwen-long", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=10000000, MaxResponseTokens=6000, TokenizerId=null, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=704, ProviderId=7, Name="qwen-vl-max", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=20.00000M, OutputTokenPrice1M=20.00000M, CurrencyCode="RMB", }, + new(){ Id=705, ProviderId=7, Name="qwen-vl-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=706, ProviderId=7, Name="qwen-math-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=707, ProviderId=7, Name="qwen-math-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, + new(){ Id=708, ProviderId=7, Name="qwen-coder-turbo", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, + new(){ Id=709, ProviderId=7, Name="qwen2.5-72b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=710, ProviderId=7, Name="qwen2.5-32b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=3.50000M, OutputTokenPrice1M=7.00000M, CurrencyCode="RMB", }, + new(){ Id=711, ProviderId=7, Name="qwen2.5-14b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=2.00000M, OutputTokenPrice1M=6.00000M, CurrencyCode="RMB", }, + new(){ Id=712, ProviderId=7, Name="qwen2.5-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=713, ProviderId=7, Name="qwen2.5-3b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=714, ProviderId=7, Name="qwen2.5-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=715, ProviderId=7, Name="qwen2.5-0.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=716, ProviderId=7, Name="qwen2-vl-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=717, ProviderId=7, Name="qwen2-vl-2b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32000, MaxResponseTokens=2000, TokenizerId=null, InputTokenPrice1M=8.00000M, OutputTokenPrice1M=8.00000M, CurrencyCode="RMB", }, + new(){ Id=718, ProviderId=7, Name="qwen2.5-math-72b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=4.00000M, OutputTokenPrice1M=12.00000M, CurrencyCode="RMB", }, + new(){ Id=719, ProviderId=7, Name="qwen2.5-math-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=720, ProviderId=7, Name="qwen2.5-math-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=3072, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=721, ProviderId=7, Name="qwen2.5-coder-7b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=722, ProviderId=7, Name="qwen2.5-coder-1.5b-instruct", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.99M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=800, ProviderId=8, Name="lite", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=801, ProviderId=8, Name="generalv3", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=7.00000M, OutputTokenPrice1M=7.00000M, CurrencyCode="RMB", }, + new(){ Id=802, ProviderId=8, Name="pro-128k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=13.00000M, OutputTokenPrice1M=13.00000M, CurrencyCode="RMB", }, + new(){ Id=803, ProviderId=8, Name="generalv3.5", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=30.00000M, OutputTokenPrice1M=30.00000M, CurrencyCode="RMB", }, + new(){ Id=804, ProviderId=8, Name="max-32k", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=32768, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=32.00000M, OutputTokenPrice1M=32.00000M, CurrencyCode="RMB", }, + new(){ Id=805, ProviderId=8, Name="4.0Ultra", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=8192, TokenizerId=null, InputTokenPrice1M=70.00000M, OutputTokenPrice1M=70.00000M, CurrencyCode="RMB", }, + new(){ Id=900, ProviderId=9, Name="glm-4-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=50.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, + new(){ Id=901, ProviderId=9, Name="glm-4-0520", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=100.00000M, OutputTokenPrice1M=100.00000M, CurrencyCode="RMB", }, + new(){ Id=902, ProviderId=9, Name="glm-4-air", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, + new(){ Id=903, ProviderId=9, Name="glm-4-airx", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=10.00000M, CurrencyCode="RMB", }, + new(){ Id=904, ProviderId=9, Name="glm-4-long", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=1048576, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=1.00000M, CurrencyCode="RMB", }, + new(){ Id=905, ProviderId=9, Name="glm-4-flashx", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.10000M, OutputTokenPrice1M=0.10000M, CurrencyCode="RMB", }, + new(){ Id=906, ProviderId=9, Name="glm-4-flash", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=true, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=907, ProviderId=9, Name="glm-4v-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=10.00000M, OutputTokenPrice1M=10.00000M, CurrencyCode="RMB", }, + new(){ Id=908, ProviderId=9, Name="glm-4v", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=1.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=1024, TokenizerId=null, InputTokenPrice1M=50.00000M, OutputTokenPrice1M=50.00000M, CurrencyCode="RMB", }, + new(){ Id=1000, ProviderId=10, Name="deepseek-chat", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=64000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="RMB", }, + new(){ Id=1100, ProviderId=11, Name="grok-beta", ShortName="grok", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1101, ProviderId=11, Name="grok-vision-beta", ShortName="grok", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=8192, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1200, ProviderId=12, Name="AI21-Jamba-1.5-Large", ShortName="AI21-Jamba", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=256000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1201, ProviderId=12, Name="AI21-Jamba-1.5-Mini", ShortName="AI21-Jamba", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=256000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1202, ProviderId=12, Name="Cohere-command-r", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1203, ProviderId=12, Name="Cohere-command-r-plus", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="USD", }, + new(){ Id=1204, ProviderId=12, Name="Llama-3.2-11B-Vision-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1205, ProviderId=12, Name="Llama-3.2-90B-Vision-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4000, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1206, ProviderId=12, Name="Meta-Llama-3.1-405B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1207, ProviderId=12, Name="Meta-Llama-3.1-70B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=2.50000M, OutputTokenPrice1M=5.00000M, CurrencyCode="USD", }, + new(){ Id=1208, ProviderId=12, Name="Meta-Llama-3.1-8B-Instruct", ShortName="LLaMA", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1209, ProviderId=12, Name="Mistral-large", ShortName="Mistral", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=false, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1210, ProviderId=12, Name="Mistral-large-2407", ShortName="Mistral", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=false, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1211, ProviderId=12, Name="Mistral-Nemo", ShortName="Mistral", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=false, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1212, ProviderId=12, Name="Mistral-small", ShortName="Mistral", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=false, ContextWindow=32768, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1213, ProviderId=12, Name="gpt-4o", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=5.00000M, OutputTokenPrice1M=15.00000M, CurrencyCode="USD", }, + new(){ Id=1214, ProviderId=12, Name="gpt-4o-mini", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=128000, MaxResponseTokens=4096, TokenizerId=2, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1215, ProviderId=12, Name="Phi-3.5-MoE-instruct", ShortName="Phi-3.5", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, + new(){ Id=1216, ProviderId=12, Name="Phi-3.5-mini-instruct", ShortName="Phi-3.5", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=0.50000M, OutputTokenPrice1M=1.00000M, CurrencyCode="USD", }, + new(){ Id=1217, ProviderId=12, Name="Phi-3.5-vision-instruct", ShortName="Phi-3.5", IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=131072, MaxResponseTokens=4096, TokenizerId=null, InputTokenPrice1M=1.00000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", } ]); } private static void InsertModelProviders(ChatsDB db) { - // Generated from data, hash: 137fb94c0828ca100273aad14b6d69e7f9caef6a1d69cc96c2667a17a4e31ccc + // Generated from data, hash: 615290985867eb3467e7889a31c4edf5dcdbd113930d67df8e19b6cd27c955ca db.ModelProviders.AddRange( [ - new(){ Id=0, Name="Test", InitialHost=null, InitialSecret=null, }, - new(){ Id=1, Name="Azure OpenAI", InitialHost="https://.openai.azure.com/", InitialSecret="", }, - new(){ Id=2, Name="Tencent Hunyuan", InitialHost="hunyuan.tencentcloudapi.com", InitialSecret="""{"secretId":"", "secretKey":""}""", }, - new(){ Id=3, Name="01.ai", InitialHost=null, InitialSecret="", }, - new(){ Id=4, Name="Moonshot", InitialHost=null, InitialSecret="", }, - new(){ Id=5, Name="OpenAI", InitialHost="https://api.openai.com/v1", InitialSecret="", }, - new(){ Id=6, Name="Wenxin Qianfan", InitialHost=null, InitialSecret="""{"apiKey":"", "secret":""}""", }, - new(){ Id=7, Name="DashScope", InitialHost=null, InitialSecret="", }, - new(){ Id=8, Name="Xunfei SparkDesk", InitialHost=null, InitialSecret="""{"appId": "", "apiKey":"", "secret":""}""", }, - new(){ Id=9, Name="Zhipu AI", InitialHost=null, InitialSecret="", }, - new(){ Id=10, Name="DeepSeek", InitialHost=null, InitialSecret="", } + new(){ Id=0, Name="Test", InitialHost=null, InitialSecret=null, }, + new(){ Id=1, Name="Azure OpenAI", InitialHost="https://.openai.azure.com/", InitialSecret="", }, + new(){ Id=2, Name="Tencent Hunyuan", InitialHost="hunyuan.tencentcloudapi.com", InitialSecret="""{"secretId":"", "secretKey":""}""", }, + new(){ Id=3, Name="01.ai", InitialHost=null, InitialSecret="", }, + new(){ Id=4, Name="Moonshot", InitialHost=null, InitialSecret="", }, + new(){ Id=5, Name="OpenAI", InitialHost="https://api.openai.com/v1", InitialSecret="", }, + new(){ Id=6, Name="Wenxin Qianfan", InitialHost=null, InitialSecret="""{"apiKey":"", "secret":""}""", }, + new(){ Id=7, Name="DashScope", InitialHost=null, InitialSecret="", }, + new(){ Id=8, Name="Xunfei SparkDesk", InitialHost=null, InitialSecret="", }, + new(){ Id=9, Name="Zhipu AI", InitialHost=null, InitialSecret="", }, + new(){ Id=10, Name="DeepSeek", InitialHost=null, InitialSecret="", }, + new(){ Id=11, Name="x.ai", InitialHost=null, InitialSecret="xai-yourkey", }, + new(){ Id=12, Name="Github Models", InitialHost=null, InitialSecret="ghp_yourkey", } ]); } }; \ No newline at end of file diff --git a/src/BE/DB/Init/scaffold-basic-data.linq b/src/BE/DB/Init/scaffold-basic-data.linq index 3ee97a56..462949c7 100644 --- a/src/BE/DB/Init/scaffold-basic-data.linq +++ b/src/BE/DB/Init/scaffold-basic-data.linq @@ -1,18 +1,4 @@ - - 35a33e06-2204-4d18-88ea-ce7dedb2c722 - 2 - true - home.starworks.cc,37965 - true - sa - AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAmOMyzcMZ5ka3bwTJ5AmIAwAAAAACAAAAAAAQZgAAAAEAACAAAACgg8NDg49czDMsZVdzq0y270QbNlJreQzmHHylcaOAlwAAAAAOgAAAAAIAACAAAAA1kH5y8TgdeVizkX0gG0DZt5z6nAJLL4Y0djorJiZ7fCAAAACiWyAkQ+ISVpGnhPB4xAyJDsOPI0hd8DQa9L6IyOo/oUAAAABshwYQgiVMG/CpeAqgSnxR5z5/wCjv+GHgbUPOpYZV+Aue7TCSybx1R1e0hJKq285TBIpwrJVD6373TkwMSj9Y - true - ChatsSTG - - false - - Microsoft.CodeAnalysis.Analyzers Microsoft.CodeAnalysis.CSharp Microsoft.CodeAnalysis diff --git a/src/BE/DB/Jsons/JsonMinioConfig.cs b/src/BE/DB/Jsons/JsonMinioConfig.cs deleted file mode 100644 index ad0eb69c..00000000 --- a/src/BE/DB/Jsons/JsonMinioConfig.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Chats.BE.Services.Common; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Chats.BE.DB.Jsons; - -public record JsonMinioConfig -{ - [JsonPropertyName("accessKey")] - public required string AccessKey { get; init; } - - [JsonPropertyName("accessSecret")] - public required string AccessSecret { get; init; } - - [JsonPropertyName("endpoint")] - public required string Endpoint { get; init; } - - [JsonPropertyName("bucketName")] - public required string BucketName { get; init; } - - public static JsonMinioConfig Parse(string json) - { - return JsonSerializer.Deserialize(json)!; - } - - public JsonMinioConfig WithMaskedKeys() - { - return this with - { - AccessKey = AccessKey.ToMasked(), - AccessSecret = AccessSecret.ToMasked() - }; - } - - public bool IsMaskedEquals(JsonMinioConfig inputConfig) - { - if (inputConfig.AccessKey.SeemsMasked()) - { - return WithMaskedKeys() == inputConfig; - } - else - { - return this == inputConfig; - } - } -} \ No newline at end of file diff --git a/src/BE/DB/Jsons/JsonModelConfig.cs b/src/BE/DB/Jsons/JsonModelConfig.cs deleted file mode 100644 index 64ab6c45..00000000 --- a/src/BE/DB/Jsons/JsonModelConfig.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.DB.Jsons; - -public record JsonModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public required float Temperature { get; init; } - - [JsonPropertyName("model"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Model { get; init; } - - [JsonPropertyName("version"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Version { get; init; } - - [JsonPropertyName("deploymentName")] - public string? DeploymentName { get; init; } - - [JsonPropertyName("enableSearch")] - public bool? EnableSearch { get; init; } - - [JsonPropertyName("maxLength")] - public int? MaxLength { get; init; } -} \ No newline at end of file diff --git a/src/BE/DB/Jsons/JsonUserModelConfig.cs b/src/BE/DB/Jsons/JsonUserModelConfig.cs index dd9b4483..59889bd8 100644 --- a/src/BE/DB/Jsons/JsonUserModelConfig.cs +++ b/src/BE/DB/Jsons/JsonUserModelConfig.cs @@ -1,29 +1,32 @@ -using System.Text.Json.Serialization; +using Azure.Core; +using Chats.BE.Services.ChatServices.Extensions; +using OpenAI.Chat; +using System.Text.Json.Serialization; namespace Chats.BE.DB.Jsons; public record JsonUserModelConfig { - [JsonPropertyName("prompt"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("prompt")] public string? Prompt { get; init; } - [JsonPropertyName("temperature"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("temperature")] public float? Temperature { get; init; } - [JsonPropertyName("enableSearch"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("enableSearch")] public bool? EnableSearch { get; init; } - [JsonPropertyName("maxLength"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("maxLength")] public int? MaxLength { get; init; } - public static JsonUserModelConfig FromJson(JsonModelConfig modelConfig) + public ChatCompletionOptions ToChatCompletionOptions(int userId) { - return new JsonUserModelConfig + ChatCompletionOptions cco = new() { - Prompt = modelConfig.Prompt, - Temperature = modelConfig.Temperature, - EnableSearch = modelConfig.EnableSearch, - MaxLength = modelConfig.MaxLength + Temperature = Temperature, + EndUserId = userId.ToString(), }; + cco.SetAllowSearch(EnableSearch ?? false); + return cco; } } diff --git a/src/BE/Services/ChatServices/ChatFactory.cs b/src/BE/Services/ChatServices/ChatFactory.cs index 611642f1..a08ab5e7 100644 --- a/src/BE/Services/ChatServices/ChatFactory.cs +++ b/src/BE/Services/ChatServices/ChatFactory.cs @@ -1,12 +1,7 @@ using Chats.BE.DB; using Chats.BE.DB.Enums; -using Chats.BE.Services.ChatServices.Implementations.Azure; using Chats.BE.Services.ChatServices.Implementations.DashScope; -using Chats.BE.Services.ChatServices.Implementations.DeepSeek; -using Chats.BE.Services.ChatServices.Implementations.GLM; using Chats.BE.Services.ChatServices.Implementations.Hunyuan; -using Chats.BE.Services.ChatServices.Implementations.Kimi; -using Chats.BE.Services.ChatServices.Implementations.LingYi; using Chats.BE.Services.ChatServices.Implementations.OpenAI; using Chats.BE.Services.ChatServices.Implementations.QianFan; using Chats.BE.Services.ChatServices.Implementations.Test; @@ -29,9 +24,11 @@ public ChatService CreateConversationService(Model model) DBModelProvider.ZhiPuAI => new GLMChatService(model), DBModelProvider.Moonshot => new KimiChatService(model), DBModelProvider.HunYuan => new HunyuanChatService(model), - DBModelProvider.Sparkdesk => throw new NotImplementedException("Spark model is not implemented"), + DBModelProvider.Sparkdesk => new SparkDeskChatService(model), DBModelProvider.LingYi => new LingYiChatService(model), DBModelProvider.DeepSeek => new DeepSeekChatService(model), + DBModelProvider.xAI => new XAIChatService(model), + DBModelProvider.GithubModels => new GithubModelsChatService(model), _ => throw new NotSupportedException($"Unknown model provider: {modelProvider}") }; return cs; diff --git a/src/BE/Services/ChatServices/ChatServiceExtensions.cs b/src/BE/Services/ChatServices/ChatServiceExtensions.cs index dc61f33f..5dcc9c11 100644 --- a/src/BE/Services/ChatServices/ChatServiceExtensions.cs +++ b/src/BE/Services/ChatServices/ChatServiceExtensions.cs @@ -9,7 +9,7 @@ public abstract partial class ChatService { public async IAsyncEnumerable ChatStreamedFEProcessed(IReadOnlyList messages, ChatCompletionOptions options, [EnumeratorCancellation] CancellationToken cancellationToken) { - ChatMessage[] filteredMessage = FEProcessMessages(messages, options); + ChatMessage[] filteredMessage = FEPreprocess(messages, options); await foreach (InternalChatSegment seg in ChatStreamedSimulated(suggestedStreaming: true, filteredMessage, options, cancellationToken)) { @@ -48,7 +48,7 @@ public async IAsyncEnumerable ChatStreamedSimulated(bool su } } - private ChatMessage[] FEProcessMessages(IReadOnlyList messages, ChatCompletionOptions options) + protected virtual ChatMessage[] FEPreprocess(IReadOnlyList messages, ChatCompletionOptions options) { if (!Model.ModelReference.AllowSystemPrompt) { @@ -66,10 +66,6 @@ private ChatMessage[] FEProcessMessages(IReadOnlyList messages, Cha } ChatMessage[] filteredMessage = messages.Select(m => FilterVision(Model.ModelReference.AllowVision, m)).ToArray(); - if (Model.ModelReference.AllowVision) - { - options.MaxOutputTokenCount ??= Model.ModelReference.MaxResponseTokens; - } if (!Model.ModelReference.AllowSearch) { options.RemoveAllowSearch(); diff --git a/src/BE/Services/ChatServices/Extensions/ChatCompletionOptionsExtensions.cs b/src/BE/Services/ChatServices/Extensions/ChatCompletionOptionsExtensions.cs index 56eaef85..d1ee37d8 100644 --- a/src/BE/Services/ChatServices/Extensions/ChatCompletionOptionsExtensions.cs +++ b/src/BE/Services/ChatServices/Extensions/ChatCompletionOptionsExtensions.cs @@ -16,6 +16,18 @@ public static bool IsSearchEnabled(this ChatCompletionOptions options) return false; } + public static void SetAllowSearch(this ChatCompletionOptions options, bool value) + { + IDictionary? rawData = GetSerializedAdditionalRawData(options); + if (rawData == null) + { + rawData = new Dictionary(); + SetSerializedAdditionalRawData(options, rawData); + } + + rawData["enable_search"] = BinaryData.FromObjectAsJson(value); + } + public static void RemoveAllowSearch(this ChatCompletionOptions options) { IDictionary? rawData = GetSerializedAdditionalRawData(options); @@ -44,4 +56,7 @@ public static void SetModelName(this ChatCompletionOptions @this, string name) [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "get_SerializedAdditionalRawData")] private extern static IDictionary? GetSerializedAdditionalRawData(ChatCompletionOptions @this); + + [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "set_SerializedAdditionalRawData")] + private extern static void SetSerializedAdditionalRawData(ChatCompletionOptions @this, IDictionary? value); } diff --git a/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureConfig.cs b/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureConfig.cs deleted file mode 100644 index f3d80fb5..00000000 --- a/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureConfig.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.Azure; - -public record JsonAzureApiConfig -{ - [JsonPropertyName("host")] - public required string Host { get; init; } - - [JsonPropertyName("apiKey")] - public required string ApiKey { get; init; } - - public static JsonAzureApiConfig Parse(string json) - { - return JsonSerializer.Deserialize(json)!; - } -} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureModelConfig.cs b/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureModelConfig.cs deleted file mode 100644 index 15f77097..00000000 --- a/src/BE/Services/ChatServices/Implementations/Azure/JsonAzureModelConfig.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.Azure; - -public record JsonAzureModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public float? Temperature { get; init; } - - [JsonPropertyName("version")] - public string? Version { get; init; } - - [JsonPropertyName("deploymentName")] - public required string DeploymentName { get; init; } -} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/GLM/JsonGLMModelConfig.cs b/src/BE/Services/ChatServices/Implementations/GLM/JsonGLMModelConfig.cs deleted file mode 100644 index 818a9498..00000000 --- a/src/BE/Services/ChatServices/Implementations/GLM/JsonGLMModelConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.GLM; - -public record JsonGLMModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public required double Temperature { get; init; } - - [JsonPropertyName("model")] - public required string Model { get; init; } -} diff --git a/src/BE/Services/ChatServices/Implementations/Hunyuan/JsonHunyuanModelConfig.cs b/src/BE/Services/ChatServices/Implementations/Hunyuan/JsonHunyuanModelConfig.cs deleted file mode 100644 index bb9853e5..00000000 --- a/src/BE/Services/ChatServices/Implementations/Hunyuan/JsonHunyuanModelConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.Hunyuan; - -public record JsonHunyuanModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public required float? Temperature { get; init; } - - [JsonPropertyName("model")] - public required string Model { get; init; } -} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/Kimi/JsonKimiModelConfig.cs b/src/BE/Services/ChatServices/Implementations/Kimi/JsonKimiModelConfig.cs deleted file mode 100644 index 9e3e13df..00000000 --- a/src/BE/Services/ChatServices/Implementations/Kimi/JsonKimiModelConfig.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.Kimi; - -public record JsonKimiModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public required float Temperature { get; init; } -} diff --git a/src/BE/Services/ChatServices/Implementations/Azure/AzureChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/AzureChatService.cs similarity index 83% rename from src/BE/Services/ChatServices/Implementations/Azure/AzureChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/AzureChatService.cs index 027532f6..d9c911d9 100644 --- a/src/BE/Services/ChatServices/Implementations/Azure/AzureChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/AzureChatService.cs @@ -1,11 +1,10 @@ using Azure.AI.OpenAI; using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; using OpenAI; using OpenAI.Chat; using System.ClientModel; -namespace Chats.BE.Services.ChatServices.Implementations.Azure; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class AzureChatService(Model model) : OpenAIChatService(model, CreateChatClient(model)) { diff --git a/src/BE/Services/ChatServices/Implementations/DeepSeek/DeepSeekChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/DeepSeekChatService.cs similarity index 51% rename from src/BE/Services/ChatServices/Implementations/DeepSeek/DeepSeekChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/DeepSeekChatService.cs index e178ebda..893faa92 100644 --- a/src/BE/Services/ChatServices/Implementations/DeepSeek/DeepSeekChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/DeepSeekChatService.cs @@ -1,6 +1,5 @@ using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; -namespace Chats.BE.Services.ChatServices.Implementations.DeepSeek; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class DeepSeekChatService(Model model) : OpenAIChatService(model, new Uri("https://api.deepseek.com/v1")); \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/GLM/GLMChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/GLMChatService.cs similarity index 54% rename from src/BE/Services/ChatServices/Implementations/GLM/GLMChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/GLMChatService.cs index 088451e0..0e62e4dc 100644 --- a/src/BE/Services/ChatServices/Implementations/GLM/GLMChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/GLMChatService.cs @@ -1,7 +1,6 @@ using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; -namespace Chats.BE.Services.ChatServices.Implementations.GLM; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class GLMChatService(Model model) : OpenAIChatService(model, new Uri("https://open.bigmodel.cn/api/paas/v4/")) { diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs new file mode 100644 index 00000000..0b154063 --- /dev/null +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/GithubModelsChatService.cs @@ -0,0 +1,17 @@ +using Chats.BE.DB; +using OpenAI.Chat; + +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; + +public class GithubModelsChatService(Model model) : OpenAIChatService(model, new Uri("https://models.inference.ai.azure.com")) +{ + protected override ChatMessage[] FEPreprocess(IReadOnlyList messages, ChatCompletionOptions options) + { + if (Model.ModelReference.ShortName == "Mistral") + { + // Mistral model does not support end-user ID + options.EndUserId = null; + } + return base.FEPreprocess(messages, options); + } +} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/JsonOpenAIModelConfig.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/JsonOpenAIModelConfig.cs deleted file mode 100644 index 44e4d4a1..00000000 --- a/src/BE/Services/ChatServices/Implementations/OpenAI/JsonOpenAIModelConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Text.Json.Serialization; - -namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; - -public record JsonOpenAIModelConfig -{ - [JsonPropertyName("prompt")] - public required string Prompt { get; init; } - - [JsonPropertyName("temperature")] - public float? Temperature { get; init; } - - [JsonPropertyName("model")] - public required string DeploymentName { get; init; } -} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/Kimi/KimiChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/KimiChatService.cs similarity index 51% rename from src/BE/Services/ChatServices/Implementations/Kimi/KimiChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/KimiChatService.cs index c0a6c907..b909ee68 100644 --- a/src/BE/Services/ChatServices/Implementations/Kimi/KimiChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/KimiChatService.cs @@ -1,6 +1,5 @@ using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; -namespace Chats.BE.Services.ChatServices.Implementations.Kimi; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class KimiChatService(Model model) : OpenAIChatService(model, new Uri("https://api.moonshot.cn/v1")); \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/LingYi/LingYiChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/LingYiChatService.cs similarity index 52% rename from src/BE/Services/ChatServices/Implementations/LingYi/LingYiChatService.cs rename to src/BE/Services/ChatServices/Implementations/OpenAI/LingYiChatService.cs index d777fd27..7380a7fd 100644 --- a/src/BE/Services/ChatServices/Implementations/LingYi/LingYiChatService.cs +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/LingYiChatService.cs @@ -1,6 +1,5 @@ using Chats.BE.DB; -using Chats.BE.Services.ChatServices.Implementations.OpenAI; -namespace Chats.BE.Services.ChatServices.Implementations.LingYi; +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; public class LingYiChatService(Model model) : OpenAIChatService(model, new Uri("https://api.lingyiwanwu.com/v1")); diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/SparkDeskChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/SparkDeskChatService.cs new file mode 100644 index 00000000..99167ed5 --- /dev/null +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/SparkDeskChatService.cs @@ -0,0 +1,18 @@ +using Chats.BE.DB; +using OpenAI.Chat; + +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; + +public class SparkDeskChatService(Model model) : OpenAIChatService(model, new Uri("https://spark-api-open.xf-yun.com/v1")) +{ + protected override ChatMessage[] FEPreprocess(IReadOnlyList messages, ChatCompletionOptions options) + { + ChatMessage[] toReturn = base.FEPreprocess(messages, options); + // spark desk enable search is set via tool https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html#_3-%E8%AF%B7%E6%B1%82%E8%AF%B4%E6%98%8E + // however unfortunately the tool is not available in OpenAI SDK + // otherwise, the code should be: + // bool enableSearch = options.IsSearchEnabled(); + // options.Tools.Add(MakeSparkDeskSearchTool(enableSearch)); + return toReturn; + } +} \ No newline at end of file diff --git a/src/BE/Services/ChatServices/Implementations/OpenAI/XAIChatService.cs b/src/BE/Services/ChatServices/Implementations/OpenAI/XAIChatService.cs new file mode 100644 index 00000000..338018ab --- /dev/null +++ b/src/BE/Services/ChatServices/Implementations/OpenAI/XAIChatService.cs @@ -0,0 +1,5 @@ +using Chats.BE.DB; + +namespace Chats.BE.Services.ChatServices.Implementations.OpenAI; + +public class XAIChatService(Model model) : OpenAIChatService(model, new Uri("https://api.x.ai/v1")); \ No newline at end of file diff --git a/src/BE/Services/UrlEncryption/UrlEncryptionService.cs b/src/BE/Services/UrlEncryption/UrlEncryptionService.cs index 9a109aa6..29b44607 100644 --- a/src/BE/Services/UrlEncryption/UrlEncryptionService.cs +++ b/src/BE/Services/UrlEncryption/UrlEncryptionService.cs @@ -1,4 +1,5 @@ using Chats.BE.Infrastructure.Functional; +using System.Security.Cryptography; namespace Chats.BE.Services.UrlEncryption; @@ -32,7 +33,15 @@ public string CreateSignedPath(TimedId timedId, EncryptionPurpose purpose) public Result DecodeSignedPathAsInt32(string path, long validBefore, string hash, EncryptionPurpose purpose) { - int id = DecryptAsInt32(path, purpose); + int id; + try + { + id = DecryptAsInt32(path, purpose); + } + catch (CryptographicException) + { + return Result.Fail("Invalid encrypted ID."); + } DateTimeOffset validBeforeTime = DateTimeOffset.FromUnixTimeMilliseconds(validBefore); if (validBeforeTime < DateTimeOffset.UtcNow) { diff --git a/src/FE/.eslintrc.json b/src/FE/.eslintrc.json index 4c468d41..6ef85cad 100644 --- a/src/FE/.eslintrc.json +++ b/src/FE/.eslintrc.json @@ -4,4 +4,4 @@ "react-hooks/exhaustive-deps": "off", "@next/next/no-img-element": "off" } -} \ No newline at end of file +} diff --git a/src/FE/.husky/pre-commit b/src/FE/.husky/pre-commit new file mode 100644 index 00000000..7b2a0748 --- /dev/null +++ b/src/FE/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname "$0")/_/husky.sh" + +npm run format \ No newline at end of file diff --git a/src/FE/.prettierignore b/src/FE/.prettierignore new file mode 100644 index 00000000..bcf7d26f --- /dev/null +++ b/src/FE/.prettierignore @@ -0,0 +1,5 @@ +out/ +.next/ +node_module/ +.husky/ +public/ \ No newline at end of file diff --git a/src/FE/apis/adminApis.ts b/src/FE/apis/adminApis.ts index e2ba5990..279096ca 100644 --- a/src/FE/apis/adminApis.ts +++ b/src/FE/apis/adminApis.ts @@ -95,7 +95,8 @@ export const getUsers = ( ): Promise> => { const fetchService = useFetch(); return fetchService.get( - `/api/admin/users?page=${params.page}&pageSize=${params.pageSize}&query=${params?.query || '' + `/api/admin/users?page=${params.page}&pageSize=${params.pageSize}&query=${ + params?.query || '' }`, ); }; @@ -164,12 +165,14 @@ export const putFileService = (id: number, params: PostFileServicesParams) => { export const deleteFileService = (id: number) => { const fetchService = useFetch(); return fetchService.delete(`/api/admin/file-service/${id}`); -} +}; export const getFileServiceTypeInitialConfig = (fileServiceTypeId: number) => { const fetchService = useFetch(); - return fetchService.get(`/api/admin/file-service-type/${fileServiceTypeId}/initial-config`); -} + return fetchService.get( + `/api/admin/file-service-type/${fileServiceTypeId}/initial-config`, + ); +}; export const getShareMessage = ( chatId: string, diff --git a/src/FE/components/Button/CopyButton.tsx b/src/FE/components/Button/CopyButton.tsx index b4ca679e..50781c57 100644 --- a/src/FE/components/Button/CopyButton.tsx +++ b/src/FE/components/Button/CopyButton.tsx @@ -35,11 +35,7 @@ export default function CopyButton(props: Props) { onClick={handleCopy} title={t('Copy')} > - {isCopied ? ( - - ) : ( - - )} + {isCopied ? : } ); } diff --git a/src/FE/components/Chat/ChangeModel.tsx b/src/FE/components/ChangeModel/ChangeModel.tsx similarity index 93% rename from src/FE/components/Chat/ChangeModel.tsx rename to src/FE/components/ChangeModel/ChangeModel.tsx index 1e142c7e..2b1da167 100644 --- a/src/FE/components/Chat/ChangeModel.tsx +++ b/src/FE/components/ChangeModel/ChangeModel.tsx @@ -1,4 +1,4 @@ -import { useContext, useState } from 'react'; +import { useState } from 'react'; import useTranslation from '@/hooks/useTranslation'; @@ -7,8 +7,7 @@ import { feModelProviders } from '@/types/model'; import ChatIcon from '@/components/ChatIcon/ChatIcon'; import { IconChevronDown } from '@/components/Icons'; -import Search from '@/components/Search'; -import { Button } from '@/components/ui/button'; +import Search from '@/components/Search/Search'; import { DropdownMenu, DropdownMenuContent, @@ -21,24 +20,23 @@ import { DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; -import { HomeContext } from '@/contexts/Home.context'; import { cn } from '@/lib/utils'; const ChangeModel = ({ + models, + readonly, content, className, onChangeModel, }: { + models: AdminModelDto[]; readonly?: boolean; content?: string | React.JSX.Element; className?: string; onChangeModel: (model: AdminModelDto) => void; }) => { const { t } = useTranslation(); - const { - state: { models }, - } = useContext(HomeContext); const [searchTerm, setSearchTerm] = useState(''); let modelGroup = [] as { providerId: number; child: AdminModelDto[] }[]; diff --git a/src/FE/components/Chat/AccountBalance.tsx b/src/FE/components/Chat/AccountBalance.tsx deleted file mode 100644 index a69aa3c5..00000000 --- a/src/FE/components/Chat/AccountBalance.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { useContext, useEffect, useState } from 'react'; - -import useTranslation from '@/hooks/useTranslation'; - -import { formatRMB } from '@/utils/common'; - -import { HomeContext } from '@/contexts/Home.context'; - -import { getUserBalanceOnly } from '@/apis/clientApis'; - -export const AccountBalance = () => { - const { t } = useTranslation(); - const [balance, setBalance] = useState(0); - const { - state: {}, - } = useContext(HomeContext); - - useEffect(() => { - getUserBalanceOnly().then((data) => { - setBalance(data); - }); - }, []); - - return ( -
- -
- {formatRMB(balance)} -
-
- ); -}; diff --git a/src/FE/components/Chat/ChatLoader.tsx b/src/FE/components/Chat/ChatLoader.tsx deleted file mode 100644 index 3e0e870a..00000000 --- a/src/FE/components/Chat/ChatLoader.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { FC } from 'react'; - -import { IconRobot } from '@/components/Icons/index'; - -interface Props {} - -export const ChatLoader: FC = () => { - return ( -
-
-
- -
- -
-
- ); -}; diff --git a/src/FE/components/Chat/MemoizedChatMessage.tsx b/src/FE/components/Chat/MemoizedChatMessage.tsx deleted file mode 100644 index 8a95fd75..00000000 --- a/src/FE/components/Chat/MemoizedChatMessage.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { FC, memo } from 'react'; - -import { ChatMessage, Props } from './ChatMessage'; - -export const MemoizedChatMessage: FC = memo( - ChatMessage, - (prevProps, nextProps) => - prevProps.message.content === nextProps.message.content, -); diff --git a/src/FE/components/Chat/ChatError.tsx b/src/FE/components/ChatError/ChatError.tsx similarity index 94% rename from src/FE/components/Chat/ChatError.tsx rename to src/FE/components/ChatError/ChatError.tsx index d6f42778..0bde22cf 100644 --- a/src/FE/components/Chat/ChatError.tsx +++ b/src/FE/components/ChatError/ChatError.tsx @@ -1,6 +1,5 @@ import useTranslation from '@/hooks/useTranslation'; -import { IconError } from '@/components/Icons'; import { Alert, AlertDescription } from '@/components/ui/alert'; interface Props { diff --git a/src/FE/components/ChatIcon/ChatIcon.tsx b/src/FE/components/ChatIcon/ChatIcon.tsx index cf12780b..5d3f3ba5 100644 --- a/src/FE/components/ChatIcon/ChatIcon.tsx +++ b/src/FE/components/ChatIcon/ChatIcon.tsx @@ -1,9 +1,10 @@ +import useTranslation from '@/hooks/useTranslation'; + +import { feModelProviders } from '@/types/model'; import { IconShare } from '@/components/Icons'; -import useTranslation from '@/hooks/useTranslation'; import { cn } from '@/lib/utils'; -import { feModelProviders } from '@/types/model'; interface Props { providerId: number; diff --git a/src/FE/components/Chat/ChatMessage/ChangeModelAction.tsx b/src/FE/components/ChatMessage/ChangeModelAction.tsx similarity index 75% rename from src/FE/components/Chat/ChatMessage/ChangeModelAction.tsx rename to src/FE/components/ChatMessage/ChangeModelAction.tsx index a23d0a5f..3c1cd7dc 100644 --- a/src/FE/components/Chat/ChatMessage/ChangeModelAction.tsx +++ b/src/FE/components/ChatMessage/ChangeModelAction.tsx @@ -1,9 +1,12 @@ import useTranslation from '@/hooks/useTranslation'; -import ChangeModel from '@/components/Chat/ChangeModel'; +import { AdminModelDto } from '@/types/adminApis'; + +import ChangeModel from '@/components/ChangeModel/ChangeModel'; import Tips from '@/components/Tips/Tips'; interface Props { + models: AdminModelDto[]; hidden?: boolean; readonly?: boolean; onChangeModel: (modelId: number) => void; @@ -12,13 +15,14 @@ interface Props { export const ChangeModelAction = (props: Props) => { const { t } = useTranslation(); - const { modelName, readonly, onChangeModel, hidden } = props; + const { models, modelName, readonly, onChangeModel, hidden } = props; const Render = () => { return ( { onChangeModel && onChangeModel(model.modelId); diff --git a/src/FE/components/Chat/ChatMessage/ChatMessage.tsx b/src/FE/components/ChatMessage/ChatMessage.tsx similarity index 81% rename from src/FE/components/Chat/ChatMessage/ChatMessage.tsx rename to src/FE/components/ChatMessage/ChatMessage.tsx index bcf04a90..51221fe0 100644 --- a/src/FE/components/Chat/ChatMessage/ChatMessage.tsx +++ b/src/FE/components/ChatMessage/ChatMessage.tsx @@ -1,19 +1,18 @@ -import { FC, memo, useContext } from 'react'; +import { FC, memo } from 'react'; -import { Message } from '@/types/chat'; +import { AdminModelDto } from '@/types/adminApis'; +import { IChat, Message } from '@/types/chat'; import { PropsMessage } from '@/types/components/chat'; -import { HomeContext } from '@/contexts/Home.context'; - +import ChatError from '@/components/ChatError/ChatError'; import { IconRobot } from '@/components/Icons/index'; -import ChatError from '../ChatError'; import ResponseMessage from './ResponseMessage'; import ResponseMessageActions from './ResponseMessageActions'; import UserMessage from './UserMessage'; export interface Props { - readonly?: boolean; + models: AdminModelDto[]; parentId: string | null; childrenIds: string[]; assistantChildrenIds: string[]; @@ -23,7 +22,11 @@ export interface Props { modelName?: string; modelId?: number; lastMessageId: string; + currentChatMessageId: string; message: PropsMessage; + messageIsStreaming: boolean; + chatError: boolean; + selectChat: IChat; onChangeMessage?: (messageId: string) => void; onEdit?: (editedMessage: Message, parentId: string | null) => void; onRegenerate?: (modelId?: number) => void; @@ -31,7 +34,7 @@ export interface Props { export const ChatMessage: FC = memo( ({ - readonly = false, + models, parentChildrenIds, assistantChildrenIds, currentSelectIndex, @@ -41,14 +44,14 @@ export const ChatMessage: FC = memo( modelId, lastMessageId, message, + messageIsStreaming, + currentChatMessageId, + chatError, + selectChat, onEdit, onChangeMessage, onRegenerate, }) => { - const { - state: { messageIsStreaming, currentChatMessageId, chatError }, - } = useContext(HomeContext); - return (
@@ -59,6 +62,8 @@ export const ChatMessage: FC = memo(
{message.role === 'user' && ( = memo( {message.role === 'assistant' && ( = memo( {message.role === 'assistant' && (
); }; + +export default TemperatureSlider; diff --git a/src/FE/components/ui/form/checkbox.tsx b/src/FE/components/ui/form/checkbox.tsx index 98bdc4cc..3f092507 100644 --- a/src/FE/components/ui/form/checkbox.tsx +++ b/src/FE/components/ui/form/checkbox.tsx @@ -8,7 +8,6 @@ const FormCheckbox = ({ options, field, }: { - label?: string; disabled?: boolean; options?: IFormFieldOption; @@ -17,7 +16,11 @@ const FormCheckbox = ({ return ( - + {label} diff --git a/src/FE/components/ui/slider.tsx b/src/FE/components/ui/slider.tsx index fb55558b..551ac22c 100644 --- a/src/FE/components/ui/slider.tsx +++ b/src/FE/components/ui/slider.tsx @@ -1,9 +1,9 @@ -"use client" +'use client'; -import * as React from "react" -import * as SliderPrimitive from "@radix-ui/react-slider" +import * as SliderPrimitive from '@radix-ui/react-slider'; +import * as React from 'react'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; const Slider = React.forwardRef< React.ElementRef, @@ -12,8 +12,8 @@ const Slider = React.forwardRef< @@ -22,7 +22,7 @@ const Slider = React.forwardRef< -)) -Slider.displayName = SliderPrimitive.Root.displayName +)); +Slider.displayName = SliderPrimitive.Root.displayName; -export { Slider } +export { Slider }; diff --git a/src/FE/components/ui/table.tsx b/src/FE/components/ui/table.tsx index 41e730ed..058cad3f 100644 --- a/src/FE/components/ui/table.tsx +++ b/src/FE/components/ui/table.tsx @@ -1,12 +1,12 @@ import * as React from 'react'; import { ReactElement } from 'react-markdown/lib/react-markdown'; +import useTranslation from '@/hooks/useTranslation'; + import { Skeleton } from './skeleton'; import { cn } from '@/lib/utils'; -import useTranslation from '@/hooks/useTranslation'; - const Table = React.forwardRef< HTMLTableElement, React.HTMLAttributes @@ -50,10 +50,9 @@ const TableBody = React.forwardRef( ...props }, ref, - ) => - { + ) => { const { t } = useTranslation(); - return (isLoading ? ( + return isLoading ? ( @@ -87,8 +86,8 @@ const TableBody = React.forwardRef( className={cn('[&_tr:last-child]:border-0', className)} {...props} /> - )) - } + ); + }, ); TableBody.displayName = 'TableBody'; diff --git a/src/FE/components/ui/toggle-group.tsx b/src/FE/components/ui/toggle-group.tsx index 6cadb522..e5322f8a 100644 --- a/src/FE/components/ui/toggle-group.tsx +++ b/src/FE/components/ui/toggle-group.tsx @@ -1,18 +1,19 @@ -"use client" +'use client'; -import * as React from "react" -import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group" -import { VariantProps } from "class-variance-authority" +import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group'; +import * as React from 'react'; -import { cn } from "@/lib/utils" -import { toggleVariants } from "@/components/ui/toggle" +import { toggleVariants } from '@/components/ui/toggle'; + +import { cn } from '@/lib/utils'; +import { VariantProps } from 'class-variance-authority'; const ToggleGroupContext = React.createContext< VariantProps >({ - size: "default", - variant: "default", -}) + size: 'default', + variant: 'default', +}); const ToggleGroup = React.forwardRef< React.ElementRef, @@ -21,23 +22,23 @@ const ToggleGroup = React.forwardRef< >(({ className, variant, size, children, ...props }, ref) => ( {children} -)) +)); -ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName +ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName; const ToggleGroupItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & VariantProps >(({ className, children, variant, size, ...props }, ref) => { - const context = React.useContext(ToggleGroupContext) + const context = React.useContext(ToggleGroupContext); return ( {children} - ) -}) + ); +}); -ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName +ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName; -export { ToggleGroup, ToggleGroupItem } +export { ToggleGroup, ToggleGroupItem }; diff --git a/src/FE/components/ui/toggle.tsx b/src/FE/components/ui/toggle.tsx index 1379f75d..4cf886e4 100644 --- a/src/FE/components/ui/toggle.tsx +++ b/src/FE/components/ui/toggle.tsx @@ -1,32 +1,32 @@ -"use client" +'use client'; -import * as React from "react" -import * as TogglePrimitive from "@radix-ui/react-toggle" -import { cva, type VariantProps } from "class-variance-authority" +import * as TogglePrimitive from '@radix-ui/react-toggle'; +import * as React from 'react'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; +import { type VariantProps, cva } from 'class-variance-authority'; const toggleVariants = cva( - "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground", + 'inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground', { variants: { variant: { - default: "bg-transparent", + default: 'bg-transparent', outline: - "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground", + 'border border-input bg-transparent hover:bg-accent hover:text-accent-foreground', }, size: { - default: "h-10 px-3", - sm: "h-9 px-2.5", - lg: "h-11 px-5", + default: 'h-10 px-3', + sm: 'h-9 px-2.5', + lg: 'h-11 px-5', }, }, defaultVariants: { - variant: "default", - size: "default", + variant: 'default', + size: 'default', }, - } -) + }, +); const Toggle = React.forwardRef< React.ElementRef, @@ -38,8 +38,8 @@ const Toggle = React.forwardRef< className={cn(toggleVariants({ variant, size, className }))} {...props} /> -)) +)); -Toggle.displayName = TogglePrimitive.Root.displayName +Toggle.displayName = TogglePrimitive.Root.displayName; -export { Toggle, toggleVariants } +export { Toggle, toggleVariants }; diff --git a/src/FE/locales/zh-CN.json b/src/FE/locales/zh-CN.json index c5b9b029..e7b0f45b 100644 --- a/src/FE/locales/zh-CN.json +++ b/src/FE/locales/zh-CN.json @@ -344,7 +344,7 @@ "Token Price": "Token价格", "404: Page not found": "404: 页面未找到", "Sorry, we couldn't find the page you were trying to access.": "抱歉,我们找不到你要访问的页面。", - ": An error has occurred": ": 发生错误", + "An error has occurred": "发生错误", "Sorry, there was an unexpected error, please try again later.": "抱歉,出现了意外错误,请稍后再试。", "Local": "本地", "Minio": "Minio", @@ -361,4 +361,4 @@ "There's no model here": "这里没有模型", "You can contact the administrator or create one yourself": "你可以联系管理员或者自己创建一个", "Customized Text(Company name, etc)": "自定义文本(公司名称等)" -} \ No newline at end of file +} diff --git a/src/FE/next.config.js b/src/FE/next.config.js index f341adf8..9c576cb7 100644 --- a/src/FE/next.config.js +++ b/src/FE/next.config.js @@ -1,13 +1,13 @@ const isDev = process.env?.NODE_ENV === 'development'; -console.log("NODE_ENV", process.env?.NODE_ENV); -console.log("-------------------"); +console.log('NODE_ENV', process.env?.NODE_ENV); +console.log('-------------------'); const withPWA = require('next-pwa')({ dest: 'public', register: !isDev, skipWaiting: !isDev, disable: isDev, -}) +}); /** @type {import('next').NextConfig} */ const nextConfig = { @@ -22,8 +22,8 @@ const nextConfig = { }, publicRuntimeConfig: { chattingIds: {}, - globalConfigs: {} - } + globalConfigs: {}, + }, }; module.exports = withPWA(nextConfig); diff --git a/src/FE/package-lock.json b/src/FE/package-lock.json index b3702542..2fe84c73 100644 --- a/src/FE/package-lock.json +++ b/src/FE/package-lock.json @@ -62,6 +62,7 @@ "cross-env": "^7.0.3", "eslint": "8.49.0", "eslint-config-next": "13.4.19", + "husky": "^9.1.7", "postcss": "^8.4.41", "prettier": "^2.8.7", "prettier-plugin-tailwindcss": "^0.2.5", @@ -8019,6 +8020,22 @@ "node": "*" } }, + "node_modules/husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "dev": true, + "license": "MIT", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/idb": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", @@ -13849,21 +13866,6 @@ "type": "github", "url": "https://github.com/sponsors/wooorm" } - }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.5", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.5.tgz", - "integrity": "sha512-Igh9ZlxwvCDsu6438FXlQTHlRno4gFpJzqPjSIBZooD22tKeI4fE/YMRoHVJHmrQ2P5YL1DoZ0qaOKkbeFWeMg==", - "cpu": [ - "ia32" - ], - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } } } } diff --git a/src/FE/package.json b/src/FE/package.json index 3ededf52..d58bf404 100644 --- a/src/FE/package.json +++ b/src/FE/package.json @@ -8,7 +8,8 @@ "build": "next build", "start": "next start", "lint": "next lint", - "format": "prettier --write ." + "format": "prettier --write .", + "prepare": "husky" }, "dependencies": { "@hookform/resolvers": "^3.3.4", @@ -65,6 +66,7 @@ "cross-env": "^7.0.3", "eslint": "8.49.0", "eslint-config-next": "13.4.19", + "husky": "^9.1.7", "postcss": "^8.4.41", "prettier": "^2.8.7", "prettier-plugin-tailwindcss": "^0.2.5", diff --git a/src/FE/pages/_app.tsx b/src/FE/pages/_app.tsx index 8c25e65d..04203d68 100644 --- a/src/FE/pages/_app.tsx +++ b/src/FE/pages/_app.tsx @@ -9,12 +9,11 @@ import { getUserInfo } from '@/utils/user'; import { UserRole } from '@/types/adminApis'; -import { ThemeProvider } from '@/components/Theme/ThemeProvider'; - import ErrorPage from './_error'; import AdminLayout from './admin/layout'; import './globals.css'; +import { ThemeProvider } from '@/providers/ThemeProvider'; import 'katex/dist/katex.min.css'; function App({ Component, pageProps }: AppProps<{}> | any) { @@ -25,7 +24,7 @@ function App({ Component, pageProps }: AppProps<{}> | any) { useEffect(() => { setIsClient(true); - document.title = "Chats"; + document.title = 'Chats'; }, []); const isAdmin = () => { diff --git a/src/FE/pages/_document.tsx b/src/FE/pages/_document.tsx index 9eb3466a..016e5cb8 100644 --- a/src/FE/pages/_document.tsx +++ b/src/FE/pages/_document.tsx @@ -17,7 +17,11 @@ function ChatsDocument(props: Props) { - + diff --git a/src/FE/pages/_error.tsx b/src/FE/pages/_error.tsx index 456abe24..b45e4ff7 100644 --- a/src/FE/pages/_error.tsx +++ b/src/FE/pages/_error.tsx @@ -22,10 +22,7 @@ const ErrorPage = ({ statusCode }: { statusCode: number }) => { return (
-

- {statusCode} - {t(': An error has occurred')} -

+

{t('An error has occurred')}

{t('Sorry, there was an unexpected error, please try again later.')}

diff --git a/src/FE/components/Admin/Files/FileServiceModal.tsx b/src/FE/pages/admin/_components/Files/FileServiceModal.tsx similarity index 98% rename from src/FE/components/Admin/Files/FileServiceModal.tsx rename to src/FE/pages/admin/_components/Files/FileServiceModal.tsx index eac92fdc..0174a46f 100644 --- a/src/FE/components/Admin/Files/FileServiceModal.tsx +++ b/src/FE/pages/admin/_components/Files/FileServiceModal.tsx @@ -42,7 +42,7 @@ interface IProps { saveLoading?: boolean; } -export const FileServiceModal = (props: IProps) => { +const FileServiceModal = (props: IProps) => { const { t } = useTranslation(); const { selected, isOpen, onClose, onSuccessful } = props; const formFields: IFormFieldOption[] = [ @@ -220,3 +220,5 @@ export const FileServiceModal = (props: IProps) => { ); }; + +export default FileServiceModal; diff --git a/src/FE/components/Admin/GlobalConfigs/GlobalConfigsModal.tsx b/src/FE/pages/admin/_components/GlobalConfigs/GlobalConfigsModal.tsx similarity index 98% rename from src/FE/components/Admin/GlobalConfigs/GlobalConfigsModal.tsx rename to src/FE/pages/admin/_components/GlobalConfigs/GlobalConfigsModal.tsx index baf22766..fd1670c5 100644 --- a/src/FE/components/Admin/GlobalConfigs/GlobalConfigsModal.tsx +++ b/src/FE/pages/admin/_components/GlobalConfigs/GlobalConfigsModal.tsx @@ -33,7 +33,7 @@ interface IProps { saveLoading?: boolean; } -export const GlobalConfigsModal = (props: IProps) => { +const GlobalConfigsModal = (props: IProps) => { const { t } = useTranslation(); const { configKeys = [], selected, isOpen, onClose, onSuccessful } = props; const formFields: IFormFieldOption[] = [ @@ -158,3 +158,4 @@ export const GlobalConfigsModal = (props: IProps) => { ); }; +export default GlobalConfigsModal; diff --git a/src/FE/components/Admin/InvitationCode/InvitationCodeModal.tsx b/src/FE/pages/admin/_components/InvitationCode/InvitationCodeModal.tsx similarity index 97% rename from src/FE/components/Admin/InvitationCode/InvitationCodeModal.tsx rename to src/FE/pages/admin/_components/InvitationCode/InvitationCodeModal.tsx index b60ad431..c93c7c4c 100644 --- a/src/FE/components/Admin/InvitationCode/InvitationCodeModal.tsx +++ b/src/FE/pages/admin/_components/InvitationCode/InvitationCodeModal.tsx @@ -34,7 +34,7 @@ interface IProps { saveLoading?: boolean; } -export const InvitationCodeModal = (props: IProps) => { +const InvitationCodeModal = (props: IProps) => { const { t } = useTranslation(); const { selected, isOpen, onClose, onSuccessful } = props; const formFields: IFormFieldOption[] = [ @@ -137,3 +137,4 @@ export const InvitationCodeModal = (props: IProps) => { ); }; +export default InvitationCodeModal; diff --git a/src/FE/components/Admin/LoginService/LoginServiceModal.tsx b/src/FE/pages/admin/_components/LoginService/LoginServiceModal.tsx similarity index 98% rename from src/FE/components/Admin/LoginService/LoginServiceModal.tsx rename to src/FE/pages/admin/_components/LoginService/LoginServiceModal.tsx index 51201547..180581a1 100644 --- a/src/FE/components/Admin/LoginService/LoginServiceModal.tsx +++ b/src/FE/pages/admin/_components/LoginService/LoginServiceModal.tsx @@ -40,7 +40,7 @@ interface IProps { saveLoading?: boolean; } -export const LoginServiceModal = (props: IProps) => { +const LoginServiceModal = (props: IProps) => { const { t } = useTranslation(); const { selected, types, isOpen, onClose, onSuccessful } = props; const formFields: IFormFieldOption[] = [ @@ -169,3 +169,4 @@ export const LoginServiceModal = (props: IProps) => { ); }; +export default LoginServiceModal; diff --git a/src/FE/components/Admin/ModelKeys/ConfigModelModal.tsx b/src/FE/pages/admin/_components/ModelKeys/ConfigModelModal.tsx similarity index 98% rename from src/FE/components/Admin/ModelKeys/ConfigModelModal.tsx rename to src/FE/pages/admin/_components/ModelKeys/ConfigModelModal.tsx index 25c810a8..98916bba 100644 --- a/src/FE/components/Admin/ModelKeys/ConfigModelModal.tsx +++ b/src/FE/pages/admin/_components/ModelKeys/ConfigModelModal.tsx @@ -6,7 +6,7 @@ import useTranslation from '@/hooks/useTranslation'; import { DBModelProvider } from '@/types/model'; import { IconInfo } from '@/components/Icons'; -import Spinner from '@/components/Spinner'; +import Spinner from '@/components/Spinner/Spinner'; import Tips from '@/components/Tips/Tips'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; @@ -51,7 +51,7 @@ export interface PossibleModel { deploymentName: string | null; } -export const ConfigModelModal = (props: IProps) => { +const ConfigModelModal = (props: IProps) => { const { t } = useTranslation(); const { modelKeyId, modelProverId, isOpen, onClose } = props; const [models, setModels] = useState([]); @@ -235,3 +235,4 @@ export const ConfigModelModal = (props: IProps) => { ); }; +export default ConfigModelModal; diff --git a/src/FE/components/Admin/ModelKeys/ModelKeysModal.tsx b/src/FE/pages/admin/_components/ModelKeys/ModelKeysModal.tsx similarity index 95% rename from src/FE/components/Admin/ModelKeys/ModelKeysModal.tsx rename to src/FE/pages/admin/_components/ModelKeys/ModelKeysModal.tsx index 34eab153..8b1cd05f 100644 --- a/src/FE/components/Admin/ModelKeys/ModelKeysModal.tsx +++ b/src/FE/pages/admin/_components/ModelKeys/ModelKeysModal.tsx @@ -1,21 +1,17 @@ -import { Label } from '@radix-ui/react-dropdown-menu'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect } from 'react'; import { useForm } from 'react-hook-form'; import toast from 'react-hot-toast'; import useTranslation from '@/hooks/useTranslation'; import { - AutoCreateModelResult, GetModelKeysResult, ModelProviderInitialConfig, PostModelKeysParams, } from '@/types/adminApis'; import { feModelProviders } from '@/types/model'; -import { IconInfo } from '@/components/Icons'; -import Spinner from '@/components/Spinner'; -import Tips from '@/components/Tips/Tips'; +import Spinner from '@/components/Spinner/Spinner'; import { Button } from '@/components/ui/button'; import { Dialog, @@ -32,7 +28,6 @@ import FormTextarea from '@/components/ui/form/textarea'; import { deleteModelKeys, getModelProviderInitialConfig, - postAutoCreateModels, postModelKeys, putModelKeys, } from '@/apis/adminApis'; @@ -49,7 +44,7 @@ interface IProps { saveLoading?: boolean; } -export const ModelKeysModal = (props: IProps) => { +const ModelKeysModal = (props: IProps) => { const { t } = useTranslation(); const { selected, @@ -271,3 +266,4 @@ export const ModelKeysModal = (props: IProps) => { ); }; +export default ModelKeysModal; diff --git a/src/FE/components/Admin/Models/AddModelModal.tsx b/src/FE/pages/admin/_components/Models/AddModelModal.tsx similarity index 99% rename from src/FE/components/Admin/Models/AddModelModal.tsx rename to src/FE/pages/admin/_components/Models/AddModelModal.tsx index e6cabc1d..17ce1751 100644 --- a/src/FE/components/Admin/Models/AddModelModal.tsx +++ b/src/FE/pages/admin/_components/Models/AddModelModal.tsx @@ -47,7 +47,7 @@ interface IProps { saveLoading?: boolean; } -export const AddModelModal = (props: IProps) => { +const AddModelModal = (props: IProps) => { const { t } = useTranslation(); const [fileServices, setFileServices] = useState([]); const [modelVersions, setModelVersions] = useState( @@ -55,7 +55,6 @@ export const AddModelModal = (props: IProps) => { ); const [modelReference, setModelReference] = useState(); const { isOpen, onClose, onSuccessful, modelKeys } = props; - const [loading, setLoading] = useState(true); const formSchema = z.object({ modelReferenceId: z.string().default('0'), @@ -307,3 +306,4 @@ export const AddModelModal = (props: IProps) => { ); }; +export default AddModelModal; diff --git a/src/FE/components/Admin/Models/EditModelModal.tsx b/src/FE/pages/admin/_components/Models/EditModelModal.tsx similarity index 99% rename from src/FE/components/Admin/Models/EditModelModal.tsx rename to src/FE/pages/admin/_components/Models/EditModelModal.tsx index 60acc246..0b04c733 100644 --- a/src/FE/components/Admin/Models/EditModelModal.tsx +++ b/src/FE/pages/admin/_components/Models/EditModelModal.tsx @@ -43,7 +43,7 @@ interface IProps { saveLoading?: boolean; } -export const EditModelModal = (props: IProps) => { +const EditModelModal = (props: IProps) => { const { t } = useTranslation(); const { isOpen, onClose, selected, onSuccessful, modelKeys } = props; const [fileServices, setFileServices] = useState([]); @@ -329,3 +329,4 @@ export const EditModelModal = (props: IProps) => { ); }; +export default EditModelModal; diff --git a/src/FE/components/Admin/Nav/Nav.tsx b/src/FE/pages/admin/_components/Nav/Nav.tsx similarity index 96% rename from src/FE/components/Admin/Nav/Nav.tsx rename to src/FE/pages/admin/_components/Nav/Nav.tsx index 01b5d22d..02a02a3d 100644 --- a/src/FE/components/Admin/Nav/Nav.tsx +++ b/src/FE/pages/admin/_components/Nav/Nav.tsx @@ -17,7 +17,7 @@ interface NavProps { menus: IMenu[]; } -export function Nav({ menus }: NavProps) { +function Nav({ menus }: NavProps) { const router = useRouter(); const active = (link: IMenu) => { const { url } = link; @@ -52,3 +52,4 @@ export function Nav({ menus }: NavProps) {
); } +export default Nav; diff --git a/src/FE/components/Admin/Pagiation/Pagiation.tsx b/src/FE/pages/admin/_components/Pagiation/Pagiation.tsx similarity index 100% rename from src/FE/components/Admin/Pagiation/Pagiation.tsx rename to src/FE/pages/admin/_components/Pagiation/Pagiation.tsx diff --git a/src/FE/components/Admin/PayService/PayServiceModal.tsx b/src/FE/pages/admin/_components/PayService/PayServiceModal.tsx similarity index 98% rename from src/FE/components/Admin/PayService/PayServiceModal.tsx rename to src/FE/pages/admin/_components/PayService/PayServiceModal.tsx index a0456d56..656648b2 100644 --- a/src/FE/components/Admin/PayService/PayServiceModal.tsx +++ b/src/FE/pages/admin/_components/PayService/PayServiceModal.tsx @@ -41,7 +41,7 @@ interface IProps { saveLoading?: boolean; } -export const PayServiceModal = (props: IProps) => { +const PayServiceModal = (props: IProps) => { const { t } = useTranslation(); const { selected, types, isOpen, onClose, onSuccessful } = props; const formFields: IFormFieldOption[] = [ @@ -181,3 +181,4 @@ export const PayServiceModal = (props: IProps) => { ); }; +export default PayServiceModal; diff --git a/src/FE/components/Admin/RequestLogs/RequestLogDetailsModal.tsx b/src/FE/pages/admin/_components/RequestLogs/RequestLogDetailsModal.tsx similarity index 97% rename from src/FE/components/Admin/RequestLogs/RequestLogDetailsModal.tsx rename to src/FE/pages/admin/_components/RequestLogs/RequestLogDetailsModal.tsx index 7f842ea7..74040301 100644 --- a/src/FE/components/Admin/RequestLogs/RequestLogDetailsModal.tsx +++ b/src/FE/pages/admin/_components/RequestLogs/RequestLogDetailsModal.tsx @@ -19,7 +19,7 @@ interface IProps { onClose: () => void; } -export const RequestLogDetailsModal = (props: IProps) => { +const RequestLogDetailsModal = (props: IProps) => { const { t } = useTranslation(); const { isOpen, onClose } = props; const [log, setLog] = useState(); @@ -111,3 +111,4 @@ export const RequestLogDetailsModal = (props: IProps) => { ); }; +export default RequestLogDetailsModal; diff --git a/src/FE/components/Admin/Users/EditUserBalanceModel.tsx b/src/FE/pages/admin/_components/Users/EditUserBalanceModel.tsx similarity index 97% rename from src/FE/components/Admin/Users/EditUserBalanceModel.tsx rename to src/FE/pages/admin/_components/Users/EditUserBalanceModel.tsx index 81708620..0000b686 100644 --- a/src/FE/components/Admin/Users/EditUserBalanceModel.tsx +++ b/src/FE/pages/admin/_components/Users/EditUserBalanceModel.tsx @@ -29,7 +29,7 @@ interface IProps { onSuccessful: () => void; } -export const EditUserBalanceModal = (props: IProps) => { +const EditUserBalanceModal = (props: IProps) => { const { t } = useTranslation(); const { userId, userBalance, isOpen, onClose, onSuccessful } = props; const [loading, setLoading] = useState(false); @@ -117,3 +117,5 @@ export const EditUserBalanceModal = (props: IProps) => { ); }; + +export default EditUserBalanceModal; diff --git a/src/FE/components/Admin/Users/EditUserModelModal.tsx b/src/FE/pages/admin/_components/Users/EditUserModelModal.tsx similarity index 97% rename from src/FE/components/Admin/Users/EditUserModelModal.tsx rename to src/FE/pages/admin/_components/Users/EditUserModelModal.tsx index 9f862d6e..23390530 100644 --- a/src/FE/components/Admin/Users/EditUserModelModal.tsx +++ b/src/FE/pages/admin/_components/Users/EditUserModelModal.tsx @@ -5,7 +5,7 @@ import useTranslation from '@/hooks/useTranslation'; import { termDateString } from '@/utils/common'; -import { UserModelDisplay, UserModelDisplayDto } from '@/types/adminApis'; +import { UserModelDisplay } from '@/types/adminApis'; import { IconSquareRoundedX } from '@/components/Icons'; import { Button } from '@/components/ui/button'; @@ -42,7 +42,7 @@ interface IProps { onClose: () => void; onSuccessful: () => void; } -export const EditUserModelModal = (props: IProps) => { +const EditUserModelModal = (props: IProps) => { const { t } = useTranslation(); const { isOpen, onClose, onSuccessful } = props; const [submit, setSubmit] = useState(false); @@ -184,3 +184,4 @@ export const EditUserModelModal = (props: IProps) => { ); }; +export default EditUserModelModal; diff --git a/src/FE/components/Admin/Users/UserInitialConfigModal.tsx b/src/FE/pages/admin/_components/Users/UserInitialConfigModal.tsx similarity index 99% rename from src/FE/components/Admin/Users/UserInitialConfigModal.tsx rename to src/FE/pages/admin/_components/Users/UserInitialConfigModal.tsx index c12a9eac..3ddae90b 100644 --- a/src/FE/components/Admin/Users/UserInitialConfigModal.tsx +++ b/src/FE/pages/admin/_components/Users/UserInitialConfigModal.tsx @@ -62,7 +62,7 @@ interface IProps { onSuccessful: () => void; } let ModelKeyMap = {} as any; -export const UserInitialConfigModal = (props: IProps) => { +const UserInitialConfigModal = (props: IProps) => { const { t } = useTranslation(); const { models, isOpen, select, onClose, onSuccessful } = props; const [submit, setSubmit] = useState(false); @@ -371,3 +371,4 @@ export const UserInitialConfigModal = (props: IProps) => { ); }; +export default UserInitialConfigModal; diff --git a/src/FE/components/Admin/Users/UserModal.tsx b/src/FE/pages/admin/_components/Users/UserModal.tsx similarity index 98% rename from src/FE/components/Admin/Users/UserModal.tsx rename to src/FE/pages/admin/_components/Users/UserModal.tsx index 2d651c43..2ffc4f45 100644 --- a/src/FE/components/Admin/Users/UserModal.tsx +++ b/src/FE/pages/admin/_components/Users/UserModal.tsx @@ -42,7 +42,7 @@ const ROLES = [ }, ]; -export const UserModal = (props: IProps) => { +const UserModal = (props: IProps) => { const { t } = useTranslation(); const { user, isOpen, onClose, onSuccessful } = props; const [submit, setSubmit] = useState(false); @@ -206,3 +206,4 @@ export const UserModal = (props: IProps) => { ); }; +export default UserModal; diff --git a/src/FE/pages/admin/file-service/index.tsx b/src/FE/pages/admin/file-service/index.tsx index a0b5b3bf..5977b0df 100644 --- a/src/FE/pages/admin/file-service/index.tsx +++ b/src/FE/pages/admin/file-service/index.tsx @@ -4,7 +4,6 @@ import useTranslation from '@/hooks/useTranslation'; import { GetFileServicesResult } from '@/types/adminApis'; -import { FileServiceModal } from '@/components/Admin/Files/FileServiceModal'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { @@ -16,6 +15,8 @@ import { TableRow, } from '@/components/ui/table'; +import FileServiceModal from '../_components/Files/FileServiceModal'; + import { getFileServices } from '@/apis/adminApis'; export default function FileService() { diff --git a/src/FE/pages/admin/global-configs/index.tsx b/src/FE/pages/admin/global-configs/index.tsx index 4a9d69cd..55c386c6 100644 --- a/src/FE/pages/admin/global-configs/index.tsx +++ b/src/FE/pages/admin/global-configs/index.tsx @@ -4,7 +4,6 @@ import useTranslation from '@/hooks/useTranslation'; import { GetConfigsResult } from '@/types/adminApis'; -import { GlobalConfigsModal } from '@/components/Admin/GlobalConfigs/GlobalConfigsModal'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { @@ -16,6 +15,8 @@ import { TableRow, } from '@/components/ui/table'; +import GlobalConfigsModal from '../_components/GlobalConfigs/GlobalConfigsModal'; + import { getConfigs } from '@/apis/adminApis'; export default function Configs() { diff --git a/src/FE/pages/admin/index.tsx b/src/FE/pages/admin/index.tsx index 6244318f..80d68452 100644 --- a/src/FE/pages/admin/index.tsx +++ b/src/FE/pages/admin/index.tsx @@ -19,4 +19,4 @@ const Dashboard = () => { ); }; -export default Dashboard; \ No newline at end of file +export default Dashboard; diff --git a/src/FE/pages/admin/invitation-code/index.tsx b/src/FE/pages/admin/invitation-code/index.tsx index b6cefa87..ea458baf 100644 --- a/src/FE/pages/admin/invitation-code/index.tsx +++ b/src/FE/pages/admin/invitation-code/index.tsx @@ -4,7 +4,6 @@ import useTranslation from '@/hooks/useTranslation'; import { GetInvitationCodeResult } from '@/types/adminApis'; -import { InvitationCodeModal } from '@/components/Admin/InvitationCode/InvitationCodeModal'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { @@ -16,6 +15,8 @@ import { TableRow, } from '@/components/ui/table'; +import InvitationCodeModal from '../_components/InvitationCode/InvitationCodeModal'; + import { getInvitationCode } from '@/apis/adminApis'; export default function InvitationCode() { diff --git a/src/FE/pages/admin/layout/index.tsx b/src/FE/pages/admin/layout/index.tsx index 520d03cb..0cf8ca5d 100644 --- a/src/FE/pages/admin/layout/index.tsx +++ b/src/FE/pages/admin/layout/index.tsx @@ -6,7 +6,6 @@ import { useRouter } from 'next/router'; import useTranslation from '@/hooks/useTranslation'; -import { Nav } from '@/components/Admin/Nav/Nav'; import { IconFiles, IconIdBadge, @@ -20,6 +19,8 @@ import { IconUsers, } from '@/components/Icons/index'; +import Nav from '../_components/Nav/Nav'; + const AdminLayout = ({ children, }: { diff --git a/src/FE/pages/admin/login-service/index.tsx b/src/FE/pages/admin/login-service/index.tsx index 377a172e..a7910f99 100644 --- a/src/FE/pages/admin/login-service/index.tsx +++ b/src/FE/pages/admin/login-service/index.tsx @@ -2,11 +2,8 @@ import React, { useEffect, useState } from 'react'; import useTranslation from '@/hooks/useTranslation'; -import { DEFAULT_LANGUAGE } from '@/utils/settings'; - import { GetLoginServicesResult } from '@/types/adminApis'; -import { LoginServiceModal } from '@/components/Admin/LoginService/LoginServiceModal'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { @@ -18,6 +15,8 @@ import { TableRow, } from '@/components/ui/table'; +import LoginServiceModal from '../_components/LoginService/LoginServiceModal'; + import { getLoginServices } from '@/apis/adminApis'; export default function LoginService() { diff --git a/src/FE/pages/admin/messages/index.tsx b/src/FE/pages/admin/messages/index.tsx index f2a704bf..37387d9c 100644 --- a/src/FE/pages/admin/messages/index.tsx +++ b/src/FE/pages/admin/messages/index.tsx @@ -2,12 +2,9 @@ import React, { useEffect, useState } from 'react'; import useTranslation from '@/hooks/useTranslation'; -import { DEFAULT_LANGUAGE } from '@/utils/settings'; - import { GetUserMessageResult } from '@/types/adminApis'; import { PageResult, Paging } from '@/types/page'; -import PaginationContainer from '@/components/Admin/Pagiation/Pagiation'; import { Badge } from '@/components/ui/badge'; import { Card } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; @@ -20,6 +17,8 @@ import { TableRow, } from '@/components/ui/table'; +import PaginationContainer from '../_components/Pagiation/Pagiation'; + import { getMessages } from '@/apis/adminApis'; export default function Messages() { diff --git a/src/FE/pages/admin/model-keys/index.tsx b/src/FE/pages/admin/model-keys/index.tsx index fdef4628..4596373d 100644 --- a/src/FE/pages/admin/model-keys/index.tsx +++ b/src/FE/pages/admin/model-keys/index.tsx @@ -6,8 +6,6 @@ import useTranslation from '@/hooks/useTranslation'; import { GetModelKeysResult } from '@/types/adminApis'; import { feModelProviders } from '@/types/model'; -import { ConfigModelModal } from '@/components/Admin/ModelKeys/ConfigModelModal'; -import { ModelKeysModal } from '@/components/Admin/ModelKeys/ModelKeysModal'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { @@ -19,6 +17,9 @@ import { TableRow, } from '@/components/ui/table'; +import ConfigModelModal from '../_components/ModelKeys/ConfigModelModal'; +import ModelKeysModal from '../_components/ModelKeys/ModelKeysModal'; + import { getModelKeys } from '@/apis/adminApis'; export default function ModelKeys() { diff --git a/src/FE/pages/admin/models/index.tsx b/src/FE/pages/admin/models/index.tsx index 24cbafa1..d358f2c6 100644 --- a/src/FE/pages/admin/models/index.tsx +++ b/src/FE/pages/admin/models/index.tsx @@ -5,9 +5,8 @@ import useTranslation from '@/hooks/useTranslation'; import { formatNumberAsMoney } from '@/utils/common'; import { AdminModelDto, GetModelKeysResult } from '@/types/adminApis'; +import { feModelProviders } from '@/types/model'; -import { AddModelModal } from '@/components/Admin/Models/AddModelModal'; -import { EditModelModal } from '@/components/Admin/Models/EditModelModal'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { @@ -19,8 +18,10 @@ import { TableRow, } from '@/components/ui/table'; +import AddModelModal from '../_components/Models/AddModelModal'; +import EditModelModal from '../_components/Models/EditModelModal'; + import { getModelKeys, getModels } from '@/apis/adminApis'; -import { feModelProviders } from '@/types/model'; export default function Models() { const { t } = useTranslation(); @@ -65,7 +66,9 @@ export default function Models() {
); }; +export default ChatInput; diff --git a/src/FE/components/Chat/EnableNetworkSearch.tsx b/src/FE/pages/home/_components/Chat/EnableNetworkSearch.tsx similarity index 100% rename from src/FE/components/Chat/EnableNetworkSearch.tsx rename to src/FE/pages/home/_components/Chat/EnableNetworkSearch.tsx diff --git a/src/FE/pages/home/_components/Chat/MemoizedChatMessage.tsx b/src/FE/pages/home/_components/Chat/MemoizedChatMessage.tsx new file mode 100644 index 00000000..1384e5cd --- /dev/null +++ b/src/FE/pages/home/_components/Chat/MemoizedChatMessage.tsx @@ -0,0 +1,12 @@ +import { FC, memo } from 'react'; + +import { ChatMessage, Props } from '@/components/ChatMessage'; + +const MemoizedChatMessage: FC = memo( + ChatMessage, + (prevProps, nextProps) => + prevProps.message.content === nextProps.message.content && + prevProps.messageIsStreaming === nextProps.messageIsStreaming, +); + +export default MemoizedChatMessage; diff --git a/src/FE/components/Chat/ModelSelect.tsx b/src/FE/pages/home/_components/Chat/ModelSelect.tsx similarity index 65% rename from src/FE/components/Chat/ModelSelect.tsx rename to src/FE/pages/home/_components/Chat/ModelSelect.tsx index 1bc843de..6a4c6ade 100644 --- a/src/FE/components/Chat/ModelSelect.tsx +++ b/src/FE/pages/home/_components/Chat/ModelSelect.tsx @@ -6,23 +6,15 @@ import { formatNumberAsMoney } from '@/utils/common'; import { ModelUsageDto } from '@/types/clientApis'; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from '../ui/select'; +import HomeContext from '../../_contents/Home.context'; import { getModelUsage } from '@/apis/clientApis'; -import { HomeContext } from '@/contexts/Home.context'; -export const ModelSelect = () => { +const ModelSelect = () => { const { t } = useTranslation(); const { - state: { selectModel, models }, - handleSelectModel, + state: { selectModel }, } = useContext(HomeContext); const [modelUsage, setModelUsage] = useState(); @@ -34,16 +26,6 @@ export const ModelSelect = () => { } }, [selectModel]); - const handleChange = (value: string) => { - const model = models.find((m) => m.modelId.toString() == value); - if (!model) return; - - handleSelectModel(model); - getModelUsage(model.modelId).then((res) => { - setModelUsage(res); - }); - }; - const getTitle = () => { if (modelUsage) { if (modelUsage.tokens === 0 && modelUsage.counts === 0) { @@ -64,24 +46,6 @@ export const ModelSelect = () => { - {/*
- -
*/} {modelUsage && modelUsage.tokens === 0 && modelUsage.counts === 0 ? ( ¥{modelUsage.inputTokenPrice1M.toFixed(4)}/ @@ -120,3 +84,5 @@ export const ModelSelect = () => {
); }; + +export default ModelSelect; diff --git a/src/FE/components/Chat/NoModel.tsx b/src/FE/pages/home/_components/Chat/NoModel.tsx similarity index 93% rename from src/FE/components/Chat/NoModel.tsx rename to src/FE/pages/home/_components/Chat/NoModel.tsx index 0bb7c01b..396b1f9a 100644 --- a/src/FE/components/Chat/NoModel.tsx +++ b/src/FE/pages/home/_components/Chat/NoModel.tsx @@ -1,6 +1,6 @@ import useTranslation from '@/hooks/useTranslation'; -import { IconModelSearch } from '../Icons'; +import { IconModelSearch } from '@/components/Icons'; const NoModel = () => { const { t } = useTranslation(); diff --git a/src/FE/components/Chat/PromptList.tsx b/src/FE/pages/home/_components/Chat/PromptList.tsx similarity index 92% rename from src/FE/components/Chat/PromptList.tsx rename to src/FE/pages/home/_components/Chat/PromptList.tsx index 3b008083..d50b8e34 100644 --- a/src/FE/components/Chat/PromptList.tsx +++ b/src/FE/pages/home/_components/Chat/PromptList.tsx @@ -1,4 +1,4 @@ -import { ForwardedRef, MutableRefObject, forwardRef } from 'react'; +import { MutableRefObject } from 'react'; import { Prompt } from '@/types/prompt'; @@ -10,7 +10,7 @@ interface Props { promptListRef: MutableRefObject; } -export const PromptList = ({ +const PromptList = ({ prompts, activePromptIndex, promptListRef, @@ -43,3 +43,5 @@ export const PromptList = ({ ); }; + +export default PromptList; diff --git a/src/FE/components/Chat/SharedMessageModal.tsx b/src/FE/pages/home/_components/Chat/SharedMessageModal.tsx similarity index 96% rename from src/FE/components/Chat/SharedMessageModal.tsx rename to src/FE/pages/home/_components/Chat/SharedMessageModal.tsx index a539747b..13925391 100644 --- a/src/FE/components/Chat/SharedMessageModal.tsx +++ b/src/FE/pages/home/_components/Chat/SharedMessageModal.tsx @@ -23,7 +23,7 @@ interface IProps { onShareChange: (isShared: boolean) => void; } -export const SharedMessageModal = (props: IProps) => { +const SharedMessageModal = (props: IProps) => { const { t } = useTranslation(); const { chat, isOpen, onClose, onShareChange } = props; const [loading, setLoading] = useState(false); @@ -104,3 +104,4 @@ export const SharedMessageModal = (props: IProps) => { ); }; +export default SharedMessageModal; diff --git a/src/FE/components/Chat/SystemPrompt.tsx b/src/FE/pages/home/_components/Chat/SystemPrompt.tsx similarity index 95% rename from src/FE/components/Chat/SystemPrompt.tsx rename to src/FE/pages/home/_components/Chat/SystemPrompt.tsx index 478360ba..e2509911 100644 --- a/src/FE/components/Chat/SystemPrompt.tsx +++ b/src/FE/pages/home/_components/Chat/SystemPrompt.tsx @@ -9,24 +9,25 @@ import { import useTranslation from '@/hooks/useTranslation'; +import { formatPrompt } from '@/utils/promptVariable'; + +import { AdminModelDto } from '@/types/adminApis'; import { Prompt } from '@/types/prompt'; -import { PromptList } from './PromptList'; -import { VariableModal } from './VariableModal'; +import PromptList from './PromptList'; +import VariableModal from './VariableModal'; import { getUserPromptDetail } from '@/apis/clientApis'; -import { formatPrompt } from '@/utils/promptVariable'; -import { AdminModelDto } from '@/types/adminApis'; interface Props { currentPrompt: string; prompts: Prompt[]; - model: AdminModelDto, + model: AdminModelDto; onChangePromptText: (prompt: string) => void; onChangePrompt: (prompt: Prompt) => void; } -export const SystemPrompt: FC = ({ +const SystemPrompt: FC = ({ currentPrompt, prompts, model, @@ -196,10 +197,11 @@ export const SystemPrompt: FC = ({ resize: 'none', bottom: `${textareaRef?.current?.scrollHeight}px`, maxHeight: '300px', - overflow: `${textareaRef.current && textareaRef.current.scrollHeight > 400 + overflow: `${ + textareaRef.current && textareaRef.current.scrollHeight > 400 ? 'auto' : 'hidden' - }`, + }`, }} placeholder={ t(`Enter a prompt or type "/" to select a prompt...`) || '' @@ -233,3 +235,5 @@ export const SystemPrompt: FC = ({
); }; + +export default SystemPrompt; diff --git a/src/FE/components/Chat/VariableModal.tsx b/src/FE/pages/home/_components/Chat/VariableModal.tsx similarity index 96% rename from src/FE/components/Chat/VariableModal.tsx rename to src/FE/pages/home/_components/Chat/VariableModal.tsx index d989bea8..34f36edc 100644 --- a/src/FE/components/Chat/VariableModal.tsx +++ b/src/FE/pages/home/_components/Chat/VariableModal.tsx @@ -21,12 +21,7 @@ interface Props { onClose: () => void; } -export const VariableModal: FC = ({ - prompt, - variables, - onSubmit, - onClose, -}) => { +const VariableModal: FC = ({ prompt, variables, onSubmit, onClose }) => { const { t } = useTranslation(); const [updatedVariables, setUpdatedVariables] = useState< { key: string; value: string }[] @@ -112,3 +107,5 @@ export const VariableModal: FC = ({ ); }; + +export default VariableModal; diff --git a/src/FE/components/ChatSettings/ChatSettings.tsx b/src/FE/pages/home/_components/ChatSettings/ChatSettings.tsx similarity index 100% rename from src/FE/components/ChatSettings/ChatSettings.tsx rename to src/FE/pages/home/_components/ChatSettings/ChatSettings.tsx diff --git a/src/FE/components/ChatSettings/ChatSettingsBar.tsx b/src/FE/pages/home/_components/ChatSettings/ChatSettingsBar.tsx similarity index 88% rename from src/FE/components/ChatSettings/ChatSettingsBar.tsx rename to src/FE/pages/home/_components/ChatSettings/ChatSettingsBar.tsx index 2d932f50..54a59091 100644 --- a/src/FE/components/ChatSettings/ChatSettingsBar.tsx +++ b/src/FE/pages/home/_components/ChatSettings/ChatSettingsBar.tsx @@ -1,9 +1,8 @@ -import { useContext, useEffect, useState } from 'react'; +import { useContext, useState } from 'react'; -import { HomeContext } from '@/contexts/Home.context'; +import { IconX } from '@/components/Icons'; -import { IconX } from '../Icons'; -import ChatSettings from './ChatSettings'; +import HomeContext from '../../_contents/Home.context'; import SliderSetting from './SliderSetting'; const ChatSettingsBar = () => { diff --git a/src/FE/components/ChatSettings/SliderSetting.tsx b/src/FE/pages/home/_components/ChatSettings/SliderSetting.tsx similarity index 100% rename from src/FE/components/ChatSettings/SliderSetting.tsx rename to src/FE/pages/home/_components/ChatSettings/SliderSetting.tsx diff --git a/src/FE/components/Chatbar/Chatbar.context.tsx b/src/FE/pages/home/_components/Chatbar/Chatbar.context.tsx similarity index 61% rename from src/FE/components/Chatbar/Chatbar.context.tsx rename to src/FE/pages/home/_components/Chatbar/Chatbar.context.tsx index 15f38cf1..c21f11db 100644 --- a/src/FE/components/Chatbar/Chatbar.context.tsx +++ b/src/FE/pages/home/_components/Chatbar/Chatbar.context.tsx @@ -2,13 +2,22 @@ import { Dispatch, createContext } from 'react'; import { ActionType } from '@/hooks/useCreateReducer'; -import { ChatbarInitialState } from './Chatbar.state'; +import { ChatResult } from '@/types/clientApis'; export interface ChatbarContextProps { state: ChatbarInitialState; dispatch: Dispatch>; handleDeleteChat: (chatId: string) => void; } +export interface ChatbarInitialState { + searchTerm: string; + filteredChats: ChatResult[]; +} + +export const initialState: ChatbarInitialState = { + searchTerm: '', + filteredChats: [], +}; const ChatbarContext = createContext(undefined!); diff --git a/src/FE/components/Chatbar/Chatbar.tsx b/src/FE/pages/home/_components/Chatbar/Chatbar.tsx similarity index 89% rename from src/FE/components/Chatbar/Chatbar.tsx rename to src/FE/pages/home/_components/Chatbar/Chatbar.tsx index 2701aa2e..357c078c 100644 --- a/src/FE/components/Chatbar/Chatbar.tsx +++ b/src/FE/pages/home/_components/Chatbar/Chatbar.tsx @@ -7,16 +7,14 @@ import { removeSelectChatId, saveSelectChatId } from '@/utils/chats'; import { ChatResult } from '@/types/clientApis'; -import Sidebar from '@/components/Sidebar'; - +import HomeContext from '../../_contents/Home.context'; +import Sidebar from '../Sidebar/Sidebar'; import ChatbarContext from './Chatbar.context'; -import { ChatbarInitialState, initialState } from './Chatbar.state'; -import { ChatBarSettings } from './ChatbarSettings'; -import { Conversations } from './Conversations'; - -import { HomeContext } from '@/contexts/Home.context'; +import { ChatbarInitialState, initialState } from './Chatbar.context'; +import ChatBarSettings from './ChatbarSettings'; +import Conversations from './Conversations'; -export const Chatbar = () => { +const Chatbar = () => { const { t } = useTranslation(); const chatBarContextValue = useCreateReducer({ @@ -102,3 +100,4 @@ export const Chatbar = () => { ); }; +export default Chatbar; diff --git a/src/FE/components/Chatbar/ChatbarSettings.tsx b/src/FE/pages/home/_components/Chatbar/ChatbarSettings.tsx similarity index 91% rename from src/FE/components/Chatbar/ChatbarSettings.tsx rename to src/FE/pages/home/_components/Chatbar/ChatbarSettings.tsx index 713af4d9..99ff4f53 100644 --- a/src/FE/components/Chatbar/ChatbarSettings.tsx +++ b/src/FE/pages/home/_components/Chatbar/ChatbarSettings.tsx @@ -17,10 +17,6 @@ import { IconSettingsCog, IconUser, } from '@/components/Icons/index'; -import { ChangePasswordModal } from '@/components/Modal/ChangePasswordModal'; -import UserBalanceModal from '@/components/Modal/UserBalanceModal'; -import { SettingModal } from '@/components/Settings/SettingModal'; -import { SidebarButton } from '@/components/Sidebar/SidebarButton'; import { Popover, PopoverContent, @@ -28,10 +24,15 @@ import { } from '@/components/ui/popover'; import { Separator } from '@/components/ui/separator'; +import HomeContext from '../../_contents/Home.context'; +import ChangePasswordModal from '../Modal/ChangePasswordModal'; +import UserBalanceModal from '../Modal/UserBalanceModal'; +import SettingModal from '../Settings/SettingModal'; +import SidebarButton from '../Sidebar/SidebarButton'; + import { getUserBalanceOnly } from '@/apis/clientApis'; -import { HomeContext } from '@/contexts/Home.context'; -export const ChatBarSettings = () => { +const ChatBarSettings = () => { const router = useRouter(); const { t } = useTranslation(); const [changePwdModalOpen, setChangePwdModalOpen] = useState(false); @@ -153,3 +154,4 @@ export const ChatBarSettings = () => {
); }; +export default ChatBarSettings; diff --git a/src/FE/components/Chatbar/ClearConversations.tsx b/src/FE/pages/home/_components/Chatbar/ClearConversations.tsx similarity index 89% rename from src/FE/components/Chatbar/ClearConversations.tsx rename to src/FE/pages/home/_components/Chatbar/ClearConversations.tsx index 1989ac88..fb4bfc32 100644 --- a/src/FE/components/Chatbar/ClearConversations.tsx +++ b/src/FE/pages/home/_components/Chatbar/ClearConversations.tsx @@ -3,13 +3,14 @@ import { FC, useState } from 'react'; import useTranslation from '@/hooks/useTranslation'; import { IconCheck, IconTrash, IconX } from '@/components/Icons/index'; -import { SidebarButton } from '@/components/Sidebar/SidebarButton'; + +import SidebarButton from '../Sidebar/SidebarButton'; interface Props { onClearConversations: () => void; } -export const ClearConversations: FC = ({ onClearConversations }) => { +const ClearConversations: FC = ({ onClearConversations }) => { const [isConfirming, setIsConfirming] = useState(false); const { t } = useTranslation(); @@ -55,3 +56,5 @@ export const ClearConversations: FC = ({ onClearConversations }) => { /> ); }; + +export default ClearConversations; diff --git a/src/FE/components/Chatbar/Conversation.tsx b/src/FE/pages/home/_components/Chatbar/Conversation.tsx similarity index 94% rename from src/FE/components/Chatbar/Conversation.tsx rename to src/FE/pages/home/_components/Chatbar/Conversation.tsx index f2d11585..895e04a8 100644 --- a/src/FE/components/Chatbar/Conversation.tsx +++ b/src/FE/pages/home/_components/Chatbar/Conversation.tsx @@ -10,12 +10,9 @@ import toast from 'react-hot-toast'; import useTranslation from '@/hooks/useTranslation'; import { ChatResult } from '@/types/clientApis'; -import { DBModelProvider } from '@/types/model'; import SidebarActionButton from '@/components/Button/SidebarActionButton'; -import { SharedMessageModal } from '@/components/Chat/SharedMessageModal'; import ChatIcon from '@/components/ChatIcon/ChatIcon'; -import ChatbarContext from '@/components/Chatbar/Chatbar.context'; import { IconCheck, IconDots, @@ -24,7 +21,6 @@ import { IconTrash, IconX, } from '@/components/Icons/index'; -import { Button } from '@/components/ui/button'; import { DropdownMenu, DropdownMenuContent, @@ -32,14 +28,17 @@ import { DropdownMenuTrigger, } from '@/components/ui/dropdown-menu'; +import HomeContext from '../../_contents/Home.context'; +import SharedMessageModal from '../Chat/SharedMessageModal'; +import ChatbarContext from '../Chatbar/Chatbar.context'; + import { deleteChats, putChats } from '@/apis/clientApis'; -import { HomeContext } from '@/contexts/Home.context'; interface Props { chat: ChatResult; } -export const ConversationComponent = ({ chat }: Props) => { +const ConversationComponent = ({ chat }: Props) => { const { t } = useTranslation(); const { state: { @@ -215,3 +214,5 @@ export const ConversationComponent = ({ chat }: Props) => { ); }; + +export default ConversationComponent; diff --git a/src/FE/components/Chatbar/Conversations.tsx b/src/FE/pages/home/_components/Chatbar/Conversations.tsx similarity index 85% rename from src/FE/components/Chatbar/Conversations.tsx rename to src/FE/pages/home/_components/Chatbar/Conversations.tsx index 2c552378..c4c3b0d0 100644 --- a/src/FE/components/Chatbar/Conversations.tsx +++ b/src/FE/pages/home/_components/Chatbar/Conversations.tsx @@ -4,17 +4,16 @@ import useTranslation from '@/hooks/useTranslation'; import { ChatResult } from '@/types/clientApis'; -import { HomeContext } from '@/contexts/Home.context'; - import { Button } from '@/components/ui/button'; -import { ConversationComponent } from './Conversation'; +import HomeContext from '../../_contents/Home.context'; +import ConversationComponent from './Conversation'; interface Props { chats: ChatResult[]; } -export const Conversations = ({ chats }: Props) => { +const Conversations = ({ chats }: Props) => { const { t } = useTranslation(); const { state: { chatsPaging }, @@ -46,3 +45,4 @@ export const Conversations = ({ chats }: Props) => { ); }; +export default Conversations; diff --git a/src/FE/components/HomeContent/HomeContent.tsx b/src/FE/pages/home/_components/HomeContent/HomeContent.tsx similarity index 96% rename from src/FE/components/HomeContent/HomeContent.tsx rename to src/FE/pages/home/_components/HomeContent/HomeContent.tsx index 49b60c72..251703e9 100644 --- a/src/FE/components/HomeContent/HomeContent.tsx +++ b/src/FE/pages/home/_components/HomeContent/HomeContent.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef } from 'react'; +import { useEffect } from 'react'; import { useRouter } from 'next/router'; @@ -22,11 +22,17 @@ import { DEFAULT_TEMPERATURE, IChat, Role } from '@/types/chat'; import { ChatMessage } from '@/types/chatMessage'; import { ChatResult, GetChatsParams } from '@/types/clientApis'; -import { Chat } from '@/components/Chat/Chat'; -import ChatSettingsBar from '@/components/ChatSettings/ChatSettingsBar'; -import { Chatbar } from '@/components/Chatbar/Chatbar'; -import PromptBar from '@/components/Promptbar'; -import Spinner from '@/components/Spinner'; +import Spinner from '@/components/Spinner/Spinner'; + +import HomeContext, { + HandleUpdateChatParams, + HomeInitialState, + initialState, +} from '../../_contents/Home.context'; +import Chat from '../Chat/Chat'; +import ChatSettingsBar from '../ChatSettings/ChatSettingsBar'; +import Chatbar from '../Chatbar/Chatbar'; +import PromptBar from '../Promptbar/Promptbar'; import { getChatsByPaging, @@ -36,12 +42,6 @@ import { getUserPromptBrief, postChats, } from '@/apis/clientApis'; -import { - HandleUpdateChatParams, - HomeContext, - HomeInitialState, - initialState, -} from '@/contexts/Home.context'; import Decimal from 'decimal.js'; import { v4 as uuidv4 } from 'uuid'; @@ -103,7 +103,7 @@ const HomeContent = () => { data.temperature ?? userModelConfig?.temperature ?? DEFAULT_TEMPERATURE, - prompt: data.content, + prompt: formatPrompt(data.content, { model }), }); }); }; diff --git a/src/FE/components/Modal/ChangePasswordModal.tsx b/src/FE/pages/home/_components/Modal/ChangePasswordModal.tsx similarity index 98% rename from src/FE/components/Modal/ChangePasswordModal.tsx rename to src/FE/pages/home/_components/Modal/ChangePasswordModal.tsx index ae833119..a7ecf701 100644 --- a/src/FE/components/Modal/ChangePasswordModal.tsx +++ b/src/FE/pages/home/_components/Modal/ChangePasswordModal.tsx @@ -29,7 +29,7 @@ interface Props { onClose: () => void; } -export const ChangePasswordModal = (props: Props) => { +const ChangePasswordModal = (props: Props) => { const { isOpen, onClose } = props; const { t } = useTranslation(); const router = useRouter(); @@ -159,3 +159,4 @@ export const ChangePasswordModal = (props: Props) => { ); }; +export default ChangePasswordModal; diff --git a/src/FE/components/Modal/UserBalanceModal.tsx b/src/FE/pages/home/_components/Modal/UserBalanceModal.tsx similarity index 100% rename from src/FE/components/Modal/UserBalanceModal.tsx rename to src/FE/pages/home/_components/Modal/UserBalanceModal.tsx diff --git a/src/FE/components/ModeToggle/ModeTooggle.tsx b/src/FE/pages/home/_components/ModeToggle/ModeToggle.tsx similarity index 92% rename from src/FE/components/ModeToggle/ModeTooggle.tsx rename to src/FE/pages/home/_components/ModeToggle/ModeToggle.tsx index fc6cb780..5c4ad186 100644 --- a/src/FE/components/ModeToggle/ModeTooggle.tsx +++ b/src/FE/pages/home/_components/ModeToggle/ModeToggle.tsx @@ -7,7 +7,7 @@ import { useTheme } from 'next-themes'; import { IconMoon, IconSun } from '@/components/Icons'; import { Button } from '@/components/ui/button'; -export function ModeToggle() { +function ModeToggle() { const { setTheme } = useTheme(); return ( @@ -25,3 +25,4 @@ export function ModeToggle() { ); } +export default ModeToggle; diff --git a/src/FE/components/PasteUpload/PasteUpload.tsx b/src/FE/pages/home/_components/PasteUpload/PasteUpload.tsx similarity index 99% rename from src/FE/components/PasteUpload/PasteUpload.tsx rename to src/FE/pages/home/_components/PasteUpload/PasteUpload.tsx index 0c7c329c..13c222e9 100644 --- a/src/FE/components/PasteUpload/PasteUpload.tsx +++ b/src/FE/pages/home/_components/PasteUpload/PasteUpload.tsx @@ -1,8 +1,9 @@ import React, { useEffect, useRef } from 'react'; import { checkFileSizeCanUpload, uploadFile } from '@/utils/uploadFile'; -import { ChatModelFileConfig } from '@/types/model'; + import { ImageDef } from '@/types/chat'; +import { ChatModelFileConfig } from '@/types/model'; interface IPasteUploadProps { fileServiceId: number; diff --git a/src/FE/components/Popover/DateTimePopover.tsx b/src/FE/pages/home/_components/Popover/DateTimePopover.tsx similarity index 93% rename from src/FE/components/Popover/DateTimePopover.tsx rename to src/FE/pages/home/_components/Popover/DateTimePopover.tsx index dc18d626..1ff52815 100644 --- a/src/FE/components/Popover/DateTimePopover.tsx +++ b/src/FE/pages/home/_components/Popover/DateTimePopover.tsx @@ -1,7 +1,11 @@ import { IconSquareRoundedX } from '@/components/Icons'; import { Button } from '@/components/ui/button'; import { Calendar } from '@/components/ui/calendar'; -import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover'; import { cn } from '@/lib/utils'; diff --git a/src/FE/components/Popover/DeletePopover.tsx b/src/FE/pages/home/_components/Popover/DeletePopover.tsx similarity index 93% rename from src/FE/components/Popover/DeletePopover.tsx rename to src/FE/pages/home/_components/Popover/DeletePopover.tsx index 98f952c4..0ea3cf95 100644 --- a/src/FE/components/Popover/DeletePopover.tsx +++ b/src/FE/pages/home/_components/Popover/DeletePopover.tsx @@ -3,7 +3,11 @@ import { useState } from 'react'; import useTranslation from '@/hooks/useTranslation'; import { Button } from '@/components/ui/button'; -import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '@/components/ui/popover'; interface Props { onDelete: () => void; diff --git a/src/FE/components/Promptbar/components/Prompt.tsx b/src/FE/pages/home/_components/Promptbar/Prompt.tsx similarity index 95% rename from src/FE/components/Promptbar/components/Prompt.tsx rename to src/FE/pages/home/_components/Promptbar/Prompt.tsx index c7b4d480..0eb116b4 100644 --- a/src/FE/components/Promptbar/components/Prompt.tsx +++ b/src/FE/pages/home/_components/Promptbar/Prompt.tsx @@ -10,8 +10,8 @@ import { IconX, } from '@/components/Icons/index'; -import PromptbarContext from '../PromptBar.context'; -import { PromptModal } from './PromptModal'; +import PromptbarContext from './PromptBar.context'; +import PromptModal from './PromptModal'; import { getUserPromptDetail } from '@/apis/clientApis'; @@ -19,7 +19,7 @@ interface Props { prompt: PromptSlim; } -export const PromptComponent = ({ prompt }: Props) => { +const PromptComponent = ({ prompt }: Props) => { const { dispatch: promptDispatch, handleUpdatePrompt, @@ -128,3 +128,4 @@ export const PromptComponent = ({ prompt }: Props) => { ); }; +export default PromptComponent; diff --git a/src/FE/components/Promptbar/PromptBar.context.tsx b/src/FE/pages/home/_components/Promptbar/PromptBar.context.tsx similarity index 63% rename from src/FE/components/Promptbar/PromptBar.context.tsx rename to src/FE/pages/home/_components/Promptbar/PromptBar.context.tsx index 497cf510..9201a0ee 100644 --- a/src/FE/components/Promptbar/PromptBar.context.tsx +++ b/src/FE/pages/home/_components/Promptbar/PromptBar.context.tsx @@ -2,9 +2,8 @@ import { Dispatch, createContext } from 'react'; import { ActionType } from '@/hooks/useCreateReducer'; -import { Prompt, PromptSlim } from '@/types/prompt'; - -import { PromptbarInitialState } from './Promptbar.state'; +import { Prompt } from '@/types/prompt'; +import { PromptSlim } from '@/types/prompt'; export interface PromptbarContextProps { state: PromptbarInitialState; @@ -14,6 +13,16 @@ export interface PromptbarContextProps { handleUpdatePrompt: (prompt: Prompt) => void; } +export interface PromptbarInitialState { + searchTerm: string; + filteredPrompts: PromptSlim[]; +} + +export const initialState: PromptbarInitialState = { + searchTerm: '', + filteredPrompts: [], +}; + const PromptbarContext = createContext(undefined!); export default PromptbarContext; diff --git a/src/FE/components/Promptbar/components/PromptModal.tsx b/src/FE/pages/home/_components/Promptbar/PromptModal.tsx similarity index 96% rename from src/FE/components/Promptbar/components/PromptModal.tsx rename to src/FE/pages/home/_components/Promptbar/PromptModal.tsx index a5d77ca4..c6d7e51f 100644 --- a/src/FE/components/Promptbar/components/PromptModal.tsx +++ b/src/FE/pages/home/_components/Promptbar/PromptModal.tsx @@ -9,8 +9,8 @@ import { UserRole } from '@/types/adminApis'; import { DEFAULT_TEMPERATURE } from '@/types/chat'; import { Prompt } from '@/types/prompt'; -import { TemperatureSlider } from '@/components/Chat/Temperature'; import { IconInfo } from '@/components/Icons'; +import TemperatureSlider from '@/components/TemperatureSlider/TemperatureSlider'; import Tips from '@/components/Tips/Tips'; import { Button } from '@/components/ui/button'; import { @@ -24,7 +24,8 @@ import FormInput from '@/components/ui/form/input'; import FormSwitch from '@/components/ui/form/switch'; import FormTextarea from '@/components/ui/form/textarea'; -import { HomeContext } from '@/contexts/Home.context'; +import HomeContext from '../../_contents/Home.context'; + import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; @@ -34,7 +35,7 @@ interface IProps { onClose: () => void; } -export const PromptModal = (props: IProps) => { +const PromptModal = (props: IProps) => { const { t } = useTranslation(); const { prompt, onUpdatePrompt, onClose } = props; @@ -191,3 +192,4 @@ export const PromptModal = (props: IProps) => { ); }; +export default PromptModal; diff --git a/src/FE/components/Promptbar/Promptbar.tsx b/src/FE/pages/home/_components/Promptbar/Promptbar.tsx similarity index 91% rename from src/FE/components/Promptbar/Promptbar.tsx rename to src/FE/pages/home/_components/Promptbar/Promptbar.tsx index df0089df..744a550e 100644 --- a/src/FE/components/Promptbar/Promptbar.tsx +++ b/src/FE/pages/home/_components/Promptbar/Promptbar.tsx @@ -1,19 +1,16 @@ import { useContext, useEffect } from 'react'; import toast from 'react-hot-toast'; -import useTranslation from '@/hooks/useTranslation'; - import { useCreateReducer } from '@/hooks/useCreateReducer'; +import useTranslation from '@/hooks/useTranslation'; import { Prompt, PromptSlim } from '@/types/prompt'; -import { HomeContext } from '@/contexts/Home.context'; - -import { Prompts } from './components/Prompts'; -import Sidebar from '@/components/Sidebar'; - +import HomeContext from '../../_contents/Home.context'; +import Sidebar from '../Sidebar/Sidebar'; import PromptbarContext from './PromptBar.context'; -import { PromptbarInitialState, initialState } from './Promptbar.state'; +import { PromptbarInitialState, initialState } from './PromptBar.context'; +import Prompts from './Prompts'; import { deleteUserPrompts, @@ -72,7 +69,7 @@ const PromptBar = () => { const handleUpdatePrompt = (prompt: Prompt) => { putUserPrompts(prompt.id, prompt).then(() => { - const existingPrompts = prompts.filter(x => x.id !== prompt.id); + const existingPrompts = prompts.filter((x) => x.id !== prompt.id); homeDispatch({ field: 'prompts', value: [...existingPrompts, prompt] }); toast.success(t('Updated successful')); }); diff --git a/src/FE/components/Promptbar/components/Prompts.tsx b/src/FE/pages/home/_components/Promptbar/Prompts.tsx similarity index 76% rename from src/FE/components/Promptbar/components/Prompts.tsx rename to src/FE/pages/home/_components/Promptbar/Prompts.tsx index 8b85569a..54e674c9 100644 --- a/src/FE/components/Promptbar/components/Prompts.tsx +++ b/src/FE/pages/home/_components/Promptbar/Prompts.tsx @@ -2,13 +2,13 @@ import { FC } from 'react'; import { PromptSlim } from '@/types/prompt'; -import { PromptComponent } from './Prompt'; +import PromptComponent from './Prompt'; interface Props { prompts: PromptSlim[]; } -export const Prompts: FC = ({ prompts }) => { +const Prompts: FC = ({ prompts }) => { return (
{prompts @@ -20,3 +20,4 @@ export const Prompts: FC = ({ prompts }) => {
); }; +export default Prompts; diff --git a/src/FE/components/Settings/ApiKeyTabContent.tsx b/src/FE/pages/home/_components/Settings/ApiKeyTabContent.tsx similarity index 97% rename from src/FE/components/Settings/ApiKeyTabContent.tsx rename to src/FE/pages/home/_components/Settings/ApiKeyTabContent.tsx index ca5d9c98..96970078 100644 --- a/src/FE/components/Settings/ApiKeyTabContent.tsx +++ b/src/FE/pages/home/_components/Settings/ApiKeyTabContent.tsx @@ -10,8 +10,6 @@ import { getApiUrl } from '@/utils/common'; import { GetUserApiKeyResult } from '@/types/clientApis'; import CopyButton from '@/components/Button/CopyButton'; -import DateTimePopover from '@/components/Popover/DateTimePopover'; -import DeletePopover from '@/components/Popover/DeletePopover'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; @@ -24,6 +22,9 @@ import { TableRow, } from '@/components/ui/table'; +import DateTimePopover from '../Popover/DateTimePopover'; +import DeletePopover from '../Popover/DeletePopover'; + import { deleteUserApiKey, getUserApiKey, @@ -32,7 +33,7 @@ import { } from '@/apis/clientApis'; let timer: NodeJS.Timeout; -export const ApiKeyTab = () => { +const ApiKeyTab = () => { const { t } = useTranslation(); const [loading, setLoading] = useState(false); const [apiKeys, setApiKeys] = useState([]); @@ -178,3 +179,4 @@ export const ApiKeyTab = () => { ); }; +export default ApiKeyTab; diff --git a/src/FE/components/Settings/SettingModal.tsx b/src/FE/pages/home/_components/Settings/SettingModal.tsx similarity index 86% rename from src/FE/components/Settings/SettingModal.tsx rename to src/FE/pages/home/_components/Settings/SettingModal.tsx index 5dd79942..fa0e92d8 100644 --- a/src/FE/components/Settings/SettingModal.tsx +++ b/src/FE/pages/home/_components/Settings/SettingModal.tsx @@ -9,14 +9,14 @@ import { DialogTitle, } from '@/components/ui/dialog'; -import { ApiKeyTab } from './ApiKeyTabContent'; +import ApiKeyTab from './ApiKeyTabContent'; interface Props { isOpen: boolean; onClose: () => void; } -export const SettingModal = (props: Props) => { +const SettingModal = (props: Props) => { const { isOpen, onClose } = props; const { t } = useTranslation(); @@ -33,3 +33,4 @@ export const SettingModal = (props: Props) => { ); }; +export default SettingModal; diff --git a/src/FE/components/Sidebar/Sidebar.tsx b/src/FE/pages/home/_components/Sidebar/Sidebar.tsx similarity index 98% rename from src/FE/components/Sidebar/Sidebar.tsx rename to src/FE/pages/home/_components/Sidebar/Sidebar.tsx index 5eb5e62a..4fbc35c6 100644 --- a/src/FE/components/Sidebar/Sidebar.tsx +++ b/src/FE/pages/home/_components/Sidebar/Sidebar.tsx @@ -8,7 +8,7 @@ import { IconSearch, IconSquarePlus, } from '@/components/Icons/index'; -import Search from '@/components/Search'; +import Search from '@/components/Search/Search'; import Tips from '@/components/Tips/Tips'; import { Button } from '@/components/ui/button'; diff --git a/src/FE/components/Sidebar/SidebarButton.tsx b/src/FE/pages/home/_components/Sidebar/SidebarButton.tsx similarity index 93% rename from src/FE/components/Sidebar/SidebarButton.tsx rename to src/FE/pages/home/_components/Sidebar/SidebarButton.tsx index 91ad5114..74a936a0 100644 --- a/src/FE/components/Sidebar/SidebarButton.tsx +++ b/src/FE/pages/home/_components/Sidebar/SidebarButton.tsx @@ -8,7 +8,7 @@ interface Props { onClick: () => void; } -export const SidebarButton: FC = ({ +const SidebarButton: FC = ({ text, icon, className, @@ -36,3 +36,4 @@ export const SidebarButton: FC = ({ ); }; +export default SidebarButton; diff --git a/src/FE/contexts/Home.context.ts b/src/FE/pages/home/_contents/Home.context.ts similarity index 96% rename from src/FE/contexts/Home.context.ts rename to src/FE/pages/home/_contents/Home.context.ts index 1064e755..26626062 100644 --- a/src/FE/contexts/Home.context.ts +++ b/src/FE/pages/home/_contents/Home.context.ts @@ -40,7 +40,7 @@ export interface HomeInitialState { searchTerm: string; } -const initialState: HomeInitialState = { +export const initialState: HomeInitialState = { user: null, loading: false, messageIsStreaming: false, @@ -86,4 +86,4 @@ export interface HomeContextProps { const HomeContext = createContext(undefined!); -export { initialState, HomeContext }; +export default HomeContext; diff --git a/src/FE/pages/home/index.tsx b/src/FE/pages/home/index.tsx index eca169bb..5afb5164 100644 --- a/src/FE/pages/home/index.tsx +++ b/src/FE/pages/home/index.tsx @@ -1,6 +1,6 @@ import Head from 'next/head'; -import HomeContent from '@/components/HomeContent/HomeContent'; +import HomeContent from './_components/HomeContent/HomeContent'; const Home = () => { return ( diff --git a/src/FE/components/Login/AccountLoginCard.tsx b/src/FE/pages/login/_components/AccountLoginCard.tsx similarity index 100% rename from src/FE/components/Login/AccountLoginCard.tsx rename to src/FE/pages/login/_components/AccountLoginCard.tsx diff --git a/src/FE/components/Login/KeyCloakLogin.tsx b/src/FE/pages/login/_components/KeyCloakLogin.tsx similarity index 100% rename from src/FE/components/Login/KeyCloakLogin.tsx rename to src/FE/pages/login/_components/KeyCloakLogin.tsx diff --git a/src/FE/components/Login/PhoneLoginCard.tsx b/src/FE/pages/login/_components/PhoneLoginCard.tsx similarity index 100% rename from src/FE/components/Login/PhoneLoginCard.tsx rename to src/FE/pages/login/_components/PhoneLoginCard.tsx diff --git a/src/FE/components/Login/PhoneRegisterCard.tsx b/src/FE/pages/login/_components/PhoneRegisterCard.tsx similarity index 100% rename from src/FE/components/Login/PhoneRegisterCard.tsx rename to src/FE/pages/login/_components/PhoneRegisterCard.tsx index 790ea604..418f254f 100644 --- a/src/FE/components/Login/PhoneRegisterCard.tsx +++ b/src/FE/pages/login/_components/PhoneRegisterCard.tsx @@ -8,6 +8,7 @@ import useTranslation from '@/hooks/useTranslation'; import { PhoneRegExp, SmsExpirationSeconds } from '@/utils/common'; import { saveUserInfo, setUserSession } from '@/utils/user'; +import { redirectToGithub } from '@/utils/website'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; @@ -23,7 +24,6 @@ import { Input } from '@/components/ui/input'; import { registerByPhone, sendRegisterSmsCode } from '@/apis/clientApis'; import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; -import { redirectToGithub } from '@/utils/website'; const PhoneRegisterCard = (props: { loginLoading: boolean; diff --git a/src/FE/components/Login/WeChatLogin.tsx b/src/FE/pages/login/_components/WeChatLogin.tsx similarity index 100% rename from src/FE/components/Login/WeChatLogin.tsx rename to src/FE/pages/login/_components/WeChatLogin.tsx diff --git a/src/FE/components/Login/WeChatLoginModal.tsx b/src/FE/pages/login/_components/WeChatLoginModal.tsx similarity index 96% rename from src/FE/components/Login/WeChatLoginModal.tsx rename to src/FE/pages/login/_components/WeChatLoginModal.tsx index f2b68d0f..6502ab31 100644 --- a/src/FE/components/Login/WeChatLoginModal.tsx +++ b/src/FE/pages/login/_components/WeChatLoginModal.tsx @@ -2,7 +2,7 @@ import { useEffect } from 'react'; import useExternal from '@/hooks/useExternal'; -import Spinner from '@/components/Spinner'; +import Spinner from '@/components/Spinner/Spinner'; import { Dialog, DialogContent } from '@/components/ui/dialog'; const WeChatLoginModal = (props: { diff --git a/src/FE/pages/login/index.tsx b/src/FE/pages/login/index.tsx index 64667732..c256bb3a 100644 --- a/src/FE/pages/login/index.tsx +++ b/src/FE/pages/login/index.tsx @@ -8,14 +8,15 @@ import { LoginConfigsResult } from '@/types/clientApis'; import { SiteInfoConfig } from '@/types/config'; import { LoginType } from '@/types/user'; -import AccountLoginCard from '@/components/Login/AccountLoginCard'; -import KeyCloakLogin from '@/components/Login/KeyCloakLogin'; -import PhoneLoginCard from '@/components/Login/PhoneLoginCard'; -import PhoneRegisterCard from '@/components/Login/PhoneRegisterCard'; -import WeChatLogin from '@/components/Login/WeChatLogin'; import { Button } from '@/components/ui/button'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import AccountLoginCard from './_components/AccountLoginCard'; +import KeyCloakLogin from './_components/KeyCloakLogin'; +import PhoneLoginCard from './_components/PhoneLoginCard'; +import PhoneRegisterCard from './_components/PhoneRegisterCard'; +import WeChatLogin from './_components/WeChatLogin'; + import { getLoginProviders, getSiteInfo } from '@/apis/clientApis'; enum TabKeys { @@ -136,8 +137,8 @@ export default function LoginPage() { Chats -
-
+
+
{webSiteInfo?.filingNumber}
-
- © {new Date().getFullYear()} Chats™ . All Rights Reserved. -
- {webSiteInfo?.companyName && t(webSiteInfo.companyName)} - + {webSiteInfo?.companyName}
+ +
+ © {new Date().getFullYear()}  + + ™ . All Rights Reserved. +
)} diff --git a/src/FE/pages/message/[id].tsx b/src/FE/pages/message/[id].tsx index 33364fee..c62f7284 100644 --- a/src/FE/pages/message/[id].tsx +++ b/src/FE/pages/message/[id].tsx @@ -2,16 +2,16 @@ import { useEffect, useState } from 'react'; import { useRouter } from 'next/router'; +import { getQueryId } from '@/utils/common'; import { getSelectMessages } from '@/utils/message'; import { GetMessageDetailsResult } from '@/types/adminApis'; import { ChatMessage } from '@/types/chatMessage'; -import { ChatMessage as ChatMessageComponent } from '@/components/Admin/Messages/ChatMessage'; +import { ChatMessageByReadOnly } from '@/components/ChatMessage/ChatMessageByReadOnly'; import { getMessageDetails } from '@/apis/adminApis'; import Decimal from 'decimal.js'; -import { getQueryId } from '@/utils/common'; export default function MessageDetails() { const router = useRouter(); @@ -84,12 +84,11 @@ export default function MessageDetails() { parentChildrenIds = [...parentChildrenIds].reverse(); } return ( - x === current.id, )} isLastMessage={selectMessages.length - 1 === index} - id={current.id!} key={current.id + index} parentId={current.parentId} onChangeMessage={(messageId: string) => { diff --git a/src/FE/pages/share/[id].tsx b/src/FE/pages/share/[id].tsx index c0aaddeb..55c5793f 100644 --- a/src/FE/pages/share/[id].tsx +++ b/src/FE/pages/share/[id].tsx @@ -1,22 +1,22 @@ import { useEffect, useState } from 'react'; import Link from 'next/link'; -import { NextRouter, useRouter } from 'next/router'; +import { useRouter } from 'next/router'; import useTranslation from '@/hooks/useTranslation'; +import { getQueryId } from '@/utils/common'; import { getSelectMessages } from '@/utils/message'; import { GetMessageDetailsResult } from '@/types/adminApis'; import { ChatMessage } from '@/types/chatMessage'; -import { ChatMessage as ChatMessageComponent } from '@/components/Admin/Messages/ChatMessage'; +import { ChatMessageByReadOnly } from '@/components/ChatMessage/ChatMessageByReadOnly'; import PageNotFound from '@/components/PageNotFound/PageNotFound'; import { Button } from '@/components/ui/button'; import { getShareMessage } from '@/apis/adminApis'; import Decimal from 'decimal.js'; -import { getQueryId } from '@/utils/common'; export default function ShareMessage() { const { t } = useTranslation(); @@ -26,8 +26,6 @@ export default function ShareMessage() { const [loading, setLoading] = useState(true); const [currentMessages, setCurrentMessages] = useState([]); - - useEffect(() => { setLoading(true); if (!router.isReady) return; @@ -74,12 +72,11 @@ export default function ShareMessage() { parentChildrenIds = [...parentChildrenIds].reverse(); } return ( - x === current.id, )} isLastMessage={selectMessages.length - 1 === index} - id={current.id!} key={current.id + index} parentId={current.parentId} onChangeMessage={(messageId: string) => { diff --git a/src/FE/components/Theme/ThemeProvider.tsx b/src/FE/providers/ThemeProvider.tsx similarity index 100% rename from src/FE/components/Theme/ThemeProvider.tsx rename to src/FE/providers/ThemeProvider.tsx diff --git a/src/FE/public/logos/azure.svg b/src/FE/public/logos/azure.svg index fcb11483..142e3b38 100644 --- a/src/FE/public/logos/azure.svg +++ b/src/FE/public/logos/azure.svg @@ -1 +1,9 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/src/FE/public/logos/github.svg b/src/FE/public/logos/github.svg new file mode 100644 index 00000000..ce2371a4 --- /dev/null +++ b/src/FE/public/logos/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/FE/public/logos/x.svg b/src/FE/public/logos/x.svg new file mode 100644 index 00000000..39a664ae --- /dev/null +++ b/src/FE/public/logos/x.svg @@ -0,0 +1,12 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/FE/types/chat.ts b/src/FE/types/chat.ts index 8b043200..32e8d308 100644 --- a/src/FE/types/chat.ts +++ b/src/FE/types/chat.ts @@ -1,3 +1,5 @@ +import { UserModelConfig } from './model'; + export type Role = 'assistant' | 'user' | 'system'; export const DEFAULT_TEMPERATURE = 0.5; @@ -35,7 +37,6 @@ export interface IChat { title: string; chatModelId?: string; modelName: string; - modelConfig: any; - userModelConfig: any; + userModelConfig: UserModelConfig; isShared: boolean; } diff --git a/src/FE/types/clientApis.ts b/src/FE/types/clientApis.ts index 7b8dd9db..016c17d2 100644 --- a/src/FE/types/clientApis.ts +++ b/src/FE/types/clientApis.ts @@ -1,4 +1,4 @@ -import { DBModelProvider } from './model'; +import { DBModelProvider, UserModelConfig } from './model'; import { Paging } from './page'; import { LoginType } from './user'; @@ -64,8 +64,7 @@ export interface ChatResult { title: string; modelId: number; modelName: string; - modelConfig: any; - userModelConfig: any; + userModelConfig: UserModelConfig; isShared: boolean; modelProviderId: DBModelProvider; } diff --git a/src/FE/types/file.ts b/src/FE/types/file.ts index b7e1e952..097931dd 100644 --- a/src/FE/types/file.ts +++ b/src/FE/types/file.ts @@ -8,7 +8,7 @@ export const feFileServiceTypes: FileServiceType[] = [ { id: 1, name: 'Minio' }, { id: 2, name: 'AWS S3' }, { id: 3, name: 'Aliyun OSS' }, - { id: 4, name: 'Azure Blob Storage' } + { id: 4, name: 'Azure Blob Storage' }, ]; export enum DBFileServiceType { @@ -16,5 +16,5 @@ export enum DBFileServiceType { Minio = 1, AWSS3 = 2, AliyunOSS = 3, - AzureBlobStorage = 4 -} \ No newline at end of file + AzureBlobStorage = 4, +} diff --git a/src/FE/types/model.ts b/src/FE/types/model.ts index 6e5e51bf..be07ebe3 100644 --- a/src/FE/types/model.ts +++ b/src/FE/types/model.ts @@ -1,8 +1,8 @@ -export interface ModelConfig { +export interface UserModelConfig { prompt: string | null; - maxLength: number; - temperature?: number; - enableSearch?: boolean; + maxLength: number | null; + temperature: number | null; + enableSearch: boolean | null; } export enum DBModelProvider { @@ -16,6 +16,8 @@ export enum DBModelProvider { Spark = 8, ZhiPuAI = 9, DeepSeek = 10, + X_AI = 11, + GithubModels = 12, } export type FEModelProvider = { @@ -36,6 +38,8 @@ export const feModelProviders: FEModelProvider[] = [ { id: 8, name: 'Xunfei SparkDesk', icon: '/logos/spark.svg' }, { id: 9, name: 'Zhipu AI', icon: '/logos/zhipuai.svg' }, { id: 10, name: 'DeepSeek', icon: '/logos/deepseek.svg' }, + { id: 11, name: 'x.ai', icon: '/logos/x.svg' }, + { id: 12, name: 'Github Models', icon: '/logos/github.svg' }, ]; export interface ChatModelFileConfig { @@ -47,5 +51,3 @@ export interface ChatModelPriceConfig { input: number; out: number; } - -export interface UserModelConfig extends ModelConfig { } diff --git a/src/FE/types/page.ts b/src/FE/types/page.ts index b364b598..23e1f324 100644 --- a/src/FE/types/page.ts +++ b/src/FE/types/page.ts @@ -6,4 +6,4 @@ export interface PageResult { export interface Paging { page: number; pageSize: number; -} \ No newline at end of file +} diff --git a/src/FE/types/prompt.ts b/src/FE/types/prompt.ts index 73457148..33d14303 100644 --- a/src/FE/types/prompt.ts +++ b/src/FE/types/prompt.ts @@ -13,4 +13,4 @@ export interface IdName { export interface PromptSlim extends IdName { isDefault: boolean; isSystem: boolean; -} \ No newline at end of file +} diff --git a/src/FE/utils/chats.ts b/src/FE/utils/chats.ts index 2c1f6491..2e9b25ee 100644 --- a/src/FE/utils/chats.ts +++ b/src/FE/utils/chats.ts @@ -30,4 +30,4 @@ export function preprocessLaTeX(content?: string) { (_, equation) => `$${equation}$`, ); return inlineProcessedContent; -} \ No newline at end of file +} diff --git a/src/FE/utils/common.ts b/src/FE/utils/common.ts index dd4f34df..dd4e92c0 100644 --- a/src/FE/utils/common.ts +++ b/src/FE/utils/common.ts @@ -1,4 +1,4 @@ -import { NextRouter } from "next/router"; +import { NextRouter } from 'next/router'; export const isMobile = () => { const userAgent = @@ -23,7 +23,9 @@ export function formatNumberAsMoney(amount: number, maximumFractionDigits = 5) { } export function termDateString() { - return new Date(new Date().getTime() + 10 * 365 * 24 * 60 * 60 * 1000).toISOString(); // 10 years + return new Date( + new Date().getTime() + 10 * 365 * 24 * 60 * 60 * 1000, + ).toISOString(); // 10 years } export const PhoneRegExp = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; @@ -47,4 +49,4 @@ export const getQueryId = (router: NextRouter): string => { const asPath = router.asPath.split('?')[0]; // 移除查询参数 const pathSegments = asPath.split('/'); return pathSegments[pathSegments.length - 1] || ''; -} \ No newline at end of file +}; diff --git a/src/FE/utils/promptVariable.ts b/src/FE/utils/promptVariable.ts index 307a651a..777abccb 100644 --- a/src/FE/utils/promptVariable.ts +++ b/src/FE/utils/promptVariable.ts @@ -1,4 +1,4 @@ -import { AdminModelDto } from "@/types/adminApis"; +import { AdminModelDto } from '@/types/adminApis'; interface PromptParams { model: AdminModelDto; @@ -7,7 +7,10 @@ interface PromptParams { export const PromptVariables = { '{{CURRENT_DATE}}': () => new Date().toLocaleDateString(), '{{CURRENT_TIME}}': () => new Date().toLocaleString(), - '{{MODEL_NAME}}': (params?: PromptParams) => params?.model?.modelReferenceShortName || params?.model?.modelReferenceName || '', + '{{MODEL_NAME}}': (params?: PromptParams) => + params?.model?.modelReferenceShortName || + params?.model?.modelReferenceName || + '', }; export function formatPrompt(prompt: string, params?: PromptParams) { diff --git a/src/scripts/20240902-db-migration.linq b/src/scripts/db-migration/2024/20240902-db-migration.linq similarity index 100% rename from src/scripts/20240902-db-migration.linq rename to src/scripts/db-migration/2024/20240902-db-migration.linq diff --git a/src/scripts/20241101-model-reference-sql.linq b/src/scripts/db-migration/2024/20241101-model-reference-sql.linq similarity index 100% rename from src/scripts/20241101-model-reference-sql.linq rename to src/scripts/db-migration/2024/20241101-model-reference-sql.linq diff --git a/src/scripts/20241112-db-migration.linq b/src/scripts/db-migration/2024/20241112-db-migration.linq similarity index 100% rename from src/scripts/20241112-db-migration.linq rename to src/scripts/db-migration/2024/20241112-db-migration.linq diff --git a/src/scripts/20241115-db-migration.sql b/src/scripts/db-migration/2024/20241115-db-migration.sql similarity index 100% rename from src/scripts/20241115-db-migration.sql rename to src/scripts/db-migration/2024/20241115-db-migration.sql diff --git a/src/scripts/20241121-int-migration.sql b/src/scripts/db-migration/2024/20241121-int-migration.sql similarity index 100% rename from src/scripts/20241121-int-migration.sql rename to src/scripts/db-migration/2024/20241121-int-migration.sql diff --git a/src/scripts/20241127-ref.sql b/src/scripts/db-migration/2024/20241127-ref.sql similarity index 100% rename from src/scripts/20241127-ref.sql rename to src/scripts/db-migration/2024/20241127-ref.sql diff --git a/src/scripts/20241129-file.sql b/src/scripts/db-migration/2024/20241129-file.sql similarity index 100% rename from src/scripts/20241129-file.sql rename to src/scripts/db-migration/2024/20241129-file.sql diff --git a/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql b/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql new file mode 100644 index 00000000..77df5dc4 --- /dev/null +++ b/src/scripts/db-migration/2024/20241211-xai-githubmodels.sql @@ -0,0 +1,27 @@ +insert into ModelProvider values(11, 'x.ai', NULL, 'xai-yourkey'); +insert into ModelProvider values(12, 'Github Models', NULL, 'ghp_yourkey'); +update ModelProvider set InitialSecret = '' where id = 8; + +insert into ModelReference values +(1100, 11, 'grok-beta', 'grok', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 5, 15, 'USD'), +(1101, 11, 'grok-vision-beta', 'grok', 0, 0, 2, 0, 1, 1, 1, 8192, 4096, NULL, 5, 15, 'USD'), +(1200, 12, 'AI21-Jamba-1.5-Large', 'AI21-Jamba', 0, 0, 2, 0, 0, 1, 1, 256000, 4000, NULL, 5, 15, 'USD'), +(1201, 12, 'AI21-Jamba-1.5-Mini', 'AI21-Jamba', 0, 0, 2, 0, 0, 1, 1, 256000, 4000, NULL, 1, 2, 'USD'), +(1202, 12, 'Cohere-command-r', NULL, 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1203, 12, 'Cohere-command-r-plus', NULL, 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 0, 0, 'USD'), +(1204, 12, 'Llama-3.2-11B-Vision-Instruct', 'LLaMA', 0, 0, 2, 0, 1, 1, 1, 128000, 4000, NULL, 1, 2, 'USD'), +(1205, 12, 'Llama-3.2-90B-Vision-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 128000, 4000, NULL, 5, 15, 'USD'), +(1206, 12, 'Meta-Llama-3.1-405B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 5, 15, 'USD'), +(1207, 12, 'Meta-Llama-3.1-70B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 2.5, 5, 'USD'), +(1208, 12, 'Meta-Llama-3.1-8B-Instruct', 'LLaMA', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1209, 12, 'Mistral-large', 'Mistral', 1, 0, 2, 0, 0, 1, 0, 32768, 4096, NULL, 5, 15, 'USD'), +(1210, 12, 'Mistral-large-2407', 'Mistral', 0, 0, 2, 0, 0, 1, 0, 131072, 4096, NULL, 5, 15, 'USD'), +(1211, 12, 'Mistral-Nemo', 'Mistral', 0, 0, 2, 0, 0, 1, 0, 131072, 4096, NULL, 1, 2, 'USD'), +(1212, 12, 'Mistral-small', 'Mistral', 1, 0, 2, 0, 0, 1, 0, 32768, 4096, NULL, 1, 2, 'USD'), +(1213, 12, 'gpt-4o', NULL, 0, 0, 2, 0, 1, 1, 1, 128000, 4096, 2, 5, 15, 'USD'), +(1214, 12, 'gpt-4o-mini', NULL, 0, 0, 2, 0, 1, 1, 1, 128000, 4096, 2, 1, 2, 'USD'), +(1215, 12, 'Phi-3.5-MoE-instruct', 'Phi-3.5', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1216, 12, 'Phi-3.5-mini-instruct', 'Phi-3.5', 0, 0, 2, 0, 0, 1, 1, 131072, 4096, NULL, 0.5, 1, 'USD'), +(1217, 12, 'Phi-3.5-vision-instruct', 'Phi-3.5', 0, 0, 2, 0, 1, 1, 1, 131072, 4096, NULL, 1, 2, 'USD'), +(1218, 12, 'o1-preview', NULL, 0, 1, 1, 0, 0, 0, 0, 128000, 32768, NULL, 15, 60, 'USD'), +(1219, 12, 'o1-mini', NULL, 0, 1, 1, 0, 0, 0, 0, 128000, 65536, NULL, 3, 12, 'USD'); diff --git a/src/scripts/readme.md b/src/scripts/readme.md new file mode 100644 index 00000000..4abbd609 --- /dev/null +++ b/src/scripts/readme.md @@ -0,0 +1,2 @@ +# NOTE +This is a empty project and only put some scripts here for reference. \ No newline at end of file diff --git a/src/scripts/scripts.csproj b/src/scripts/scripts.csproj new file mode 100644 index 00000000..dbdcea46 --- /dev/null +++ b/src/scripts/scripts.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/src/scripts/tools/20241210-scaffold-fe.linq b/src/scripts/tools/20241210-scaffold-fe.linq new file mode 100644 index 00000000..14de83ad --- /dev/null +++ b/src/scripts/tools/20241210-scaffold-fe.linq @@ -0,0 +1,84 @@ + + System.Net.Http + System.IO.Compression + System.Threading.Tasks + + +async Task Main() +{ + string wwwroot = Path.Combine(new DirectoryInfo(Path.GetDirectoryName(Util.CurrentQueryPath)!).Parent!.Parent!.ToString(), "BE", "wwwroot"); + Directory.Delete(wwwroot, recursive: true); + string latestfeUrl = "https://github.com/sdcb/chats/releases/latest/download/chats-fe.zip"; + using HttpClient http = new(); + ZipArchive zip = new(await http.GetStreamAsync(latestfeUrl), ZipArchiveMode.Read, leaveOpen: false); + foreach (ZipArchiveEntry entry in zip.Entries) + { + entry.Uncapsulate()._storedEntryName = entry.FullName.Replace("chats-fe/", ""); + ExtractRelativeToDirectory(entry, wwwroot, overwrite: false); + } + File.WriteAllBytes(Path.Combine(wwwroot, ".gitkeep"), new byte[0]); +} + +internal static void ExtractRelativeToDirectory(ZipArchiveEntry source, string destinationDirectoryName, bool overwrite) +{ + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(destinationDirectoryName); + + // Note that this will give us a good DirectoryInfo even if destinationDirectoryName exists: + DirectoryInfo di = Directory.CreateDirectory(destinationDirectoryName); + string destinationDirectoryFullPath = di.FullName; + if (!destinationDirectoryFullPath.EndsWith(Path.DirectorySeparatorChar)) + { + char sep = Path.DirectorySeparatorChar; + destinationDirectoryFullPath = string.Concat(destinationDirectoryFullPath, new ReadOnlySpan(in sep)); + } + + string fileDestinationPath = Path.GetFullPath(Path.Combine(destinationDirectoryFullPath, SanitizeEntryFilePath(source.FullName))); + + if (!fileDestinationPath.StartsWith(destinationDirectoryFullPath, PathInternal.StringComparison)) + throw new IOException("IO_ExtractingResultsInOutside"); + + if (Path.GetFileName(fileDestinationPath).Length == 0) + { + // If it is a directory: + + if (source.Length != 0) + throw new IOException("IO_DirectoryNameWithData"); + + Directory.CreateDirectory(fileDestinationPath); + } + else + { + // If it is a file: + // Create containing directory: + Directory.CreateDirectory(Path.GetDirectoryName(fileDestinationPath)!); + source.ExtractToFile(fileDestinationPath, overwrite: overwrite); + } + + + static string SanitizeEntryFilePath(string entryPath, bool preserveDriveRoot = false) => entryPath.Replace('\0', '_'); +} + +/// Contains internal path helpers that are shared between many projects. +internal static partial class PathInternal +{ + /// Returns a comparison that can be used to compare file and directory names for equality. + internal static StringComparison StringComparison + { + get + { + return IsCaseSensitive ? + StringComparison.Ordinal : + StringComparison.OrdinalIgnoreCase; + } + } + + /// Gets whether the system is case-sensitive. + internal static bool IsCaseSensitive + { + get + { + return !(OperatingSystem.IsWindows() || OperatingSystem.IsMacOS() || OperatingSystem.IsIOS() || OperatingSystem.IsTvOS() || OperatingSystem.IsWatchOS()); + } + } +} \ No newline at end of file