Template
Schulungs-Vorlage auf neues App-Template umgestellt
This commit is contained in:
1 parent
2dfa403641
commit
46efd2d9d0
17 files changed
+162
-414
No files matched your search
@@ -1,6 +0,0 @@
|
||||
// Muster C: Provider und Modell an einer Stelle.
|
||||
// Der Standard-Provider liest ANTHROPIC_API_KEY aus der Umgebung.
|
||||
import { anthropic } from "@ai-sdk/anthropic";
|
||||
|
||||
// Ein günstiges Modell, weil jeder Aufruf Geld kostet (Claude Sonnet 5: 2 $ Input / 10 $ Output pro 1 Mio. Tokens).
|
||||
export const getModel = () => anthropic("claude-sonnet-5");
|
||||
@@ -1,30 +0,0 @@
|
||||
// Muster A: n8n-Webhook aus dem Frontend aufrufen.
|
||||
// Die Basis-Adresse wird beim Bauen eingesetzt (NEXT_PUBLIC_*). Ohne Angabe gilt die E&P-n8n.
|
||||
|
||||
const BASE = (process.env.NEXT_PUBLIC_N8N_BASE || "https://n8n.ep-reisen.app").replace(/\/+$/, "");
|
||||
|
||||
export function webhookUrl(path: string): string {
|
||||
const clean = path.replace(/^\/+/, "");
|
||||
return `${BASE}/webhook/${clean}`;
|
||||
}
|
||||
|
||||
export async function postWebhook<T = unknown>(
|
||||
path: string,
|
||||
body: unknown,
|
||||
): Promise<T> {
|
||||
const res = await fetch(webhookUrl(path), {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error(`Webhook-Fehler ${res.status}: ${await res.text()}`);
|
||||
}
|
||||
// n8n kann JSON oder Text zurückgeben:
|
||||
const text = await res.text();
|
||||
try {
|
||||
return JSON.parse(text) as T;
|
||||
} catch {
|
||||
return text as T;
|
||||
}
|
||||
}
|
||||
@@ -1 +1,6 @@
|
||||
export { cn } from "cn"
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
Reference in new issue
Block a user