mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
feat(react/ribbon): port similar notes
This commit is contained in:
@@ -4,6 +4,7 @@ import beccaService from "./becca_service.js";
|
||||
import dateUtils from "../services/date_utils.js";
|
||||
import { JSDOM } from "jsdom";
|
||||
import type BNote from "./entities/bnote.js";
|
||||
import { SimilarNote } from "@triliumnext/commons";
|
||||
|
||||
const DEBUG = false;
|
||||
|
||||
@@ -36,12 +37,6 @@ interface DateLimits {
|
||||
maxDate: string;
|
||||
}
|
||||
|
||||
export interface SimilarNote {
|
||||
score: number;
|
||||
notePath: string[];
|
||||
noteId: string;
|
||||
}
|
||||
|
||||
function filterUrlValue(value: string) {
|
||||
return value
|
||||
.replace(/https?:\/\//gi, "")
|
||||
|
||||
@@ -4,13 +4,14 @@ import type { Request } from "express";
|
||||
|
||||
import similarityService from "../../becca/similarity.js";
|
||||
import becca from "../../becca/becca.js";
|
||||
import { SimilarNoteResponse } from "@triliumnext/commons";
|
||||
|
||||
async function getSimilarNotes(req: Request) {
|
||||
const noteId = req.params.noteId;
|
||||
|
||||
const _note = becca.getNoteOrThrow(noteId);
|
||||
|
||||
return await similarityService.findSimilarNotes(noteId);
|
||||
return (await similarityService.findSimilarNotes(noteId) satisfies SimilarNoteResponse);
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
Reference in New Issue
Block a user