diff --git a/packages/backend/src/api/v1/runs/index.ts b/packages/backend/src/api/v1/runs/index.ts index d88025dd..3aa99e16 100644 --- a/packages/backend/src/api/v1/runs/index.ts +++ b/packages/backend/src/api/v1/runs/index.ts @@ -1019,7 +1019,7 @@ runs.patch( const { label, value, comment } = Score.parse(ctx.request.body); let [existingScore] = - await sql`select * from run_score where run_id = ${runId}`; + await sql`select * from run_score where run_id = ${runId} and label = ${label}`; if (!existingScore) { await sql`insert into run_score ${sql({ runId, label, value, comment })}`; diff --git a/packages/backend/src/utils/ingest.ts b/packages/backend/src/utils/ingest.ts index 9a4c14f5..a3af1654 100644 --- a/packages/backend/src/utils/ingest.ts +++ b/packages/backend/src/utils/ingest.ts @@ -243,8 +243,6 @@ export async function ingestChatEvent( let update: any = {}; // todo: type let operation = "insert"; - console.log(run, previousRun, "\n"); - if (previousRun) { // Those are computed columns, so we need to remove them delete previousRun.duration; @@ -279,13 +277,10 @@ export async function ingestChatEvent( operation = "update"; } else if (INPUT_TYPES.includes(role)) { if (previousRun.output) { + console.log("HERE BUDDY"); // if last is bot message, create new run with input array update.input = [coreMessage]; operation = "insert"; - } else if (previousRun.type === "custom-event") { - update.output = [coreMessage]; - operation = "insert"; - console.log("HEREk"); } else { // append coreMessage to input (if if was an array, otherwise create an array) update.input = [...(previousRun.input || []), coreMessage];