feat: implement dashboard store and API routes for city market scanning and analysis

This commit is contained in:
2569718930@qq.com
2026-04-24 12:46:44 +08:00
parent c61a3f500d
commit 467f736602
8 changed files with 723 additions and 41 deletions
+14 -1
View File
@@ -470,6 +470,18 @@ function buildFallbackAnswer(
};
}
function shouldUseRuleAnswer(
question: string,
context: ReturnType<typeof sanitizeContext>,
) {
if (detectUnsupported(question)) return true;
if (findMentionedCity(question, context)) return true;
if (isForecastQuestion(question)) return true;
return /当前|市场|机会|值得|参与|买|卖|yes|no|edge|排序|风险|概率|probability|emos|deb|价格|盘口|高风险|低风险|model|forecast|temperature|rank|buy|sell/i.test(
question,
);
}
async function generateWithGroq(params: {
question: string;
locale: string;
@@ -636,7 +648,8 @@ export async function POST(request: NextRequest) {
model: "rule-fallback",
};
if (!fallback.refused) {
const useRuleAnswer = shouldUseRuleAnswer(question, context);
if (!fallback.refused && !useRuleAnswer) {
try {
const generated = await generateWithGroq({
question,