feat: Implement Qwen adapter and enhance AI platform detection

- Added a new Qwen adapter to facilitate monitoring through Playwright, leveraging internal text/chat managers.
- Updated account detection logic to recognize Qwen sessions based on persisted cookies, improving binding reliability.
- Relaxed authentication requirements for monitor tasks, allowing anonymous execution for certain AI platforms.
- Enhanced the generic AI platform detection to include Qwen-specific logic, ensuring accurate session identification.
- Modified the monitoring dashboard to include runtime state indicating if the current user's desktop client is online.
- Updated various files including `account-binder.ts`, `runtime-controller.ts`, and `monitoring_service.go` to support new features and improvements.
This commit is contained in:
2026-04-20 19:10:35 +08:00
parent 69fd182755
commit 7abac1e9c4
13 changed files with 973 additions and 105 deletions
@@ -15,6 +15,7 @@ import { getAIPlatformCatalogItem, isAIPlatformId } from "@geo/shared-types";
import {
doubaoAdapter,
qwenAdapter,
toutiaoAdapter,
zhihuAdapter,
type AdapterExecutionResult,
@@ -104,6 +105,7 @@ const pullIntervalMs = 60_000;
const leaseExtendIntervalMs = 60_000;
const maxActivityItems = 60;
const monitorBusinessTimeZone = "Asia/Shanghai";
const authRequiredMonitorPlatforms = new Set(["yuanbao", "kimi", "deepseek"]);
interface RuntimeTaskRecord {
id: string;
@@ -1131,7 +1133,7 @@ async function executeTaskAdapter(
signal: AbortSignal,
): Promise<AdapterExecutionResult> {
const accountIdentity = accountIdentityFromTask(task);
if (accountIdentity) {
if (accountIdentity && shouldEnforceActiveAccount(task)) {
const readiness = await ensureAccountReady(accountIdentity);
if (readiness.authState !== "active") {
return buildAccountBlockedResult(task, readiness);
@@ -1261,6 +1263,18 @@ async function executeTaskAdapter(
}
}
function shouldEnforceActiveAccount(task: RuntimeTaskRecord): boolean {
if (task.kind === "publish") {
return true;
}
if (!isAIPlatformId(task.platform)) {
return true;
}
return authRequiredMonitorPlatforms.has(task.platform);
}
function buildAccountBlockedResult(
task: RuntimeTaskRecord,
readiness: Awaited<ReturnType<typeof ensureAccountReady>>,
@@ -1645,6 +1659,9 @@ function selectMonitorAdapter(platform: string): MonitorAdapter | null {
if (platform === doubaoAdapter.provider) {
return doubaoAdapter;
}
if (platform === qwenAdapter.provider) {
return qwenAdapter;
}
return null;
}