Spaces:
Configuration error
Configuration error
Deploy trask-http from community-bots@1522b1f5c5e8f27536c525d3d1b71f5175563359
Browse files
apps/trask-http-server/src/main.ts
CHANGED
|
@@ -61,6 +61,7 @@ const config = loadTraskHttpServerConfig();
|
|
| 61 |
const resolveFromRoot = (p: string) => (path.isAbsolute(p) ? p : path.resolve(repoRoot, p));
|
| 62 |
|
| 63 |
const queryRepository = new JsonTraskQueryRepository(resolveDataFile(resolveFromRoot(config.dataDir), "trask-queries.json"));
|
|
|
|
| 64 |
const searchProvider = createChunkSearchProvider(resolveFromRoot(config.chunkDir));
|
| 65 |
const webResearch = createResearchWizardClient(config.researchWizard, config.ai);
|
| 66 |
|
|
|
|
| 61 |
const resolveFromRoot = (p: string) => (path.isAbsolute(p) ? p : path.resolve(repoRoot, p));
|
| 62 |
|
| 63 |
const queryRepository = new JsonTraskQueryRepository(resolveDataFile(resolveFromRoot(config.dataDir), "trask-queries.json"));
|
| 64 |
+
/** Legacy FileChunkStore queue surface only; Holocron compose uses Chroma retrieve (`TRASK_INDEXER_BASE_URL`). */
|
| 65 |
const searchProvider = createChunkSearchProvider(resolveFromRoot(config.chunkDir));
|
| 66 |
const webResearch = createResearchWizardClient(config.researchWizard, config.ai);
|
| 67 |
|
packages/trask/src/research-wizard.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
| 8 |
sourceUrlMatchesDescriptor,
|
| 9 |
traskApprovedResearchBaseHosts,
|
| 10 |
traskApprovedResearchSources,
|
| 11 |
-
type SearchProvider,
|
| 12 |
type SourceDescriptor,
|
| 13 |
} from "@openkotor/retrieval";
|
| 14 |
import {
|
|
@@ -1157,7 +1156,6 @@ export class ResearchWizardClient implements ResearchWizardQueryHandler {
|
|
| 1157 |
private readonly config: ResearchWizardRuntimeConfig,
|
| 1158 |
private readonly aiConfig: SharedAiConfig,
|
| 1159 |
private readonly approvedSources: readonly SourceDescriptor[] = traskApprovedResearchSources,
|
| 1160 |
-
private readonly localSearchProvider?: SearchProvider,
|
| 1161 |
) {
|
| 1162 |
this.openAiClient = aiConfig.openAiApiKey
|
| 1163 |
? new OpenAI({
|
|
@@ -1304,24 +1302,6 @@ export class ResearchWizardClient implements ResearchWizardQueryHandler {
|
|
| 1304 |
return fallbackDiscordBrief(query, report, approvedSources);
|
| 1305 |
}
|
| 1306 |
|
| 1307 |
-
private async searchLocalKnowledge(query: string): Promise<string> {
|
| 1308 |
-
if (!this.localSearchProvider) return "";
|
| 1309 |
-
try {
|
| 1310 |
-
const hits = await this.localSearchProvider.search(query, 4);
|
| 1311 |
-
const approved = hits.filter((hit) => isTraskApprovedBaseUrl(hit.url));
|
| 1312 |
-
if (approved.length === 0) return "";
|
| 1313 |
-
const lines = approved.map(
|
| 1314 |
-
(hit) => `- ${hit.title}: ${hit.snippet} (${hit.url})`,
|
| 1315 |
-
);
|
| 1316 |
-
return [
|
| 1317 |
-
"Local Knowledge Context (lower authority than live web research; never cite as https Sources):",
|
| 1318 |
-
...lines,
|
| 1319 |
-
].join("\n");
|
| 1320 |
-
} catch {
|
| 1321 |
-
return "";
|
| 1322 |
-
}
|
| 1323 |
-
}
|
| 1324 |
-
|
| 1325 |
private passagesSupportLlmRewrite(
|
| 1326 |
query: string,
|
| 1327 |
report: string,
|
|
@@ -1907,9 +1887,8 @@ export class ResearchWizardClient implements ResearchWizardQueryHandler {
|
|
| 1907 |
export const createResearchWizardClient = (
|
| 1908 |
config: ResearchWizardRuntimeConfig,
|
| 1909 |
aiConfig: SharedAiConfig = loadSharedAiConfig(),
|
| 1910 |
-
localSearchProvider?: SearchProvider,
|
| 1911 |
): ResearchWizardClient => {
|
| 1912 |
-
return new ResearchWizardClient(config, aiConfig, traskApprovedResearchSources
|
| 1913 |
};
|
| 1914 |
|
| 1915 |
// ---------------------------------------------------------------------------
|
|
|
|
| 8 |
sourceUrlMatchesDescriptor,
|
| 9 |
traskApprovedResearchBaseHosts,
|
| 10 |
traskApprovedResearchSources,
|
|
|
|
| 11 |
type SourceDescriptor,
|
| 12 |
} from "@openkotor/retrieval";
|
| 13 |
import {
|
|
|
|
| 1156 |
private readonly config: ResearchWizardRuntimeConfig,
|
| 1157 |
private readonly aiConfig: SharedAiConfig,
|
| 1158 |
private readonly approvedSources: readonly SourceDescriptor[] = traskApprovedResearchSources,
|
|
|
|
| 1159 |
) {
|
| 1160 |
this.openAiClient = aiConfig.openAiApiKey
|
| 1161 |
? new OpenAI({
|
|
|
|
| 1302 |
return fallbackDiscordBrief(query, report, approvedSources);
|
| 1303 |
}
|
| 1304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1305 |
private passagesSupportLlmRewrite(
|
| 1306 |
query: string,
|
| 1307 |
report: string,
|
|
|
|
| 1887 |
export const createResearchWizardClient = (
|
| 1888 |
config: ResearchWizardRuntimeConfig,
|
| 1889 |
aiConfig: SharedAiConfig = loadSharedAiConfig(),
|
|
|
|
| 1890 |
): ResearchWizardClient => {
|
| 1891 |
+
return new ResearchWizardClient(config, aiConfig, traskApprovedResearchSources);
|
| 1892 |
};
|
| 1893 |
|
| 1894 |
// ---------------------------------------------------------------------------
|