Skip to content

Commit

Permalink
fix: updateData not updating records correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeherby committed Apr 21, 2024
1 parent b4d2821 commit 9947588
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
10 changes: 2 additions & 8 deletions docker-compose.full.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ services:
langtrace-ui:
build:
dockerfile: Dockerfile.ui
args:
LANGTRACE_API_URL: http://langtrace-api:1994
NEXTAUTH_ENABLED: true
NEXTAUTH_URL: http://langtrace-ui:3000
NEXTAUTH_SECRET: secret
NEXTAUTH_GITHUB_ID: id
NEXTAUTH_GITHUB_SECRET: secret
NEXTAUTH_GITHUB_ORGANISATION: organisation
image: langtrace-ui:local
ports:
- "3000:3000"
env_file:
- ./packages/ui/.env.docker
depends_on:
- langtrace-api

Expand Down
6 changes: 3 additions & 3 deletions packages/ingest/src/repositories/mongodb-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ export class MongodbRepository {

async updateTrace(langtraceId: string, updateData: TraceData): Promise<UpdateResult> {
const collection = this.db.collection(this.collectionName);
return collection.updateOne({ run_id: { $eq: langtraceId } }, { $set: { updateData } });
return collection.updateOne({ run_id: { $eq: langtraceId } }, { $set: { ...updateData } });
}

async insertFeedbackOnTraceByRunId(feedback: CreateFeedback) {
const collection = this.db.collection('traces');
const collection = this.db.collection(this.collectionName);
await collection.updateOne({ run_id: { $eq: feedback.run_id } }, { $set: { feedback } });
}

async updateFeedbackOnTraceByFeedbackId(
feedbackId: string,
feedbackData: UpdateFeedback):
Promise<UpdateResult> {
const collection = this.db.collection('traces');
const collection = this.db.collection(this.collectionName);

const setOperation: Record<string, unknown> = {};
for (const [key, value] of Object.entries(feedbackData)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"license": "GPL-3.0",
"scripts": {
"dev": "next dev",
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/services/projects-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export async function getProjects(): Promise<ProjectResponse[]> {
const response = await fetch(`${config.langtraceApiUrl}/langtrace/api/projects`);

if (!response.ok) {
console.error(response);
throw new Error('Network response was not ok');
}
const data = await response.json();
Expand Down

0 comments on commit 9947588

Please sign in to comment.