-
-
-
- }>
-
-
-
+
+
+
+ }>
+
+
+
-
-
+
);
};
diff --git a/src/features/problems/description/components/panel.tsx b/src/features/problems/description/components/panel.tsx
index 6bdaacc..0f47385 100644
--- a/src/features/problems/description/components/panel.tsx
+++ b/src/features/problems/description/components/panel.tsx
@@ -3,6 +3,7 @@ import {
DescriptionContent,
DescriptionContentSkeleton,
} from "@/features/problems/description/components/content";
+import { PanelLayout } from "@/features/problems/layouts/panel-layout";
interface DescriptionPanelProps {
problemId: string;
@@ -10,14 +11,10 @@ interface DescriptionPanelProps {
export const DescriptionPanel = ({ problemId }: DescriptionPanelProps) => {
return (
-
+
+ }>
+
+
+
);
};
diff --git a/src/features/problems/detail/components/panel.tsx b/src/features/problems/detail/components/panel.tsx
index cf6b3e1..75e7114 100644
--- a/src/features/problems/detail/components/panel.tsx
+++ b/src/features/problems/detail/components/panel.tsx
@@ -3,6 +3,7 @@ import {
DetailContent,
DetailContentSkeleton,
} from "@/features/problems/detail/components/content";
+import { PanelLayout } from "@/features/problems/layouts/panel-layout";
import { DetailHeader } from "@/features/problems/detail/components/header";
interface DetailPanelProps {
@@ -15,15 +16,11 @@ export const DetailPanel = ({ submissionId }: DetailPanelProps) => {
}
return (
-
+
}>
+
+
+
);
};
diff --git a/src/features/problems/layouts/panel-layout.tsx b/src/features/problems/layouts/panel-layout.tsx
new file mode 100644
index 0000000..1b09a7d
--- /dev/null
+++ b/src/features/problems/layouts/panel-layout.tsx
@@ -0,0 +1,13 @@
+interface PanelLayoutProps {
+ children: React.ReactNode;
+}
+
+export const PanelLayout = ({ children }: PanelLayoutProps) => {
+ return (
+
+ );
+};
diff --git a/src/features/problems/solution/components/panel.tsx b/src/features/problems/solution/components/panel.tsx
index b03fc53..e352016 100644
--- a/src/features/problems/solution/components/panel.tsx
+++ b/src/features/problems/solution/components/panel.tsx
@@ -3,6 +3,7 @@ import {
SolutionContent,
SolutionContentSkeleton,
} from "@/features/problems/solution/components/content";
+import { PanelLayout } from "@/features/problems/layouts/panel-layout";
interface SolutionPanelProps {
problemId: string;
@@ -10,14 +11,10 @@ interface SolutionPanelProps {
export const SolutionPanel = ({ problemId }: SolutionPanelProps) => {
return (
-
+
+ }>
+
+
+
);
};
diff --git a/src/features/problems/submission/components/panel.tsx b/src/features/problems/submission/components/panel.tsx
index b035c90..7fea50b 100644
--- a/src/features/problems/submission/components/panel.tsx
+++ b/src/features/problems/submission/components/panel.tsx
@@ -3,6 +3,7 @@ import {
SubmissionContent,
SubmissionContentSkeleton,
} from "@/features/problems/submission/components/content";
+import { PanelLayout } from "@/features/problems/layouts/panel-layout";
interface SubmissionPanelProps {
problemId: string;
@@ -10,14 +11,10 @@ interface SubmissionPanelProps {
export const SubmissionPanel = ({ problemId }: SubmissionPanelProps) => {
return (
-
+
+ }>
+
+
+
);
};
diff --git a/src/features/problems/testcase/panel.tsx b/src/features/problems/testcase/panel.tsx
index 4150959..07bf19b 100644
--- a/src/features/problems/testcase/panel.tsx
+++ b/src/features/problems/testcase/panel.tsx
@@ -3,6 +3,7 @@ import {
TestcaseContent,
TestcaseContentSkeleton,
} from "@/features/problems/testcase/content";
+import { PanelLayout } from "@/features/problems/layouts/panel-layout";
interface TestcasePanelProps {
problemId: string;
@@ -10,14 +11,10 @@ interface TestcasePanelProps {
export const TestcasePanel = ({ problemId }: TestcasePanelProps) => {
return (
-
+
+ }>
+
+
+
);
};
diff --git a/src/stores/flexlayout.ts b/src/stores/flexlayout.ts
index 439013f..35c360e 100644
--- a/src/stores/flexlayout.ts
+++ b/src/stores/flexlayout.ts
@@ -144,6 +144,13 @@ const initialProblemEditFlexLayoutJsonModel: IJsonModel = {
id: "1",
weight: 50,
children: [
+ {
+ type: "tab",
+ id: "detail",
+ name: "Details",
+ component: "detail",
+ enableClose: false,
+ },
{
type: "tab",
id: "description",
@@ -158,13 +165,6 @@ const initialProblemEditFlexLayoutJsonModel: IJsonModel = {
component: "solution",
enableClose: false,
},
- {
- type: "tab",
- id: "detail",
- name: "Details",
- component: "detail",
- enableClose: false,
- },
],
},
{
diff --git a/src/types/ai-improve.ts b/src/types/ai-improve.ts
new file mode 100644
index 0000000..c6b034d
--- /dev/null
+++ b/src/types/ai-improve.ts
@@ -0,0 +1,19 @@
+import { z } from "zod";
+
+// 优化代码的输入类型
+export const OptimizeCodeInputSchema = z.object({
+ code: z.string(), // 用户输入的代码
+ error: z.string().optional(), // 可选的错误信息
+ problemId: z.string().optional(), // 可选的题目ID
+});
+
+export type OptimizeCodeInput = z.infer
;
+
+// 优化代码的输出类型
+export const OptimizeCodeOutputSchema = z.object({
+ optimizedCode: z.string(), // 优化后的代码
+ explanation: z.string(), // 优化说明
+ issuesFixed: z.array(z.string()).optional(), // 修复的问题列表
+});
+
+export type OptimizeCodeOutput = z.infer;
diff --git a/src/types/ai-testcase.ts b/src/types/ai-testcase.ts
new file mode 100644
index 0000000..8afe68e
--- /dev/null
+++ b/src/types/ai-testcase.ts
@@ -0,0 +1,19 @@
+import { z } from "zod";
+
+export const AITestCaseInputSchema = z.object({
+ problemId: z.string(),
+});
+
+export type AITestCaseInput = z.infer;
+
+const input = z.object({
+ name: z.string(),
+ value: z.string(),
+});
+
+export const AITestCaseOutputSchema = z.object({
+ expectedOutput: z.string(),
+ inputs: z.array(input),
+});
+
+export type AITestCaseOutput = z.infer;