Skip to content

Commit 6d7a37e

Browse files
committed
style: reformat codebase
1 parent ac31240 commit 6d7a37e

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

app/api/chat/route.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { graphql, readFragment, type FragmentType } from "@/gql";
1+
import { type FragmentType, graphql, readFragment } from "@/gql";
22
import { getClient } from "@/lib/apollo.rsc";
33
import { getAuthorizedUserInfo } from "@/lib/auth.rsc";
4+
import { createPostHogClient } from "@/lib/posthog.rsc";
45
import { anthropic, type AnthropicProviderOptions } from "@ai-sdk/anthropic";
6+
import { withTracing } from "@posthog/ai";
57
import { convertToModelMessages, stepCountIs, streamText, tool, type UIMessage } from "ai";
6-
import { withTracing } from "@posthog/ai"
78
import { NextResponse } from "next/server";
89
import { z } from "zod";
9-
import { createPostHogClient } from "@/lib/posthog.rsc";
1010

1111
export const maxDuration = 30;
1212

@@ -123,19 +123,19 @@ export async function POST(req: Request) {
123123
providerOptions: {
124124
anthropic: {
125125
cacheControl: {
126-
type: 'ephemeral',
126+
type: "ephemeral",
127127
},
128128
} satisfies AnthropicProviderOptions,
129-
}
129+
},
130130
},
131131
{
132132
role: "system",
133133
content: contextSystemPrompt(data.question),
134134
providerOptions: {
135135
anthropic: {
136-
cacheControl: { type: 'ephemeral' },
136+
cacheControl: { type: "ephemeral" },
137137
} satisfies AnthropicProviderOptions,
138-
}
138+
},
139139
},
140140
...convertToModelMessages(messages),
141141
],
@@ -302,15 +302,16 @@ Step 5: 產生回應 (Generate Response)
302302
export const contextSystemPrompt = (fragment: FragmentType<typeof QUESTION_INFO_FRAGMENT>) => {
303303
const { title, description, difficulty, category } = readFragment(QUESTION_INFO_FRAGMENT, fragment);
304304

305-
const contextPrompt = `輸入資訊 (Input Information):這個問題是「{{QUESTION_TITLE}}」,難度 {{QUESTION_DIFFICULTY}},分類 {{QUESTION_CATEGORY}}
305+
const contextPrompt =
306+
`輸入資訊 (Input Information):這個問題是「{{QUESTION_TITLE}}」,難度 {{QUESTION_DIFFICULTY}},分類 {{QUESTION_CATEGORY}}
306307
307308
題幹如下:
308309
309310
{{QUESTION_DESCRIPTION}}
310311
311312
其他情境,您可以使用工具進行取回。`;
312313

313-
return contextPrompt.replace("{{QUESTION_TITLE}}", title)
314+
return contextPrompt.replace("{{QUESTION_TITLE}}", title)
314315
.replace("{{QUESTION_DESCRIPTION}}", description)
315316
.replace("{{QUESTION_DIFFICULTY}}", difficulty)
316317
.replace("{{QUESTION_CATEGORY}}", category);

app/login/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import DoYouKnow from "./_components/do-you-know";
66
import DoYouKnowSkeleton from "./_components/do-you-know/skeleton";
77
import GithubLink from "./_components/github-link";
88
import { LoginForm } from "./_components/login-form";
9-
import { UpstreamStatus, UpstreamStatusPlaceholder } from "./_components/status";
109
import PostHogResetter from "./_components/posthog-resetter";
10+
import { UpstreamStatus, UpstreamStatusPlaceholder } from "./_components/status";
1111

1212
export const metadata: Metadata = {
1313
title: "登入",

instrumentation-client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import posthog from "posthog-js"
1+
import posthog from "posthog-js";
22

33
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
44
api_host: "/ingest",
55
ui_host: "https://us.posthog.com",
6-
defaults: '2025-05-24',
6+
defaults: "2025-05-24",
77
capture_exceptions: true, // This enables capturing exceptions using Error Tracking, set to false if you don't want this
88
debug: process.env.NODE_ENV === "development",
9-
});
9+
});

lib/posthog.rsc.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"use server";
22

3-
import { PostHog } from 'posthog-node'
3+
import { PostHog } from "posthog-node";
44

55
export async function createPostHogClient() {
66
const posthogClient = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
77
host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
88
flushAt: 1,
9-
flushInterval: 0
10-
})
9+
flushInterval: 0,
10+
});
1111

12-
return posthogClient
12+
return posthogClient;
1313
}

0 commit comments

Comments
 (0)