public
anord
read
Ledger
Why work hard when you can work easier?
Languages
Repository composition by tracked source files.
TypeScript
86%
CSS
10%
SQL
3%
Shell
1%
HTML
0%
Trace
apps/api/src/services/ai.ts
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
ai.ts
on main
Author
Date
Commit
Line
Code
Alex Nord
3 months ago
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 1
import { env } from "../config/env.js";
import { env } from "../config/env.js";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 2
import { pool } from "../db/pool.js";
import { pool } from "../db/pool.js";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 3
import { searchPages } from "./search.js";
import { searchPages } from "./search.js";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 4
import { getPageBySlug } from "./pages.js";
import { getPageBySlug } from "./pages.js";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 5
import type { SessionUser } from "@ledger/shared";
import type { SessionUser } from "@ledger/shared";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 6
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 7
type ProviderConfig = {
type ProviderConfig = {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 8
provider: string;
provider: string;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 9
model: string;
model: string;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 10
apiKey: string;
apiKey: string;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 11
baseUrl: string | null;
baseUrl: string | null;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 12
};
};
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 13
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 14
export async function getAiSettingsRecord() {
export async function getAiSettingsRecord() {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 15
const settings = await pool.query(`SELECT * FROM ai_settings ORDER BY created_at ASC LIMIT 1`);
const settings = await pool.query(`SELECT * FROM ai_settings ORDER BY created_at ASC LIMIT 1`);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 16
return settings.rows[0] ?? null;
return settings.rows[0] ?? null;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 17
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 18
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 19
export async function upsertAiSettings(input: {
export async function upsertAiSettings(input: {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 20
provider: string;
provider: string;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 21
model: string;
model: string;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 22
apiKey: string | null;
apiKey: string | null;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 23
isEnabled: boolean;
isEnabled: boolean;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 24
}) {
}) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 25
const existing = await getAiSettingsRecord();
const existing = await getAiSettingsRecord();
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 26
if (existing) {
if (existing) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 27
const nextApiKey = input.apiKey === null ? existing.encrypted_api_key : input.apiKey;
const nextApiKey = input.apiKey === null ? existing.encrypted_api_key : input.apiKey;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 28
const updated = await pool.query(
const updated = await pool.query(
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 29
`
`
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 30
UPDATE ai_settings
UPDATE ai_settings
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 31
SET provider = $2, model = $3, encrypted_api_key = $4, is_enabled = $5, updated_at = now()
SET provider = $2, model = $3, encrypted_api_key = $4, is_enabled = $5, updated_at = now()
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 32
WHERE id = $1
WHERE id = $1
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 33
RETURNING *
RETURNING *
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 34
`,
`,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 35
[existing.id, input.provider, input.model, nextApiKey, input.isEnabled]
[existing.id, input.provider, input.model, nextApiKey, input.isEnabled]
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 36
);
);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 37
return updated.rows[0];
return updated.rows[0];
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 38
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 39
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 40
const created = await pool.query(
const created = await pool.query(
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 41
`
`
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 42
INSERT INTO ai_settings (provider, model, encrypted_api_key, is_enabled)
INSERT INTO ai_settings (provider, model, encrypted_api_key, is_enabled)
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 43
VALUES ($1, $2, $3, $4)
VALUES ($1, $2, $3, $4)
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 44
RETURNING *
RETURNING *
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 45
`,
`,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 46
[input.provider, input.model, input.apiKey, input.isEnabled]
[input.provider, input.model, input.apiKey, input.isEnabled]
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 47
);
);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 48
return created.rows[0];
return created.rows[0];
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 49
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 50
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 51
async function resolveProviderConfig(): Promise<ProviderConfig | null> {
async function resolveProviderConfig(): Promise<ProviderConfig | null> {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 52
const persisted = await getAiSettingsRecord();
const persisted = await getAiSettingsRecord();
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 53
const provider = String(persisted?.provider ?? env.AI_PROVIDER ?? "none");
const provider = String(persisted?.provider ?? env.AI_PROVIDER ?? "none");
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 54
const model = String(persisted?.model ?? env.AI_MODEL ?? "");
const model = String(persisted?.model ?? env.AI_MODEL ?? "");
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 55
const apiKey = String(persisted?.encrypted_api_key ?? env.AI_API_KEY ?? "");
const apiKey = String(persisted?.encrypted_api_key ?? env.AI_API_KEY ?? "");
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 56
const isEnabled = Boolean(persisted?.is_enabled ?? provider !== "none");
const isEnabled = Boolean(persisted?.is_enabled ?? provider !== "none");
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 57
const baseUrl = provider === "openai_compatible" ? "https://api.openai.com/v1" : null;
const baseUrl = provider === "openai_compatible" ? "https://api.openai.com/v1" : null;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 58
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 59
if (!isEnabled || provider === "none" || !model || !apiKey) {
if (!isEnabled || provider === "none" || !model || !apiKey) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 60
return null;
return null;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 61
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 62
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 63
return {
return {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 64
provider,
provider,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 65
model,
model,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 66
apiKey,
apiKey,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 67
baseUrl
baseUrl
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 68
};
};
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 69
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 70
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 71
async function generateWithProvider(provider: ProviderConfig, prompt: string) {
async function generateWithProvider(provider: ProviderConfig, prompt: string) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 72
if (provider.provider === "openai_compatible") {
if (provider.provider === "openai_compatible") {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 73
const response = await fetch(`${provider.baseUrl}/chat/completions`, {
const response = await fetch(`${provider.baseUrl}/chat/completions`, {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 74
method: "POST",
method: "POST",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 75
headers: {
headers: {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 76
Authorization: `Bearer ${provider.apiKey}`,
Authorization: `Bearer ${provider.apiKey}`,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 77
"Content-Type": "application/json"
"Content-Type": "application/json"
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 78
},
},
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 79
body: JSON.stringify({
body: JSON.stringify({
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 80
model: provider.model,
model: provider.model,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 81
temperature: 0.2,
temperature: 0.2,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 82
messages: [
messages: [
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 83
{
{
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 84
role: "system",
role: "system",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 85
content:
content:
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 86
"Answer using only the provided knowledge base excerpts. If the context is insufficient, say exactly: The knowledge base does not contain enough information to answer that."
"Answer using only the provided knowledge base excerpts. If the context is insufficient, say exactly: The knowledge base does not contain enough information to answer that."
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 87
},
},
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 88
{
{
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 89
role: "user",
role: "user",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 90
content: prompt
content: prompt
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 91
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 92
]
]
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 93
})
})
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 94
});
});
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 95
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 96
if (!response.ok) {
if (!response.ok) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 97
throw new Error(`AI provider request failed with status ${response.status}`);
throw new Error(`AI provider request failed with status ${response.status}`);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 98
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 99
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 100
const body = (await response.json()) as {
const body = (await response.json()) as {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 101
choices?: Array<{ message?: { content?: string } }>;
choices?: Array<{ message?: { content?: string } }>;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 102
};
};
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 103
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 104
return body.choices?.[0]?.message?.content?.trim() ?? "";
return body.choices?.[0]?.message?.content?.trim() ?? "";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 105
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 106
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 107
if (provider.provider === "anthropic_compatible") {
if (provider.provider === "anthropic_compatible") {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 108
const response = await fetch("https://api.anthropic.com/v1/messages", {
const response = await fetch("https://api.anthropic.com/v1/messages", {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 109
method: "POST",
method: "POST",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 110
headers: {
headers: {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 111
"x-api-key": provider.apiKey,
"x-api-key": provider.apiKey,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 112
"anthropic-version": "2023-06-01",
"anthropic-version": "2023-06-01",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 113
"Content-Type": "application/json"
"Content-Type": "application/json"
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 114
},
},
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 115
body: JSON.stringify({
body: JSON.stringify({
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 116
model: provider.model,
model: provider.model,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 117
max_tokens: 500,
max_tokens: 500,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 118
messages: [
messages: [
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 119
{
{
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 120
role: "user",
role: "user",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 121
content: prompt
content: prompt
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 122
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 123
],
],
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 124
system:
system:
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 125
"Answer using only the provided knowledge base excerpts. If the context is insufficient, say exactly: The knowledge base does not contain enough information to answer that."
"Answer using only the provided knowledge base excerpts. If the context is insufficient, say exactly: The knowledge base does not contain enough information to answer that."
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 126
})
})
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 127
});
});
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 128
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 129
if (!response.ok) {
if (!response.ok) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 130
throw new Error(`AI provider request failed with status ${response.status}`);
throw new Error(`AI provider request failed with status ${response.status}`);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 131
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 132
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 133
const body = (await response.json()) as {
const body = (await response.json()) as {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 134
content?: Array<{ text?: string }>;
content?: Array<{ text?: string }>;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 135
};
};
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 136
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 137
return body.content?.map((part) => part.text ?? "").join("").trim() ?? "";
return body.content?.map((part) => part.text ?? "").join("").trim() ?? "";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 138
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 139
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 140
return "";
return "";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 141
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 142
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 143
export async function answerQuestion(question: string, user: SessionUser | null) {
export async function answerQuestion(question: string, user: SessionUser | null) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 144
const pages = await searchPages(question, user);
const pages = await searchPages(question, user);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 145
if (pages.length === 0) {
if (pages.length === 0) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 146
return {
return {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 147
answer: "The knowledge base does not contain enough information to answer that.",
answer: "The knowledge base does not contain enough information to answer that.",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 148
citations: [],
citations: [],
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 149
disabled: false
disabled: false
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 150
};
};
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 151
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 152
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 153
const provider = await resolveProviderConfig();
const provider = await resolveProviderConfig();
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 154
if (!provider) {
if (!provider) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 155
return {
return {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 156
answer: "",
answer: "",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 157
citations: [],
citations: [],
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 158
disabled: true
disabled: true
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 159
};
};
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 160
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 161
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 162
const citations = [];
const citations = [];
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 163
const contextBlocks: string[] = [];
const contextBlocks: string[] = [];
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 164
for (const page of pages.slice(0, 4)) {
for (const page of pages.slice(0, 4)) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 165
const detail = await getPageBySlug(page.slug, user);
const detail = await getPageBySlug(page.slug, user);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 166
if (!detail) {
if (!detail) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 167
continue;
continue;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 168
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 169
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 170
citations.push({
citations.push({
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 171
title: detail.title,
title: detail.title,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 172
slug: detail.slug
slug: detail.slug
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 173
});
});
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 174
contextBlocks.push(`Title: ${detail.title}\nSlug: ${detail.slug}\nContent:\n${detail.bodyMarkdown.slice(0, 3000)}`);
contextBlocks.push(`Title: ${detail.title}\nSlug: ${detail.slug}\nContent:\n${detail.bodyMarkdown.slice(0, 3000)}`);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 175
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 176
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 177
if (contextBlocks.length === 0) {
if (contextBlocks.length === 0) {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 178
return {
return {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 179
answer: "The knowledge base does not contain enough information to answer that.",
answer: "The knowledge base does not contain enough information to answer that.",
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 180
citations: [],
citations: [],
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 181
disabled: false
disabled: false
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 182
};
};
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 183
}
}
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 184
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 185
const prompt = `Question:\n${question}\n\nKnowledge base excerpts:\n\n${contextBlocks.join("\n\n---\n\n")}\n\nRespond with a concise answer grounded in the excerpts only.`;
const prompt = `Question:\n${question}\n\nKnowledge base excerpts:\n\n${contextBlocks.join("\n\n---\n\n")}\n\nRespond with a concise answer grounded in the excerpts only.`;
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 186
const answer = await generateWithProvider(provider, prompt);
const answer = await generateWithProvider(provider, prompt);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 187
const normalizedAnswer =
const normalizedAnswer =
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 188
answer || "The knowledge base does not contain enough information to answer that.";
answer || "The knowledge base does not contain enough information to answer that.";
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 189
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 190
await pool.query(
await pool.query(
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 191
`
`
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 192
INSERT INTO ai_answer_logs (user_id, question, answer, citations)
INSERT INTO ai_answer_logs (user_id, question, answer, citations)
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 193
VALUES ($1, $2, $3, $4)
VALUES ($1, $2, $3, $4)
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 194
`,
`,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 195
[user?.id ?? null, question, normalizedAnswer, JSON.stringify(citations)]
[user?.id ?? null, question, normalizedAnswer, JSON.stringify(citations)]
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 196
);
);
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 197
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 198
return {
return {
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 199
answer: normalizedAnswer,
answer: normalizedAnswer,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 200
citations,
citations,
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 201
disabled: false
disabled: false
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 202
};
};
same change
5600eb6
Build enterprise imports webhooks and AI admin workflows
- Full commit hash
5600eb6c876ab31ee652ee6abe12884b31088496- Author
- Alex Nord <[email protected]>
- Date
- 3 months ago
- Selected line
- 203
}
}