@o-lang/semantic-doc-search 1.0.4 → 1.0.5
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/package.json +1 -1
- package/src/index.js +14 -11
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// doc-search.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { createLLM } = require("./llm/router.js");
|
|
5
|
+
const { LocalEmbedding } = require("./embeddings/local.js");
|
|
6
|
+
const { chunkText } = require("./utils/chunker.js");
|
|
7
|
+
const { extractKeywords } = require("./utils/extractText.js");
|
|
8
|
+
const { cosine } = require("./utils/similarity.js");
|
|
9
|
+
const { highlightMatches } = require("./utils/highlight.js");
|
|
10
10
|
|
|
11
11
|
const CACHE_PATH = path.join(process.cwd(), "embeddings.json");
|
|
12
12
|
|
|
@@ -396,8 +396,8 @@ async function performDocQA(query, context = {}) {
|
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
// ✅ O-Lang Resolver Interface (Your existing interface)
|
|
400
|
-
|
|
399
|
+
// ✅ O-Lang Resolver Interface (Your existing interface - converted to CommonJS)
|
|
400
|
+
async function docSearchResolver(action, context) {
|
|
401
401
|
if (action.startsWith('Ask doc-search ')) {
|
|
402
402
|
const match = action.match(/"(.*)"|'(.*)'/);
|
|
403
403
|
const query = match ? (match[1] || match[2]) : action.replace(/^Ask doc-search\s+/, '').trim();
|
|
@@ -407,4 +407,7 @@ export default async function docSearchResolver(action, context) {
|
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
// ✅ Resolver name matches package name: @o-lang/doc-search → doc-search
|
|
410
|
-
docSearchResolver.resolverName = 'doc-search';
|
|
410
|
+
docSearchResolver.resolverName = 'doc-search';
|
|
411
|
+
|
|
412
|
+
// ✅ COMMONJS EXPORT (this is the key change)
|
|
413
|
+
module.exports = docSearchResolver;
|