forked from 77media/video-flow
更新: 客户端埋点
This commit is contained in:
parent
f5e0711285
commit
a8a4fd3866
@ -92,6 +92,11 @@ export interface CreateMovieProjectV2Request {
|
||||
script: string;
|
||||
/** 用户ID */
|
||||
user_id: string;
|
||||
/** 客户端用户数据 */
|
||||
user_data?: {
|
||||
is_mobile: 1 | 0;
|
||||
user_agent: string;
|
||||
};
|
||||
/** 模式:auto | manual */
|
||||
mode: "auto" | "manual";
|
||||
/** 分辨率:720p | 1080p | 4k */
|
||||
@ -206,6 +211,11 @@ export interface CreateMovieProjectV3Request {
|
||||
category: string;
|
||||
/** 用户ID */
|
||||
user_id: string;
|
||||
/** 客户端用户数据 */
|
||||
user_data?: {
|
||||
is_mobile: 1 | 0;
|
||||
user_agent: string;
|
||||
};
|
||||
/** 模式:auto | manual */
|
||||
mode: "auto" | "manual";
|
||||
/** 分辨率:720p | 1080p | "4k" */
|
||||
|
||||
@ -34,6 +34,20 @@ export interface QiniuUploadResponse {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前客户端的 UA 与设备信息
|
||||
*/
|
||||
export const getClientUserData = (): { user_agent: string; is_mobile: 1 | 0 } => {
|
||||
try {
|
||||
const ua = typeof navigator !== 'undefined' && navigator.userAgent ? navigator.userAgent : ''
|
||||
const isMobile = /Mobile|Android|iPhone/i.test(ua)
|
||||
return { user_agent: ua, is_mobile: isMobile ? 1 : 0 }
|
||||
} catch {
|
||||
return { user_agent: '', is_mobile: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 获取七牛云上传token(包含domain)
|
||||
export const getUploadToken = async (timeoutMs: number = 10000): Promise<{ token: string, domain: string }> => {
|
||||
// 添加超时控制
|
||||
|
||||
@ -3,13 +3,15 @@ import {
|
||||
CreateMovieProjectV3Request,
|
||||
} from "./DTO/movie_start_dto";
|
||||
import { post } from "./request";
|
||||
import { getClientUserData } from './common';
|
||||
|
||||
import { withQueuePolling, QueueResponse } from './movie_queue';
|
||||
|
||||
// 新-创建接口
|
||||
export const createMovieProject = async (data: any): Promise<QueueResponse> => {
|
||||
const apiCall = (params: any) => post<QueueResponse>('/movie/create_movie_project', params);
|
||||
return withQueuePolling(apiCall, data);
|
||||
const user_data = getClientUserData();
|
||||
return withQueuePolling(apiCall, { ...data, user_data });
|
||||
};
|
||||
|
||||
/**
|
||||
@ -22,7 +24,8 @@ export const createMovieProjectV2 = async (
|
||||
): Promise<QueueResponse> => {
|
||||
const apiCall = (params: CreateMovieProjectV2Request) =>
|
||||
post<QueueResponse>("/movie/create_movie_project_v2", params);
|
||||
return withQueuePolling(apiCall, request);
|
||||
const user_data = getClientUserData();
|
||||
return withQueuePolling(apiCall, { ...(request as any), user_data } as any);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -35,5 +38,6 @@ export const createMovieProjectV3 = async (
|
||||
): Promise<QueueResponse> => {
|
||||
const apiCall = (params: CreateMovieProjectV3Request) =>
|
||||
post<QueueResponse>("/movie/create_movie_project_v3", params);
|
||||
return withQueuePolling(apiCall, request);
|
||||
const user_data = getClientUserData();
|
||||
return withQueuePolling(apiCall, { ...(request as any), user_data } as any);
|
||||
};
|
||||
@ -15,6 +15,7 @@ import {
|
||||
} from "@/api/DTO/movie_start_dto";
|
||||
import { MovieProjectService, MovieProjectMode } from "./MovieProjectService";
|
||||
import { AspectRatioValue } from '@/components/ChatInputBox/AspectRatioSelector'
|
||||
import { getClientUserData } from "@/api/common";
|
||||
|
||||
interface UseImageStoryService {
|
||||
/** 当前图片故事数据 */
|
||||
@ -477,6 +478,7 @@ export const useImageStoryServiceHook = (): UseImageStoryService => {
|
||||
const params: CreateMovieProjectV2Request = {
|
||||
script: storyContent,
|
||||
user_id,
|
||||
user_data: getClientUserData(),
|
||||
mode,
|
||||
resolution,
|
||||
genre: selectedCategory,
|
||||
|
||||
@ -7,6 +7,7 @@ import { generateTextToImage } from "@/api/movie_start";
|
||||
import { MovieProjectService, MovieProjectMode } from "./MovieProjectService";
|
||||
import { CreateMovieProjectV3Request } from "@/api/DTO/movie_start_dto";
|
||||
import { AspectRatioValue } from '@/components/ChatInputBox/AspectRatioSelector'
|
||||
import { getClientUserData } from "@/api/common";
|
||||
|
||||
interface UseTemplateStoryService {
|
||||
/** 模板列表 */
|
||||
@ -267,6 +268,7 @@ export const useTemplateStoryServiceHook = (): UseTemplateStoryService => {
|
||||
script: script,
|
||||
category: selectedTemplate?.category || "",
|
||||
user_id,
|
||||
user_data: getClientUserData(),
|
||||
mode,
|
||||
resolution,
|
||||
storyRole: selectedTemplate?.storyRole || [],
|
||||
|
||||
@ -44,6 +44,7 @@ if [ "$current_branch" = "$BRANCH_NAME" ]; then
|
||||
|
||||
# 准备dist目录
|
||||
mkdir -p dist
|
||||
rm -rf .next/cache
|
||||
cp -r .next dist/
|
||||
cp -r public dist/
|
||||
cp package.json dist/
|
||||
|
||||
@ -51,6 +51,7 @@ import { PcPhotoStoryModal } from "./PcPhotoStoryModal";
|
||||
import { H5PhotoStoryDrawer } from "./H5PhotoStoryDrawer";
|
||||
import { AspectRatioSelector, AspectRatioValue } from "./AspectRatioSelector";
|
||||
import { useTemplateStoryServiceHook } from "@/app/service/Interaction/templateStoryService";
|
||||
import { getClientUserData } from "@/api/common";
|
||||
|
||||
const LauguageOptions = [
|
||||
{ value: "english", label: "English", isVip: false, code:'EN' },
|
||||
@ -270,6 +271,7 @@ export function ChatInputBox({ noData }: { noData: boolean }) {
|
||||
// 创建剧集数据
|
||||
let episodeData: any = {
|
||||
user_id: String(User.id),
|
||||
user_data: getClientUserData(),
|
||||
script: script,
|
||||
mode: configOptions.mode,
|
||||
resolution: configOptions.resolution,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user