-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 支持 Silicon Flow 对话服务 * 更新子模块
- Loading branch information
Showing
15 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Core/RodelChat.Core/Providers/Predefined/SiliconFlow.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Rodel. All rights reserved. | ||
|
||
using RodelChat.Models.Client; | ||
|
||
/// <summary> | ||
/// 预定义模型. | ||
/// </summary> | ||
internal static partial class PredefinedModels | ||
{ | ||
internal static List<ChatModel> SiliconFlowModels { get; } = new List<ChatModel> | ||
{ | ||
new ChatModel | ||
{ | ||
DisplayName = "DeepSeek Chat V2", | ||
Id = "deepseek-ai/DeepSeek-V2-Chat", | ||
ContextLength = 32_768, | ||
}, | ||
new ChatModel | ||
{ | ||
DisplayName = "Qwen2 72B", | ||
Id = "Qwen/Qwen2-72B-Instruct", | ||
ContextLength = 32_768, | ||
}, | ||
new ChatModel | ||
{ | ||
DisplayName = "ChatGLM4 9B", | ||
Id = "THUDM/glm-4-9b-chat", | ||
ContextLength = 32_768, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Rodel. All rights reserved. | ||
|
||
using Microsoft.SemanticKernel; | ||
using RodelChat.Interfaces.Client; | ||
using RodelChat.Models.Client; | ||
|
||
namespace RodelChat.Core.Providers; | ||
|
||
/// <summary> | ||
/// Silicon Flow 服务商. | ||
/// </summary> | ||
public sealed class SiliconFlowProvider : ProviderBase, IProvider | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="SiliconFlowProvider"/> class. | ||
/// </summary> | ||
public SiliconFlowProvider(SiliconFlowClientConfig config) | ||
: base(config.Key, config.CustomModels) | ||
{ | ||
ServerModels = PredefinedModels.SiliconFlowModels; | ||
SetBaseUri(ProviderConstants.SiliconFlowApi); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public Kernel? GetOrCreateKernel(string modelId) | ||
{ | ||
if (ShouldRecreateKernel(modelId)) | ||
{ | ||
Kernel = Kernel.CreateBuilder() | ||
.AddOpenAIChatCompletion(modelId, BaseUri, AccessKey) | ||
.Build(); | ||
} | ||
|
||
return Kernel; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule semantic-kernel
updated
4 files