Remove CRM chat fallback responses
This commit is contained in:
@@ -111,10 +111,14 @@ export async function runCrmAgentFor(
|
||||
process.env.QWEN_API_KEY;
|
||||
const hasGigachat = Boolean((process.env.GIGACHAT_AUTH_KEY ?? "").trim() && (process.env.GIGACHAT_SCOPE ?? "").trim());
|
||||
|
||||
if (mode !== "rule" && (llmApiKey || hasGigachat)) {
|
||||
if (mode !== "rule") {
|
||||
return runLangGraphCrmAgentFor(input);
|
||||
}
|
||||
|
||||
if (!llmApiKey && !hasGigachat) {
|
||||
throw new Error("LLM API key is not configured. Set OPENROUTER_API_KEY or GIGACHAT_AUTH_KEY/GIGACHAT_SCOPE.");
|
||||
}
|
||||
|
||||
await ensureDataset({ teamId: input.teamId, userId: input.userId });
|
||||
const q = normalize(input.userText);
|
||||
const root = datasetRoot({ teamId: input.teamId, userId: input.userId });
|
||||
@@ -220,18 +224,9 @@ export async function runCrmAgentFor(
|
||||
};
|
||||
}
|
||||
|
||||
// Default: keep it simple, ask for intent + show what the agent can do.
|
||||
return {
|
||||
plan: ["Уточнить цель", "Выбрать данные для анализа", "Предложить план действий и, если нужно, изменения в CRM"],
|
||||
tools: ["read index/contacts.json (по необходимости)", "search messages/events (по необходимости)"],
|
||||
toolRuns: [],
|
||||
text:
|
||||
"Ок. Скажи, что нужно сделать.\n" +
|
||||
"Примеры:\n" +
|
||||
"- \"покажи 10 лучших клиентов\"\n" +
|
||||
"- \"чем мне сегодня заняться\"\n" +
|
||||
"- \"составь план касаний на неделю\"\n",
|
||||
};
|
||||
throw new Error(
|
||||
"Rule mode has no fallback responses. Use a supported structured query or switch to langgraph mode with a configured LLM API key.",
|
||||
);
|
||||
}
|
||||
|
||||
export async function persistChatMessage(input: {
|
||||
|
||||
Reference in New Issue
Block a user