debug completion
This commit is contained in:
parent
7ef56e9e48
commit
d33e9114a7
@ -10,6 +10,7 @@ end
|
||||
local function create_contents(prompt, context)
|
||||
local contents = {}
|
||||
|
||||
-- Add conversation history
|
||||
for _, message in ipairs(chat.get_conversation_history()) do
|
||||
table.insert(contents, {
|
||||
role = message.role,
|
||||
@ -17,6 +18,7 @@ local function create_contents(prompt, context)
|
||||
})
|
||||
end
|
||||
|
||||
-- Add current prompt
|
||||
if context then
|
||||
table.insert(contents, {
|
||||
role = "user",
|
||||
@ -29,6 +31,16 @@ local function create_contents(prompt, context)
|
||||
})
|
||||
end
|
||||
|
||||
-- Ensure we have at least one content item
|
||||
if #contents == 0 then
|
||||
contents = {
|
||||
{
|
||||
role = "user",
|
||||
parts = {{text = prompt}}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
return contents
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user