From 36dcc782ceb588b154ced7b1edb39912db4e65dd Mon Sep 17 00:00:00 2001
From: Kadxy <2230318258@qq.com>
Date: Fri, 27 Sep 2024 03:29:34 +0800
Subject: [PATCH] kling
---
app/pages/Kling.tsx | 120 +++++++++++++++++++++++------------
app/providers/kling/index.ts | 1 +
2 files changed, 82 insertions(+), 39 deletions(-)
diff --git a/app/pages/Kling.tsx b/app/pages/Kling.tsx
index 56385f7..ab9f011 100644
--- a/app/pages/Kling.tsx
+++ b/app/pages/Kling.tsx
@@ -13,10 +13,11 @@ import {
} from "@ant-design/pro-components";
import { COL_SCROLL_STYLE, PRO_FORM_PROPS, SEGMENTED_PROPS } from "@/constant";
import { useAppConfig } from "@/app/store";
-import { Alert, Col, Divider, App, Segmented, Descriptions, Button, Space } from "antd";
+import { Alert, Col, Divider, App, Segmented, Descriptions, Button, Space, Popconfirm } from "antd";
import { Kling, KlingApiTypes, KlingTask } from "@/app/providers/kling";
import { renderCode, RenderSubmitter } from "../render";
import { beforeUpload, safeJsonStringify } from "../utils";
+import { ascetic } from "react-syntax-highlighter/dist/esm/styles/hljs";
const MODE_OPTIONS = [
{ label: "Std-标准模式(高性能)", value: "std" },
@@ -688,7 +689,42 @@ const KlingPage = () => {
copyable: true,
},
{
- title: "请求信息",
+ title: "任务状态",
+ dataIndex: ["latest_task_info", "task_status"],
+ valueEnum: {
+ processing: { text: "Processing", status: "Processing" },
+ submitted: { text: "Submitted", status: "Processing" },
+ succeed: { text: "Succeed", status: "Success" },
+ failed: { text: "Failed", status: "Error" },
+ },
+ },
+ {
+ title: "创建时间",
+ dataIndex: ["latest_task_info", "created_at"],
+ valueType: "dateTime",
+ },
+ {
+ title: "更新时间",
+ dataIndex: ["latest_task_info", "updated_at"],
+ valueType: "dateTime",
+ },
+ {
+ title: "视频预览",
+ render: (_, record) => {
+ if (record?.latest_task_info?.task_result?.videos?.[0]?.url) {
+ return (
+
+ );
+ }
+ return null;
+ },
+ },
+ {
+ title: "操作",
render: (_, record) => {
return (
@@ -715,7 +751,7 @@ const KlingPage = () => {
});
}}
>
- 原始
+ 原始请求
+
+ {
+ setTaskData((prev) => prev.filter((_, i) => i !== index));
+ }}
+ >
+
+
);
},
},
- {
- title: "任务状态",
- dataIndex: ["latest_task_info", "task_status"],
- valueEnum: {
- processing: { text: "Processing", status: "Processing" },
- submitted: { text: "Submitted", status: "Processing" },
- succeed: { text: "Succeed", status: "Success" },
- failed: { text: "Failed", status: "Error" },
- },
- },
- {
- title: "创建时间",
- dataIndex: ["latest_task_info", "created_at"],
- valueType: "dateTime",
- },
- {
- title: "更新时间",
- dataIndex: ["latest_task_info", "updated_at"],
- valueType: "dateTime",
- },
- {
- title: "预览",
- render: (_, record) => {
- if (record?.latest_task_info?.task_result?.videos?.[0]?.url) {
- return (
-
- );
- }
- return null;
- },
- },
]}
/>
))}
diff --git a/app/providers/kling/index.ts b/app/providers/kling/index.ts
index ad2f0f4..e5467eb 100644
--- a/app/providers/kling/index.ts
+++ b/app/providers/kling/index.ts
@@ -482,6 +482,7 @@ export class Kling implements AIProvider {
* 更新任务
* @param task 任务
* @param originalTask 原始任务,如果传入,则更新任务信息,否则创建新任务
+ * @returns 更新后的任务
*/
updateTask(
res: MakeApiRequestResult<