chore: rotate OpenAI key, point Qdrant at local dev instance
Switch Qdrant from cloud (GCP europe-west3) to local Tailscale host (100.117.141.100) with TLS disabled. Rotate OpenAI API key in appsettings and embedding service. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
00417c4cf8
commit
e0325bb4bb
|
|
@ -6,7 +6,7 @@ using Newtonsoft.Json;
|
|||
|
||||
public class OpenAIEmbeddingService
|
||||
{
|
||||
private readonly string _apiKey = "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";
|
||||
private readonly string _apiKey = "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";
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
public OpenAIEmbeddingService()
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ namespace BLAIzor.Services
|
|||
public class QDrantService
|
||||
{
|
||||
public static IConfiguration? _configuration;
|
||||
private string qdrantUrl = "https://fe7d5c9e-8cd1-4ad9-af5a-af2bf3b93219.europe-west3-0.gcp.cloud.qdrant.io:6333";
|
||||
private readonly string _qdrantHost = "fe7d5c9e-8cd1-4ad9-af5a-af2bf3b93219.europe-west3-0.gcp.cloud.qdrant.io";
|
||||
//private string qdrantUrl = "https://fe7d5c9e-8cd1-4ad9-af5a-af2bf3b93219.europe-west3-0.gcp.cloud.qdrant.io:6333";
|
||||
private string qdrantUrl = "http://100.117.141.100:6333";
|
||||
//private readonly string _qdrantHost = "fe7d5c9e-8cd1-4ad9-af5a-af2bf3b93219.europe-west3-0.gcp.cloud.qdrant.io";
|
||||
private readonly string _qdrantHost = "100.117.141.100";
|
||||
|
||||
private string _apiKey = "";
|
||||
|
||||
|
|
@ -44,7 +46,7 @@ namespace BLAIzor.Services
|
|||
public async Task<int> GetCollectionCount(string collectionName)
|
||||
{
|
||||
_apiKey = GetApiKey();
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
var result = await client.CountAsync(
|
||||
collectionName: collectionName,
|
||||
exact: true
|
||||
|
|
@ -68,7 +70,7 @@ namespace BLAIzor.Services
|
|||
public async Task<bool> CollectionExistsAsync(string collectionName)
|
||||
{
|
||||
_apiKey = GetApiKey();
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
return await client.CollectionExistsAsync(collectionName);
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +78,7 @@ namespace BLAIzor.Services
|
|||
{
|
||||
_apiKey = GetApiKey();
|
||||
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
bool doesExist = await CollectionExistsAsync(collectionName);
|
||||
if (doesExist)
|
||||
{
|
||||
|
|
@ -168,7 +170,7 @@ namespace BLAIzor.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
bool doesExist = await client.CollectionExistsAsync(site.VectorCollectionName);
|
||||
if (!doesExist)
|
||||
{
|
||||
|
|
@ -249,7 +251,7 @@ namespace BLAIzor.Services
|
|||
|
||||
List<WebPageContent> pageContent = new();
|
||||
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
bool doesExist = await client.CollectionExistsAsync(collectionName);
|
||||
|
||||
var result = await client.RetrieveAsync(
|
||||
|
|
@ -299,7 +301,7 @@ namespace BLAIzor.Services
|
|||
|
||||
List<WebPageContent> contentList = new();
|
||||
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
var result = await client.RetrieveAsync(
|
||||
collectionName: $"Site{siteId.ToString()}",
|
||||
id: Convert.ToUInt64(pointId),
|
||||
|
|
@ -367,7 +369,7 @@ namespace BLAIzor.Services
|
|||
_apiKey = GetApiKey();
|
||||
|
||||
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
|
||||
var doesCollectionExist = await client.CollectionExistsAsync(collectionName);
|
||||
if (doesCollectionExist)
|
||||
|
|
@ -475,7 +477,7 @@ namespace BLAIzor.Services
|
|||
|
||||
_apiKey = GetApiKey();
|
||||
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
var pointStruct = new PointStruct();
|
||||
|
||||
pointStruct = new PointStruct
|
||||
|
|
@ -505,7 +507,7 @@ namespace BLAIzor.Services
|
|||
|
||||
_apiKey = GetApiKey();
|
||||
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
var pointStructList = new List<PointStruct>();
|
||||
for (int i = 0; i < ids.Count; i++)
|
||||
{
|
||||
|
|
@ -535,7 +537,7 @@ namespace BLAIzor.Services
|
|||
|
||||
_apiKey = GetApiKey();
|
||||
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
var pointStructList = new List<PointStruct>();
|
||||
for (int i = 0; i < chunks.Count; i++)
|
||||
{
|
||||
|
|
@ -576,7 +578,7 @@ namespace BLAIzor.Services
|
|||
public async Task DeletePointAsync(int pointId, string collectionName)
|
||||
{
|
||||
_apiKey = GetApiKey();
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
|
||||
var result = await client.DeleteAsync(collectionName: "{collection_name}", ids: [(ulong)pointId]);
|
||||
Console.WriteLine(result.Status);
|
||||
|
|
@ -585,7 +587,7 @@ namespace BLAIzor.Services
|
|||
public async Task DeletePointsAsync(ulong[] pointIds, string collectionName)
|
||||
{
|
||||
_apiKey = GetApiKey();
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
|
||||
var result = await client.DeleteAsync(collectionName: collectionName, ids: pointIds);
|
||||
Console.WriteLine(result.Status);
|
||||
|
|
@ -593,7 +595,7 @@ namespace BLAIzor.Services
|
|||
public async Task DeletePointsAsync(Guid[] pointIds, string collectionName)
|
||||
{
|
||||
_apiKey = GetApiKey();
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
|
||||
var result = await client.DeleteAsync(collectionName: collectionName, ids: pointIds);
|
||||
Console.WriteLine(result.Status);
|
||||
|
|
@ -604,7 +606,7 @@ namespace BLAIzor.Services
|
|||
|
||||
_apiKey = GetApiKey();
|
||||
|
||||
var client = new QdrantClient(_qdrantHost, 6334, true, _apiKey);
|
||||
var client = new QdrantClient(_qdrantHost, 6334, false, _apiKey);
|
||||
await client.DeleteCollectionAsync(collectionName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
},
|
||||
"OpenAI": {
|
||||
//"CredentialsPath": "D:\\GOOGLECREDENTIALS\\client_secret_359861037120-m3mjvr3kg51i2c2qb38dav62uuqoqs5k.apps.googleusercontent.com.json"
|
||||
"ApiKey": "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",
|
||||
"ApiKey": "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",
|
||||
//"ApiKey": "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" //VG3Law
|
||||
//"Model": "gpt-4.1-mini"
|
||||
//"Model": "gpt-4o-mini"
|
||||
|
|
|
|||
Loading…
Reference in New Issue