Skip to content

Commit d830352

Browse files
committed
代码
1 parent 979d4c6 commit d830352

2 files changed

Lines changed: 12 additions & 83 deletions

File tree

DirectorPrompt.Infrastructure/AI/EmbeddingService.cs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,16 @@
66

77
namespace DirectorPrompt.Infrastructure.AI;
88

9-
public sealed class EmbeddingService : IEmbeddingService
9+
public sealed class EmbeddingService
10+
(
11+
string provider,
12+
string endpoint,
13+
string? apiKey,
14+
string modelName,
15+
string? customHeaders = null
16+
)
17+
: IEmbeddingService
1018
{
11-
private readonly string provider;
12-
private readonly string endpoint;
13-
private readonly string? apiKey;
14-
private readonly string modelName;
15-
private readonly string? customHeaders;
16-
17-
public EmbeddingService(string provider, string endpoint, string? apiKey, string modelName, string? customHeaders = null)
18-
{
19-
this.provider = provider;
20-
this.endpoint = endpoint;
21-
this.apiKey = apiKey;
22-
this.modelName = modelName;
23-
this.customHeaders = customHeaders;
24-
}
25-
2619
public EmbeddingService(ResolvedEmbeddingConfig config) : this(config.Provider, config.Endpoint, config.APIKey, config.ModelName, config.CustomHeaders)
2720
{
2821
}
@@ -72,12 +65,12 @@ private IEmbeddingGenerator<string, Embedding<float>> CreateGenerator()
7265
return embeddingClient.AsIEmbeddingGenerator();
7366
}
7467

75-
private OpenAIClient CreateOpenAIClient(string endpoint)
68+
private OpenAIClient CreateOpenAIClient(string endPoint)
7669
{
7770
OpenAIClientOptions options = new();
7871

79-
if (!string.IsNullOrWhiteSpace(endpoint))
80-
options.Endpoint = new Uri(endpoint);
72+
if (!string.IsNullOrWhiteSpace(endPoint))
73+
options.Endpoint = new Uri(endPoint);
8174

8275
CustomHeaderPipelinePolicy.ApplyToOptions(options, customHeaders);
8376

DirectorPrompt.Infrastructure/AI/ResilienceExtensions.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)