Add smart ACK provider for WeChat MP replies
Replace fixed ackText with a rule-based AckProvider that picks response templates by message type and intent (translate, summary, rewrite, poster, ppt, mindmap, code, search, schedule). Pure sync, zero I/O, auto-falls back to config.ackText on any error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+16
-7
@@ -254,9 +254,10 @@ export function createPlazaRecommendService(
|
||||
}
|
||||
params.push(limit);
|
||||
const [rows] = await pool.query(
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon, pr.public_url
|
||||
FROM plaza_posts pp
|
||||
JOIN plaza_categories c ON c.id = pp.category_id
|
||||
JOIN h5_publish_records pr ON pr.id = pp.publication_id
|
||||
WHERE pp.status = ? ${filter}
|
||||
ORDER BY ${orderBy}
|
||||
LIMIT ?`,
|
||||
@@ -365,9 +366,10 @@ export function createPlazaRecommendService(
|
||||
}
|
||||
params.push(RECALL_LIMIT);
|
||||
const [rows] = await pool.query(
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon, pr.public_url
|
||||
FROM plaza_posts pp
|
||||
JOIN plaza_categories c ON c.id = pp.category_id
|
||||
JOIN h5_publish_records pr ON pr.id = pp.publication_id
|
||||
WHERE pp.status = ? ${filter}
|
||||
ORDER BY pp.hot_score DESC, pp.published_at DESC
|
||||
LIMIT ?`,
|
||||
@@ -387,9 +389,10 @@ export function createPlazaRecommendService(
|
||||
}
|
||||
params.push(RECALL_LIMIT);
|
||||
const [rows] = await pool.query(
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon, pr.public_url
|
||||
FROM plaza_posts pp
|
||||
JOIN plaza_categories c ON c.id = pp.category_id
|
||||
JOIN h5_publish_records pr ON pr.id = pp.publication_id
|
||||
WHERE pp.status = ? ${filter}
|
||||
ORDER BY pp.published_at DESC
|
||||
LIMIT ?`,
|
||||
@@ -414,6 +417,7 @@ export function createPlazaRecommendService(
|
||||
params.push(RECALL_LIMIT);
|
||||
const [rows] = await pool.query(
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon,
|
||||
pr.public_url,
|
||||
COUNT(*) AS overlap_score
|
||||
FROM plaza_reactions r1
|
||||
JOIN plaza_reactions r2
|
||||
@@ -422,6 +426,7 @@ export function createPlazaRecommendService(
|
||||
AND r2.post_id <> r1.post_id
|
||||
JOIN plaza_posts pp ON pp.id = r2.post_id AND pp.status = 'published'
|
||||
JOIN plaza_categories c ON c.id = pp.category_id
|
||||
JOIN h5_publish_records pr ON pr.id = pp.publication_id
|
||||
WHERE r1.type IN ('like', 'collect') ${filter}
|
||||
GROUP BY pp.id, c.name, c.slug, c.icon
|
||||
ORDER BY overlap_score DESC, pp.hot_score DESC
|
||||
@@ -444,9 +449,10 @@ export function createPlazaRecommendService(
|
||||
}
|
||||
params.push(RECALL_LIMIT);
|
||||
const [rows] = await pool.query(
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon, pr.public_url
|
||||
FROM plaza_posts pp
|
||||
JOIN plaza_categories c ON c.id = pp.category_id
|
||||
JOIN h5_publish_records pr ON pr.id = pp.publication_id
|
||||
WHERE pp.status = ? ${filter}
|
||||
ORDER BY pp.published_at DESC
|
||||
LIMIT ?`,
|
||||
@@ -468,9 +474,10 @@ export function createPlazaRecommendService(
|
||||
}
|
||||
params.push(Math.max(12, Math.floor(RECALL_LIMIT * config.explore_ratio)));
|
||||
const [rows] = await pool.query(
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon, pr.public_url
|
||||
FROM plaza_posts pp
|
||||
JOIN plaza_categories c ON c.id = pp.category_id
|
||||
JOIN h5_publish_records pr ON pr.id = pp.publication_id
|
||||
WHERE pp.status = ? ${filter}
|
||||
ORDER BY pp.published_at DESC, pp.hot_score DESC
|
||||
LIMIT ?`,
|
||||
@@ -492,9 +499,10 @@ export function createPlazaRecommendService(
|
||||
filter += tagMatch.clause;
|
||||
params.push(RECALL_LIMIT);
|
||||
const [rows] = await pool.query(
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon, pr.public_url
|
||||
FROM plaza_posts pp
|
||||
JOIN plaza_categories c ON c.id = pp.category_id
|
||||
JOIN h5_publish_records pr ON pr.id = pp.publication_id
|
||||
WHERE pp.status = ? ${filter}
|
||||
ORDER BY pp.hot_score DESC, pp.published_at DESC
|
||||
LIMIT ?`,
|
||||
@@ -530,9 +538,10 @@ export function createPlazaRecommendService(
|
||||
filter += tagMatch.clause;
|
||||
params.push(RECALL_LIMIT);
|
||||
const [rows] = await pool.query(
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon
|
||||
`SELECT pp.*, c.name AS category_name, c.slug AS category_slug, c.icon AS category_icon, pr.public_url
|
||||
FROM plaza_posts pp
|
||||
JOIN plaza_categories c ON c.id = pp.category_id
|
||||
JOIN h5_publish_records pr ON pr.id = pp.publication_id
|
||||
WHERE pp.status = ? ${filter}
|
||||
ORDER BY pp.published_at DESC, pp.hot_score DESC
|
||||
LIMIT ?`,
|
||||
|
||||
Reference in New Issue
Block a user