@heyo-sh/create-heyo-docs 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -16,10 +16,15 @@ export const POST: APIRoute = async ({ request }) => {
|
|
|
16
16
|
const token = env.HEYO_DOCS_AI_API_KEY;
|
|
17
17
|
const { createAiChatResponse } = await import("@heyo-sh/heyo-docs/ai");
|
|
18
18
|
return createAiChatResponse(request, {
|
|
19
|
-
ai:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
ai: {
|
|
20
|
+
...config.ai,
|
|
21
|
+
chat: {
|
|
22
|
+
...config.ai.chat,
|
|
23
|
+
...(!config.ai.chat.auth && token
|
|
24
|
+
? { auth: { type: "api-key" as const, token } }
|
|
25
|
+
: {}),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
23
28
|
markdownPages,
|
|
24
29
|
pages: markdownPages.map((page) => ({
|
|
25
30
|
description: page.description,
|
|
@@ -12,14 +12,18 @@ export async function POST(request: Request) {
|
|
|
12
12
|
{ status: 404 },
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
const token = env.HEYO_DOCS_AI_API_KEY;
|
|
15
|
+
const token = getCloudflareContext().env.HEYO_DOCS_AI_API_KEY;
|
|
17
16
|
const { createAiChatResponse } = await import("@heyo-sh/heyo-docs/ai");
|
|
18
17
|
return createAiChatResponse(request, {
|
|
19
|
-
ai:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
ai: {
|
|
19
|
+
...config.ai,
|
|
20
|
+
chat: {
|
|
21
|
+
...config.ai.chat,
|
|
22
|
+
...(!config.ai.chat.auth && token
|
|
23
|
+
? { auth: { type: "api-key" as const, token } }
|
|
24
|
+
: {}),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
23
27
|
markdownPages,
|
|
24
28
|
pages: docsPages,
|
|
25
29
|
title: config.title,
|
|
@@ -16,14 +16,19 @@ export async function action({ context, request }: ActionFunctionArgs) {
|
|
|
16
16
|
{ error: "AI chat is not configured." },
|
|
17
17
|
{ status: 404 },
|
|
18
18
|
);
|
|
19
|
-
|
|
20
|
-
const token =
|
|
19
|
+
|
|
20
|
+
const token = context.get(cloudflareContext).HEYO_DOCS_AI_API_KEY;
|
|
21
21
|
const { createAiChatResponse } = await import("@heyo-sh/heyo-docs/ai");
|
|
22
22
|
return createAiChatResponse(request, {
|
|
23
|
-
ai:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
ai: {
|
|
24
|
+
...config.ai,
|
|
25
|
+
chat: {
|
|
26
|
+
...config.ai.chat,
|
|
27
|
+
...(!config.ai.chat.auth && token
|
|
28
|
+
? { auth: { type: "api-key" as const, token } }
|
|
29
|
+
: {}),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
27
32
|
markdownPages,
|
|
28
33
|
pages,
|
|
29
34
|
title: config.title,
|