@open-mercato/search 0.10.1-develop.8025.1.620dfa185f → 0.10.1-develop.8026.1.a65d0b4a3f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/modules/search/__integration__/TC-SEARCH-015.spec.js +75 -0
- package/dist/modules/search/__integration__/TC-SEARCH-015.spec.js.map +7 -0
- package/dist/modules/search/api/embeddings/route.js +9 -6
- package/dist/modules/search/api/embeddings/route.js.map +2 -2
- package/dist/modules/search/api/settings/fulltext/route.js +5 -4
- package/dist/modules/search/api/settings/fulltext/route.js.map +2 -2
- package/dist/modules/search/i18n/de.json +10 -0
- package/dist/modules/search/i18n/en.json +10 -0
- package/dist/modules/search/i18n/es.json +10 -0
- package/dist/modules/search/i18n/ko.json +10 -0
- package/dist/modules/search/i18n/pl.json +10 -0
- package/dist/modules/search/lib/provider-diagnostics.js +30 -0
- package/dist/modules/search/lib/provider-diagnostics.js.map +7 -0
- package/dist/modules/search/lib/provider-probe.js +30 -9
- package/dist/modules/search/lib/provider-probe.js.map +2 -2
- package/package.json +4 -4
- package/src/modules/search/__integration__/TC-SEARCH-015.spec.ts +65 -0
- package/src/modules/search/api/__tests__/settings-diagnostics.routes.test.ts +166 -0
- package/src/modules/search/api/embeddings/route.ts +10 -5
- package/src/modules/search/api/settings/fulltext/route.ts +6 -4
- package/src/modules/search/i18n/de.json +10 -0
- package/src/modules/search/i18n/en.json +10 -0
- package/src/modules/search/i18n/es.json +10 -0
- package/src/modules/search/i18n/ko.json +10 -0
- package/src/modules/search/i18n/pl.json +10 -0
- package/src/modules/search/lib/provider-diagnostics.ts +33 -0
- package/src/modules/search/lib/provider-probe.ts +30 -8
|
@@ -4,13 +4,14 @@ import type { EmbeddingProviderId } from '../../../vector'
|
|
|
4
4
|
import { EMBEDDING_PROVIDERS } from '../../../vector'
|
|
5
5
|
import { safeOllamaFetch } from '../../../vector/lib/ollama-url-safety'
|
|
6
6
|
|
|
7
|
-
const CACHE_VERSION = '
|
|
7
|
+
const CACHE_VERSION = 'v2'
|
|
8
8
|
const CACHE_TTL_MS = 30_000
|
|
9
9
|
const OLLAMA_PROBE_TIMEOUT_MS = 1500
|
|
10
10
|
|
|
11
11
|
export type ProviderAvailability = {
|
|
12
12
|
available: boolean
|
|
13
13
|
reason?: string
|
|
14
|
+
diagnostic?: { key: string; params?: Record<string, string | number> }
|
|
14
15
|
models?: number
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -58,25 +59,45 @@ const keyPresence = (providerId: EmbeddingProviderId): ProviderAvailability => {
|
|
|
58
59
|
case 'openai':
|
|
59
60
|
return process.env.OPENAI_API_KEY?.trim()
|
|
60
61
|
? { available: true }
|
|
61
|
-
: {
|
|
62
|
+
: {
|
|
63
|
+
available: false,
|
|
64
|
+
reason: `Set ${envKey} to enable ${info?.name ?? providerId}`,
|
|
65
|
+
diagnostic: { key: 'missingKey', params: { envKey: envKey ?? '', provider: info?.name ?? providerId } },
|
|
66
|
+
}
|
|
62
67
|
case 'google':
|
|
63
68
|
return process.env.GOOGLE_GENERATIVE_AI_API_KEY?.trim()
|
|
64
69
|
? { available: true }
|
|
65
|
-
: {
|
|
70
|
+
: {
|
|
71
|
+
available: false,
|
|
72
|
+
reason: `Set ${envKey} to enable ${info?.name ?? providerId}`,
|
|
73
|
+
diagnostic: { key: 'missingKey', params: { envKey: envKey ?? '', provider: info?.name ?? providerId } },
|
|
74
|
+
}
|
|
66
75
|
case 'mistral':
|
|
67
76
|
return process.env.MISTRAL_API_KEY?.trim()
|
|
68
77
|
? { available: true }
|
|
69
|
-
: {
|
|
78
|
+
: {
|
|
79
|
+
available: false,
|
|
80
|
+
reason: `Set ${envKey} to enable ${info?.name ?? providerId}`,
|
|
81
|
+
diagnostic: { key: 'missingKey', params: { envKey: envKey ?? '', provider: info?.name ?? providerId } },
|
|
82
|
+
}
|
|
70
83
|
case 'cohere':
|
|
71
84
|
return process.env.COHERE_API_KEY?.trim()
|
|
72
85
|
? { available: true }
|
|
73
|
-
: {
|
|
86
|
+
: {
|
|
87
|
+
available: false,
|
|
88
|
+
reason: `Set ${envKey} to enable ${info?.name ?? providerId}`,
|
|
89
|
+
diagnostic: { key: 'missingKey', params: { envKey: envKey ?? '', provider: info?.name ?? providerId } },
|
|
90
|
+
}
|
|
74
91
|
case 'bedrock':
|
|
75
92
|
return process.env.AWS_ACCESS_KEY_ID?.trim() && process.env.AWS_SECRET_ACCESS_KEY?.trim()
|
|
76
93
|
? { available: true }
|
|
77
|
-
: {
|
|
94
|
+
: {
|
|
95
|
+
available: false,
|
|
96
|
+
reason: 'Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to enable Bedrock',
|
|
97
|
+
diagnostic: { key: 'missingKey', params: { envKey: 'AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY', provider: 'Bedrock' } },
|
|
98
|
+
}
|
|
78
99
|
default:
|
|
79
|
-
return { available: false, reason: `Unknown provider: ${providerId}
|
|
100
|
+
return { available: false, reason: `Unknown provider: ${providerId}`, diagnostic: { key: 'unknownProvider', params: { provider: providerId } } }
|
|
80
101
|
}
|
|
81
102
|
}
|
|
82
103
|
|
|
@@ -89,7 +110,7 @@ export async function probeOllama(baseUrl: string): Promise<ProviderAvailability
|
|
|
89
110
|
signal: controller.signal,
|
|
90
111
|
})
|
|
91
112
|
if (!response.ok) {
|
|
92
|
-
return { available: false, reason: `Ollama responded ${response.status} at ${baseUrl}
|
|
113
|
+
return { available: false, reason: `Ollama responded ${response.status} at ${baseUrl}`, diagnostic: { key: 'ollamaResponse', params: { status: response.status, baseUrl } } }
|
|
93
114
|
}
|
|
94
115
|
let models: number | undefined
|
|
95
116
|
try {
|
|
@@ -102,6 +123,7 @@ export async function probeOllama(baseUrl: string): Promise<ProviderAvailability
|
|
|
102
123
|
return {
|
|
103
124
|
available: false,
|
|
104
125
|
reason: aborted ? `Ollama not reachable at ${baseUrl} (timed out)` : `Ollama not reachable at ${baseUrl}`,
|
|
126
|
+
diagnostic: { key: aborted ? 'ollamaTimeout' : 'ollamaUnreachable', params: { baseUrl } },
|
|
105
127
|
}
|
|
106
128
|
} finally {
|
|
107
129
|
clearTimeout(timer)
|