]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Add from and subject to the prompt
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 29 Jun 2024 12:27:25 +0000 (13:27 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 29 Jun 2024 12:27:25 +0000 (13:27 +0100)
src/plugins/lua/gpt.lua

index e12bcf8071576eb98304eef3bb7b1b1597e9badc..a2db2123ebfc0784003a0406c6ca5a1e1a112f1d 100644 (file)
@@ -15,6 +15,7 @@ limitations under the License.
 ]] --
 
 local N = "gpt"
+local E = {}
 
 if confighelp then
   rspamd_config:add_example(nil, 'gpt',
@@ -245,6 +246,14 @@ local function openai_gpt_check(task)
         role = 'system',
         content = settings.prompt
       },
+      {
+        role = 'user',
+        content = 'Subject: ' .. task:get_subject() or '',
+      },
+      {
+        role = 'user',
+        content = 'From: ' .. ((task:get_from('mime') or E)[1] or E).name or '',
+      },
       {
         role = 'user',
         content = content