feat: 完成跨域处理
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
namespace Yi.Framework.AiHub.Application.Contracts.Dtos.OpenAiDto;
|
||||||
|
|
||||||
|
public class ModelGetOutput
|
||||||
|
{
|
||||||
|
public List<ModelDataOutput> Data { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ModelDataOutput
|
||||||
|
{
|
||||||
|
public string ModelId { get; set; }
|
||||||
|
public string Object { get; set; }
|
||||||
|
public string Owned_by { get; set; }
|
||||||
|
public List<string> Permission { get; set; }
|
||||||
|
}
|
||||||
@@ -167,6 +167,36 @@ public class OpenApiService : ApplicationService
|
|||||||
tokenUsage.OutputTokenCount);
|
tokenUsage.OutputTokenCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取模型列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("openApi/v1/models")]
|
||||||
|
public async Task<ModelGetOutput> ModelsAsync()
|
||||||
|
{
|
||||||
|
return new ModelGetOutput()
|
||||||
|
{
|
||||||
|
Data = new List<ModelDataOutput>()
|
||||||
|
{
|
||||||
|
new ModelDataOutput
|
||||||
|
{
|
||||||
|
ModelId = "gpt-4.1-mini",
|
||||||
|
Object = "model",
|
||||||
|
Owned_by = "organization-owner",
|
||||||
|
Permission = new List<string>()
|
||||||
|
},
|
||||||
|
new ModelDataOutput
|
||||||
|
{
|
||||||
|
ModelId = "gpt-4.1-nano",
|
||||||
|
Object = "model",
|
||||||
|
Owned_by = "organization-owner",
|
||||||
|
Permission = new List<string>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private SendMessageOutputDto MapToMessage(string modelId, string content)
|
private SendMessageOutputDto MapToMessage(string modelId, string content)
|
||||||
{
|
{
|
||||||
var output = new SendMessageOutputDto
|
var output = new SendMessageOutputDto
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
//应用启动
|
//应用启动
|
||||||
"App": {
|
"App": {
|
||||||
"SelfUrl": "http://*:19001",
|
"SelfUrl": "http://*:19001",
|
||||||
"CorsOrigins": "http://localhost:19001;http://localhost:18000"
|
"CorsOrigins": "http://localhost:19001;http://localhost:18000;vscode-file://vscode-app"
|
||||||
},
|
},
|
||||||
//配置
|
//配置
|
||||||
"Settings": {
|
"Settings": {
|
||||||
|
|||||||
Reference in New Issue
Block a user