From 214f82b0b1b9eb9ff5366551c4059191baf43678 Mon Sep 17 00:00:00 2001 From: Tangent Date: Tue, 15 Sep 2026 22:28:53 -0600 Subject: [PATCH] remove debug printing, workaround for EOF Ollama error #7 --- refresh_sources.lua | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/refresh_sources.lua b/refresh_sources.lua index 963b905..3d4fdf0 100755 --- a/refresh_sources.lua +++ b/refresh_sources.lua @@ -107,15 +107,22 @@ local process_file = function(data_source, file_name) local new_embeddings = {} for i = 1, #chunks do - print("Embedding length:", #chunks[i]) + -- print("Embedding length:", #chunks[i]) new_embeddings[i] = generate_embeddings(chunks[i]) or {} end if #new_embeddings[1] == 0 then - print(file_name) - print("Vector lengths:") - for e = 1, #new_embeddings do - print("", e, #new_embeddings[e]) + -- print(file_name) + -- print("Vector lengths:") + -- for e = 1, #new_embeddings do + -- print("", e, #new_embeddings[e]) + -- end + if #new_embeddings == 1 then + -- Ollama very rarely errors with: + -- Error: do embedding request: Post "http://127.0.0.1:53441/v1/embeddings": EOF + -- but it is inconsistent and re-running will eventually fix it. (See issue #7 if present.) + print(file_name .. "\n encountered an embedding error and will be skipped this run only.") + return end -- average all embeddings to make the core file embedding @@ -145,7 +152,13 @@ local refresh_sources = function() local file_name = file_list[f] local function loop() local sha512sum = utility.sha512sum(file_name) - if embeddings.vectors[sha512sum] then return end + if embeddings.vectors[sha512sum] then + -- add file reference if it was missing + if not embeddings.files[file_name] then + embeddings.files[file_name] = sha512sum + end + return + end local file_chunks, file_embeddings = process_file(data_source, file_name) if not file_chunks then return end