基本完成深度思考内容
This commit is contained in:
@@ -1436,7 +1436,7 @@ app.post("/analyze", upload.single("file"), async (req, res) => {
|
||||
console.log(existingTitle, rows?.[0], 9999, rows);
|
||||
|
||||
const sessId = sessionId || Date.now().toString();
|
||||
|
||||
const MAX_HISTORY = 6;
|
||||
// ------------------ 获取历史对话(上下文) ------------------
|
||||
const [historyRows] = await pool.query(
|
||||
"SELECT role, content, image_base64 FROM ai_chat_messages WHERE session_id = ? AND user_id = ? ORDER BY created_at ASC",
|
||||
@@ -1444,7 +1444,7 @@ app.post("/analyze", upload.single("file"), async (req, res) => {
|
||||
);
|
||||
|
||||
// 构建历史消息数组
|
||||
const historyMessages = historyRows.map(row => {
|
||||
const historyMessages = historyRows.slice(-MAX_HISTORY).map(row => {
|
||||
const message = {
|
||||
role: row.role,
|
||||
content: []
|
||||
@@ -1532,7 +1532,7 @@ app.post("/analyze", upload.single("file"), async (req, res) => {
|
||||
];
|
||||
|
||||
const completion = await client.chat.completions.create({
|
||||
model: "gpt-4.1",
|
||||
model: "gpt-4.1-mini",
|
||||
stream: true,
|
||||
messages: imageAnalysisMessages
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user