更新 target/deepseek/ai.lua

This commit is contained in:
2026-06-28 00:00:56 +08:00
parent 64ffad1a52
commit 0f8d487926

View File

@@ -5,12 +5,15 @@ local cjson = require("cjson")
local M = {}
local url = "https://api.deepseek.com/chat/completions"
M.ask = function(key,content,model)
M.ask = function(key,content,model,is_json)
-- 构造 JSON 格式的请求数据
local payload = {
model = model,
messages = content
}
if is_json ~= nil and is_json == true then
payload["response_format"] = {type = "json_object"}
end
local response_body = {}
local res, code, response_headers, status = http.request{