Add monitoring service and database schema
- Implement monitoring service with heartbeat, lease tasks, resume tasks, and task result handling. - Create monitoring time utilities for business date calculations. - Add unit tests for date window resolution and business day handling. - Define database schema for monitoring-related tables including quotas, daily reports, and task management. - Establish migration scripts for creating and dropping monitoring tables.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
import type { MonitoringLocalPlatformState } from "@geo/shared-types";
|
||||
|
||||
export type MonitoringAccessRequirement = "login_required" | "anonymous_allowed";
|
||||
|
||||
export interface StoredMonitoringPlatformState extends MonitoringLocalPlatformState {
|
||||
platform_name: string;
|
||||
short_name: string;
|
||||
accent_color: string;
|
||||
home_url: string;
|
||||
login_url: string | null;
|
||||
access_requirement: MonitoringAccessRequirement;
|
||||
cookie_domains: string[];
|
||||
}
|
||||
|
||||
const monitoringPlatformDefinitions = [
|
||||
{
|
||||
ai_platform_id: "deepseek",
|
||||
platform_name: "DeepSeek",
|
||||
short_name: "D",
|
||||
accent_color: "#4468ff",
|
||||
home_url: "https://chat.deepseek.com/",
|
||||
login_url: "https://chat.deepseek.com/",
|
||||
access_requirement: "login_required",
|
||||
cookie_domains: ["chat.deepseek.com", "deepseek.com"],
|
||||
},
|
||||
{
|
||||
ai_platform_id: "qwen",
|
||||
platform_name: "通义千问",
|
||||
short_name: "Q",
|
||||
accent_color: "#6b46ff",
|
||||
home_url: "https://www.qianwen.com/",
|
||||
login_url: "https://www.qianwen.com/",
|
||||
access_requirement: "anonymous_allowed",
|
||||
cookie_domains: ["www.qianwen.com", "qianwen.com"],
|
||||
},
|
||||
{
|
||||
ai_platform_id: "doubao",
|
||||
platform_name: "豆包",
|
||||
short_name: "豆",
|
||||
accent_color: "#00a870",
|
||||
home_url: "https://www.doubao.com/",
|
||||
login_url: "https://www.doubao.com/",
|
||||
access_requirement: "anonymous_allowed",
|
||||
cookie_domains: ["www.doubao.com", "doubao.com"],
|
||||
},
|
||||
] satisfies Array<
|
||||
Pick<
|
||||
StoredMonitoringPlatformState,
|
||||
| "ai_platform_id"
|
||||
| "platform_name"
|
||||
| "short_name"
|
||||
| "accent_color"
|
||||
| "home_url"
|
||||
| "login_url"
|
||||
| "access_requirement"
|
||||
| "cookie_domains"
|
||||
>
|
||||
>;
|
||||
|
||||
export const supportedMonitoringPlatforms = monitoringPlatformDefinitions;
|
||||
|
||||
export function createDefaultMonitoringPlatformStates(): StoredMonitoringPlatformState[] {
|
||||
return supportedMonitoringPlatforms.map((platform) => ({
|
||||
...platform,
|
||||
connected: false,
|
||||
accessible: false,
|
||||
detected_at: null,
|
||||
reason_code: null,
|
||||
reason_message: null,
|
||||
message: null,
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user