]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] initialize ollama result table 5385/head
authorJens Erat <email@jenserat.de>
Wed, 12 Mar 2025 23:45:36 +0000 (00:45 +0100)
committerJens Erat <email@jenserat.de>
Wed, 12 Mar 2025 23:45:36 +0000 (00:45 +0100)
similar to gpt.lua:704 for the chatgpt code path, the ollama code path needs to initialize the result table. Without, rspamd fails gpt requests with

> lua_http_finish_handler: callback call failed: /usr/share/rspamd/plugins/gpt.lua:740: attempt to index a nil value

src/plugins/lua/gpt.lua

index 1d5c4b21e7c5b0b617e3b12ab834d95133c9abe8..98a3e38ee574bd096678cf0015d908f11258ddda 100644 (file)
@@ -807,6 +807,10 @@ local function ollama_check(task, content, sel_part)
       body.response_format = { type = "json_object" }
     end
 
+    results[i] = {
+      success = false,
+      checked = false
+    }
     body.model = model
 
     upstream = settings.upstreams:get_upstream_round_robin()