Merge branch 'master' of github.com:Budibase/budibase into frontend-core-ts-2

This commit is contained in:
Andrew Kingston 2024-12-04 11:45:56 +00:00
commit f57dbfa1b8
No known key found for this signature in database
13 changed files with 26 additions and 30 deletions

View File

@ -46,6 +46,11 @@ server {
}
location ~ ^/api/(system|admin|global)/ {
# Enable buffering for potentially large OIDC configs
proxy_buffering on;
proxy_buffer_size 16k;
proxy_buffers 4 32k;
proxy_pass http://127.0.0.1:4002;
}

View File

@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "3.2.21",
"version": "3.2.24",
"npmClient": "yarn",
"concurrency": 20,
"command": {

View File

@ -63,7 +63,7 @@
if (!name?.length) {
return "Name is required"
}
if (snippets.some(snippet => snippet.name === name)) {
if (!snippet?.name && snippets.some(snippet => snippet.name === name)) {
return "That name is already in use"
}
if (firstCharNumberRegex.test(name)) {
@ -106,11 +106,7 @@
Delete
</Button>
{/if}
<Button
cta
on:click={saveSnippet}
disabled={!snippet && (loading || nameError)}
>
<Button cta on:click={saveSnippet} disabled={!code || loading || nameError}>
Save
</Button>
</svelte:fragment>

View File

@ -186,7 +186,7 @@
<div class="snippet-popover">
{#key hoveredSnippet}
<CodeEditor
value={hoveredSnippet.code.trim()}
value={hoveredSnippet.code?.trim()}
mode={EditorModes.JS}
readonly
/>

@ -1 +1 @@
Subproject commit d9245f3d6d0b41ec2e6b3406b791f9e7448882cb
Subproject commit 7b8789efd940d9f8e5be9927243b19f07361c445

View File

@ -48,7 +48,7 @@ jest.mock("@budibase/pro", () => ({
ai: {
LargeLanguageModel: {
forCurrentTenant: async () => ({
initialised: true,
llm: {},
run: jest.fn(() => `Mock LLM Response`),
buildPromptFromAIOperation: jest.fn(),
}),

View File

@ -52,7 +52,7 @@ jest.mock("@budibase/pro", () => ({
ai: {
LargeLanguageModel: {
forCurrentTenant: async () => ({
initialised: true,
llm: {},
run: jest.fn(() => `Mock LLM Response`),
buildPromptFromAIOperation: jest.fn(),
}),

View File

@ -106,13 +106,15 @@ export async function run({
(await features.flags.isEnabled(FeatureFlag.BUDIBASE_AI)) &&
(await pro.features.isBudibaseAIEnabled())
let llm
let llmWrapper
if (budibaseAIEnabled || customConfigsEnabled) {
llm = await pro.ai.LargeLanguageModel.forCurrentTenant(inputs.model)
llmWrapper = await pro.ai.LargeLanguageModel.forCurrentTenant(
inputs.model
)
}
response = llm?.initialised
? await llm.run(inputs.prompt)
response = llmWrapper?.llm
? await llmWrapper.run(inputs.prompt)
: await legacyOpenAIPrompt(inputs)
return {

View File

@ -27,7 +27,7 @@ jest.mock("@budibase/pro", () => ({
ai: {
LargeLanguageModel: {
forCurrentTenant: jest.fn().mockImplementation(() => ({
initialised: true,
llm: {},
init: jest.fn(),
run: jest.fn(),
})),

View File

@ -18,7 +18,7 @@ jest.mock("@budibase/pro", () => ({
ai: {
LargeLanguageModel: {
forCurrentTenant: async () => ({
initialised: true,
llm: {},
run: jest.fn(() => "response from LLM"),
buildPromptFromAIOperation: buildPromptMock,
}),

View File

@ -126,8 +126,10 @@ export async function processAIColumns<T extends Row | Row[]>(
const numRows = Array.isArray(inputRows) ? inputRows.length : 1
span?.addTags({ table_id: table._id, numRows })
const rows = Array.isArray(inputRows) ? inputRows : [inputRows]
const llm = await pro.ai.LargeLanguageModel.forCurrentTenant("gpt-4o-mini")
if (rows && llm.initialised) {
const llmWrapper = await pro.ai.LargeLanguageModel.forCurrentTenant(
"gpt-4o-mini"
)
if (rows && llmWrapper.llm) {
// Ensure we have snippet context
await context.ensureSnippetContext()
@ -151,14 +153,14 @@ export async function processAIColumns<T extends Row | Row[]>(
}
}
const prompt = llm.buildPromptFromAIOperation({
const prompt = llmWrapper.buildPromptFromAIOperation({
schema: aiSchema,
row,
})
return tracer.trace("processAIColumn", {}, async span => {
span?.addTags({ table_id: table._id, column })
const llmResponse = await llm.run(prompt!)
const llmResponse = await llmWrapper.run(prompt!)
return {
...row,
[column]: llmResponse,

View File

@ -1,4 +1,3 @@
export * from "./accounts"
export * from "./user"
export * from "./license"
export * from "./status"

View File

@ -1,8 +0,0 @@
export interface PostAccountUserActivity {
timestamp: number
}
export interface PostAccountUserActivityResponse {
userId: string
timestamp: number
}