feat: 完成跨域处理

This commit is contained in:
ccnetcore
2025-07-04 00:16:58 +08:00
parent c637d412e6
commit a70dfb0769
3 changed files with 45 additions and 1 deletions

View File

@@ -167,6 +167,36 @@ public class OpenApiService : ApplicationService
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)
{
var output = new SendMessageOutputDto