Skip to content

Commit

Permalink
fix: scores (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt authored Nov 8, 2024
1 parent 8826b47 commit c2ec2f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/api/v1/runs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })}`;
Expand Down
7 changes: 1 addition & 6 deletions packages/backend/src/utils/ingest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit c2ec2f9

Please sign in to comment.