|
@@ -19,6 +19,13 @@ export function routeNaturalLanguageIntent(
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (/^\/write$/i.test(trimmed)) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ intent: "write_next",
|
|
|
|
|
+ ...(bookId ? { bookId } : {}),
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (/^(pause|pause this book|暂停|暂停这本书)$/i.test(trimmed)) {
|
|
if (/^(pause|pause this book|暂停|暂停这本书)$/i.test(trimmed)) {
|
|
|
return {
|
|
return {
|
|
|
intent: "pause_book",
|
|
intent: "pause_book",
|
|
@@ -26,6 +33,14 @@ export function routeNaturalLanguageIntent(
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const modeCommand = trimmed.match(/^\/mode\s+(auto|semi|manual)$/i);
|
|
|
|
|
+ if (modeCommand) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ intent: "switch_mode",
|
|
|
|
|
+ mode: modeCommand[1]!.toLowerCase() as "auto" | "semi" | "manual",
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (/(全自动|auto mode|switch to auto|切换到全自动)/i.test(trimmed)) {
|
|
if (/(全自动|auto mode|switch to auto|切换到全自动)/i.test(trimmed)) {
|
|
|
return {
|
|
return {
|
|
|
intent: "switch_mode",
|
|
intent: "switch_mode",
|
|
@@ -47,6 +62,24 @@ export function routeNaturalLanguageIntent(
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const slashRewrite = trimmed.match(/^\/rewrite\s+(\d+)$/i);
|
|
|
|
|
+ if (slashRewrite) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ intent: "rewrite_chapter",
|
|
|
|
|
+ ...(bookId ? { bookId } : {}),
|
|
|
|
|
+ chapterNumber: parseInt(slashRewrite[1]!, 10),
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const slashFocus = trimmed.match(/^\/focus\s+(.+)$/i);
|
|
|
|
|
+ if (slashFocus) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ intent: "update_focus",
|
|
|
|
|
+ ...(bookId ? { bookId } : {}),
|
|
|
|
|
+ instruction: slashFocus[1]!.trim(),
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const rewriteMatch = trimmed.match(/(?:rewrite chapter|重写第)\s*(\d+)\s*(?:章)?/i);
|
|
const rewriteMatch = trimmed.match(/(?:rewrite chapter|重写第)\s*(\d+)\s*(?:章)?/i);
|
|
|
if (rewriteMatch) {
|
|
if (rewriteMatch) {
|
|
|
return {
|
|
return {
|