15 changed files with 261 additions and 24 deletions
@ -1,6 +1,10 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Tools:GetApplicationConfiguration": "Get Application Configuration" |
|||
"Tools:GetApplicationConfiguration": "Get Application Configuration", |
|||
"HttpAITool:Endpoint": "Endpoint", |
|||
"HttpAITool:Method": "Method", |
|||
"HttpAITool:Headers": "Headers", |
|||
"HttpAITool:CurrentAccessToken": "Use the current user token" |
|||
} |
|||
} |
|||
@ -1,6 +1,10 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"Tools:GetApplicationConfiguration": "获取应用程序配置" |
|||
"Tools:GetApplicationConfiguration": "获取应用程序配置", |
|||
"HttpAITool:Endpoint": "请求地址", |
|||
"HttpAITool:Method": "请求方法", |
|||
"HttpAITool:Headers": "请求头", |
|||
"HttpAITool:CurrentAccessToken": "使用当前用户Token" |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"McpAITool:Endpoint": "Endpoint", |
|||
"McpAITool:Headers": "Headers", |
|||
"McpAITool:TransportMode": "Transport Mode", |
|||
"McpAITool:TransportModeDesc": "The transport mode to use for the connection. The default is: Auto Detect.", |
|||
"McpAITool:ConnectionTimeout": "Connection Timeout", |
|||
"McpAITool:ConnectionTimeoutDesc": "The timeout used to establish the initial connection to the SSE server. The default is 30 seconds.", |
|||
"McpAITool:MaxReconnectionAttempts": "Max Reconnection Attempts", |
|||
"McpAITool:MaxReconnectionAttemptsDesc": "The maximum number of reconnection attempts. The default is 5.", |
|||
"McpAITool:CurrentAccessToken": "Use the current user token" |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"McpAITool:Endpoint": "请求地址", |
|||
"McpAITool:Headers": "请求头", |
|||
"McpAITool:TransportMode": "传输方式", |
|||
"McpAITool:TransportModeDesc": "连接所采用的传输方式, 默认: Auto Detect.", |
|||
"McpAITool:ConnectionTimeout": "超时时间", |
|||
"McpAITool:ConnectionTimeoutDesc": "用于建立与 SSE 服务器初始连接的超时时间, 默认: 30秒.", |
|||
"McpAITool:MaxReconnectionAttempts": "最大重连次数", |
|||
"McpAITool:MaxReconnectionAttemptsDesc": "最大重连次数, 默认: 5次.", |
|||
"McpAITool:CurrentAccessToken": "使用当前用户Token" |
|||
} |
|||
} |
|||
@ -0,0 +1,109 @@ |
|||
using System.Collections.Generic; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace LINGYUN.Abp.AI.Tools; |
|||
|
|||
public enum PropertyValueType |
|||
{ |
|||
String = 0, |
|||
Number = 1, |
|||
Boolean = 2, |
|||
Dictionary = 3, |
|||
Select = 4, |
|||
} |
|||
|
|||
public class AIToolPropertyDescriptor |
|||
{ |
|||
public string Name { get; } |
|||
public PropertyValueType ValueType { get; } |
|||
public List<NameValue<object>> Options { get; } |
|||
public ILocalizableString DisplayName { get; } |
|||
public ILocalizableString? Description { get; } |
|||
private AIToolPropertyDescriptor( |
|||
string name, |
|||
PropertyValueType valueType, |
|||
ILocalizableString displayName, |
|||
ILocalizableString? description = null) |
|||
{ |
|||
Name = name; |
|||
ValueType = valueType; |
|||
DisplayName = displayName; |
|||
Description = description; |
|||
|
|||
Options = new List<NameValue<object>>(); |
|||
} |
|||
|
|||
public static AIToolPropertyDescriptor CreateStringProperty( |
|||
string name, |
|||
ILocalizableString displayName, |
|||
ILocalizableString? description = null) |
|||
{ |
|||
return new AIToolPropertyDescriptor( |
|||
name, |
|||
PropertyValueType.String, |
|||
displayName, |
|||
description); |
|||
} |
|||
|
|||
public static AIToolPropertyDescriptor CreateNumberProperty( |
|||
string name, |
|||
ILocalizableString displayName, |
|||
ILocalizableString? description = null) |
|||
{ |
|||
return new AIToolPropertyDescriptor( |
|||
name, |
|||
PropertyValueType.Number, |
|||
displayName, |
|||
description); |
|||
} |
|||
|
|||
public static AIToolPropertyDescriptor CreateBoolProperty( |
|||
string name, |
|||
ILocalizableString displayName, |
|||
ILocalizableString? description = null) |
|||
{ |
|||
return new AIToolPropertyDescriptor( |
|||
name, |
|||
PropertyValueType.Boolean, |
|||
displayName, |
|||
description); |
|||
} |
|||
|
|||
public static AIToolPropertyDescriptor CreateDictionaryProperty( |
|||
string name, |
|||
ILocalizableString displayName, |
|||
ILocalizableString? description = null) |
|||
{ |
|||
return new AIToolPropertyDescriptor( |
|||
name, |
|||
PropertyValueType.Dictionary, |
|||
displayName, |
|||
description); |
|||
} |
|||
|
|||
public static AIToolPropertyDescriptor CreateSelectProperty( |
|||
string name, |
|||
ILocalizableString displayName, |
|||
List<NameValue<object>> options, |
|||
ILocalizableString? description = null) |
|||
{ |
|||
var propertyDescriptor = new AIToolPropertyDescriptor( |
|||
name, |
|||
PropertyValueType.Select, |
|||
displayName, |
|||
description); |
|||
|
|||
foreach (var option in options) |
|||
{ |
|||
propertyDescriptor.WithOption(option.Name, option.Value); |
|||
} |
|||
|
|||
return propertyDescriptor; |
|||
} |
|||
|
|||
public void WithOption(string name, object value) |
|||
{ |
|||
Options.Add(new NameValue<object>(name, value)); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue