Skip to content

Commit

Permalink
支持星火大模型 V4
Browse files Browse the repository at this point in the history
  • Loading branch information
Richasy committed Jun 28, 2024
1 parent c61c518 commit 8a80f58
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
21 changes: 13 additions & 8 deletions src/Core/RodelChat.Core/Providers/Predefined/SparkDesk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,29 @@ internal static partial class PredefinedModels
{
new ChatModel
{
DisplayName = "V1.5",
Id = "V1_5",
DisplayName = "Spark Lite",
Id = "v1.1",
},
new ChatModel
{
DisplayName = "V2.0",
Id = "V2",
DisplayName = "Spark V2.0",
Id = "v2.1",
},
new ChatModel
{
DisplayName = "V3.0",
Id = "V3",
DisplayName = "Spark Pro",
Id = "v3.1",
},
new ChatModel
{
DisplayName = "Spark Max",
Id = "v3.5",
IsSupportTool = true,
},
new ChatModel
{
DisplayName = "V3.5",
Id = "V3_5",
DisplayName = "Spark4.0 Ultra",
Id = "v4.0",
IsSupportTool = true,
},
};
Expand Down
12 changes: 1 addition & 11 deletions src/Core/RodelChat.Core/Providers/SparkDeskProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public SparkDeskProvider(SparkDeskClientConfig config)
if (ShouldRecreateKernel(modelId))
{
Kernel = Kernel.CreateBuilder()
.AddSparkDeskChatCompletion(AccessKey, Secret, AppId, ConvertToSparkVersion(modelId))
.AddSparkDeskChatCompletion(AccessKey, Secret, AppId, modelId)
.Build();
}

Expand All @@ -60,16 +60,6 @@ public override PromptExecutionSettings ConvertExecutionSettings(ChatSessionPres
TopK = Convert.ToInt32(sessionData.Parameters.GetValueOrDefault<int>(nameof(SparkDeskChatParameters.TopK))),
};

private static SparkDeskTextVersion ConvertToSparkVersion(string modelId)
=> modelId switch
{
"V1_5" => SparkDeskTextVersion.V1_5,
"V2" => SparkDeskTextVersion.V2,
"V3" => SparkDeskTextVersion.V3,
"V3_5" => SparkDeskTextVersion.V3_5,
_ => throw new NotSupportedException("Version not supported."),
};

/// <summary>
/// 星火对话参数.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ private async Task ChangeModelAsync(ChatModelItemViewModel model)
return;
}

Model = model.Name;
Data.Model = model.Id;
Model = model.Name;
foreach (var item in Models)
{
item.IsSelected = item.Equals(model);
Expand Down

0 comments on commit 8a80f58

Please sign in to comment.