fix: resolve all 6 prefer-const eslint errors for CI
This commit is contained in:
@@ -1236,7 +1236,7 @@ export async function cleanupAllOrphans() {
|
|||||||
const userId = session.user.id;
|
const userId = session.user.id;
|
||||||
let createdCount = 0;
|
let createdCount = 0;
|
||||||
let deletedCount = 0;
|
let deletedCount = 0;
|
||||||
let errors: any[] = [];
|
const errors: any[] = [];
|
||||||
try {
|
try {
|
||||||
const allNotes = await prisma.note.findMany({
|
const allNotes = await prisma.note.findMany({
|
||||||
where: { userId },
|
where: { userId },
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ async function getParentContext(
|
|||||||
include: { note: { select: { id: true, title: true, content: true } } },
|
include: { note: { select: { id: true, title: true, content: true } } },
|
||||||
})
|
})
|
||||||
|
|
||||||
let noteIds = refs.map(r => r.noteId).filter(Boolean) as string[]
|
const noteIds = refs.map(r => r.noteId).filter(Boolean) as string[]
|
||||||
|
|
||||||
const notes: ParentNoteRef[] = refs.map(r => ({
|
const notes: ParentNoteRef[] = refs.map(r => ({
|
||||||
noteId: r.noteId,
|
noteId: r.noteId,
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ Tu as accès à : note_search, note_read, document_search, task_extract, web_sea
|
|||||||
const contextBlock = contextNotes.length > 0 ? prompts.contextWithNotes : prompts.contextNoNotes
|
const contextBlock = contextNotes.length > 0 ? prompts.contextWithNotes : prompts.contextNoNotes
|
||||||
|
|
||||||
// Load note images for vision
|
// Load note images for vision
|
||||||
let imageContextParts: Array<{ type: 'image'; image: string }> = []
|
const imageContextParts: Array<{ type: 'image'; image: string }> = []
|
||||||
if (noteContext?.images && noteContext.images.length > 0) {
|
if (noteContext?.images && noteContext.images.length > 0) {
|
||||||
for (const imgPath of noteContext.images.slice(0, 4)) {
|
for (const imgPath of noteContext.images.slice(0, 4)) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export async function GET(request: NextRequest) {
|
|||||||
const notebookId = searchParams.get('notebookId')
|
const notebookId = searchParams.get('notebookId')
|
||||||
const limit = searchParams.get('limit') ? parseInt(searchParams.get('limit')!) : undefined
|
const limit = searchParams.get('limit') ? parseInt(searchParams.get('limit')!) : undefined
|
||||||
|
|
||||||
let where: any = {
|
const where: any = {
|
||||||
userId: session.user.id,
|
userId: session.user.id,
|
||||||
trashedAt: null
|
trashedAt: null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ toolRegistry.register({
|
|||||||
}),
|
}),
|
||||||
execute: async ({ notebookId, noteIds, locale }) => {
|
execute: async ({ notebookId, noteIds, locale }) => {
|
||||||
try {
|
try {
|
||||||
let where: any = { userId: ctx.userId, trashedAt: null }
|
const where: any = { userId: ctx.userId, trashedAt: null }
|
||||||
if (noteIds && noteIds.length > 0) {
|
if (noteIds && noteIds.length > 0) {
|
||||||
where.id = { in: noteIds }
|
where.id = { in: noteIds }
|
||||||
} else if (notebookId) {
|
} else if (notebookId) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const HTML_IMG = /<img[^>]+src=["']([^"']+)["'][^>]*>/gi
|
|||||||
*/
|
*/
|
||||||
export function stripMarkdownPreview(raw: string, maxLen = 180): string {
|
export function stripMarkdownPreview(raw: string, maxLen = 180): string {
|
||||||
if (!raw?.trim()) return ''
|
if (!raw?.trim()) return ''
|
||||||
let t = raw
|
const t = raw
|
||||||
.replace(/^#{1,6}\s+/gm, '')
|
.replace(/^#{1,6}\s+/gm, '')
|
||||||
.replace(/```[\s\S]*?```/g, ' ')
|
.replace(/```[\s\S]*?```/g, ' ')
|
||||||
.replace(/\*\*([^*]+)\*\*/g, '$1')
|
.replace(/\*\*([^*]+)\*\*/g, '$1')
|
||||||
|
|||||||
Reference in New Issue
Block a user