fix: client side refresh for component

This commit is contained in:
bennykok
2024-02-01 17:01:54 +08:00
parent 4c715b815a
commit ea675fcd4c
10 changed files with 106 additions and 43 deletions
-6
View File
@@ -1,16 +1,10 @@
"use server";
import { RunOutputs } from "@/components/RunOutputs";
import { db } from "@/db/db";
import { workflowRunOutputs } from "@/db/schema";
import { eq } from "drizzle-orm";
// export async function getRunsOutputDisplay(run_id: string) {
// return <RunOutputs run_id={run_id} />;
// }
export async function getRunsOutput(run_id: string) {
// throw new Error("Not implemented");
return await db
.select()
.from(workflowRunOutputs)
+18
View File
@@ -0,0 +1,18 @@
"use server";
import type { StringLiteralUnion } from "shikiji";
import { getHighlighter } from "shikiji";
export async function highlight(
code: string,
lang: StringLiteralUnion<string>,
) {
const highlighter = await getHighlighter({
themes: ["one-dark-pro"],
langs: [lang],
});
return highlighter.codeToHtml(code.trim(), {
lang: lang,
theme: "one-dark-pro",
});
}