From a8b6c23efb2b76743c9f75d7e5d7f6b0840291c1 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Mon, 14 Aug 2023 16:04:11 +0200 Subject: [PATCH 01/31] Fix sass file extension; Add global margin around buttons --- .../{evaluation.component.sass => evaluation.component.css} | 0 ui/reval-web/src/app/evaluation/evaluation.component.ts | 2 +- ui/reval-web/src/styles.css | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) rename ui/reval-web/src/app/evaluation/{evaluation.component.sass => evaluation.component.css} (100%) diff --git a/ui/reval-web/src/app/evaluation/evaluation.component.sass b/ui/reval-web/src/app/evaluation/evaluation.component.css similarity index 100% rename from ui/reval-web/src/app/evaluation/evaluation.component.sass rename to ui/reval-web/src/app/evaluation/evaluation.component.css diff --git a/ui/reval-web/src/app/evaluation/evaluation.component.ts b/ui/reval-web/src/app/evaluation/evaluation.component.ts index f6f414a..3bea309 100644 --- a/ui/reval-web/src/app/evaluation/evaluation.component.ts +++ b/ui/reval-web/src/app/evaluation/evaluation.component.ts @@ -6,7 +6,7 @@ import { PostEvaluationRequest } from 'src/openapi-client/evaluationapi'; @Component({ selector: 'app-evaluation', templateUrl: './evaluation.component.html', - styleUrls: ['./evaluation.component.sass'] + styleUrls: ['./evaluation.component.css'] }) export class EvaluationComponent { diff --git a/ui/reval-web/src/styles.css b/ui/reval-web/src/styles.css index 7e7239a..346263d 100644 --- a/ui/reval-web/src/styles.css +++ b/ui/reval-web/src/styles.css @@ -2,3 +2,7 @@ html, body { height: 100%; } body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } + +button { + margin: 6px; +} \ No newline at end of file From de3f5ac9a12bb4dab2cb7a8576114fdb0c94ad32 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 16 Aug 2023 13:52:09 +0200 Subject: [PATCH 02/31] Create new page for listing content --- ui/reval-web/angular.json | 3 +++ ui/reval-web/src/app/app-routing.module.ts | 14 +++++++++++-- ui/reval-web/src/app/app.module.ts | 4 +++- ui/reval-web/src/app/list/list.component.css | 0 ui/reval-web/src/app/list/list.component.html | 1 + .../src/app/list/list.component.spec.ts | 21 +++++++++++++++++++ ui/reval-web/src/app/list/list.component.ts | 10 +++++++++ 7 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 ui/reval-web/src/app/list/list.component.css create mode 100644 ui/reval-web/src/app/list/list.component.html create mode 100644 ui/reval-web/src/app/list/list.component.spec.ts create mode 100644 ui/reval-web/src/app/list/list.component.ts diff --git a/ui/reval-web/angular.json b/ui/reval-web/angular.json index 067bb84..757cfbe 100644 --- a/ui/reval-web/angular.json +++ b/ui/reval-web/angular.json @@ -96,5 +96,8 @@ } } } + }, + "cli": { + "analytics": false } } diff --git a/ui/reval-web/src/app/app-routing.module.ts b/ui/reval-web/src/app/app-routing.module.ts index 0297262..50d740e 100644 --- a/ui/reval-web/src/app/app-routing.module.ts +++ b/ui/reval-web/src/app/app-routing.module.ts @@ -1,10 +1,20 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { CommonModule } from '@angular/common'; +import { ListComponent } from './list/list.component'; +import { EvaluationComponent } from './evaluation/evaluation.component'; -const routes: Routes = []; +const routes: Routes = [ + { path: '', component: EvaluationComponent }, + { path: 'about', component: ListComponent } +]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + declarations: [], + imports: [ + CommonModule, + RouterModule.forRoot(routes) + ], exports: [RouterModule] }) export class AppRoutingModule { } diff --git a/ui/reval-web/src/app/app.module.ts b/ui/reval-web/src/app/app.module.ts index f8c650b..533e886 100644 --- a/ui/reval-web/src/app/app.module.ts +++ b/ui/reval-web/src/app/app.module.ts @@ -13,11 +13,13 @@ import { MatCardModule } from '@angular/material/card'; import { MatGridListModule } from '@angular/material/grid-list'; import { MatBadgeModule } from '@angular/material/badge'; import { EvaluationComponent } from './evaluation/evaluation.component'; +import { ListComponent } from './list/list.component'; @NgModule({ declarations: [ AppComponent, - EvaluationComponent + EvaluationComponent, + ListComponent ], imports: [ BrowserModule, diff --git a/ui/reval-web/src/app/list/list.component.css b/ui/reval-web/src/app/list/list.component.css new file mode 100644 index 0000000..e69de29 diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html new file mode 100644 index 0000000..7c1fe15 --- /dev/null +++ b/ui/reval-web/src/app/list/list.component.html @@ -0,0 +1 @@ +

list works!

diff --git a/ui/reval-web/src/app/list/list.component.spec.ts b/ui/reval-web/src/app/list/list.component.spec.ts new file mode 100644 index 0000000..1b7458c --- /dev/null +++ b/ui/reval-web/src/app/list/list.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ListComponent } from './list.component'; + +describe('ListComponent', () => { + let component: ListComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [ListComponent] + }); + fixture = TestBed.createComponent(ListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ui/reval-web/src/app/list/list.component.ts b/ui/reval-web/src/app/list/list.component.ts new file mode 100644 index 0000000..a92a495 --- /dev/null +++ b/ui/reval-web/src/app/list/list.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-list', + templateUrl: './list.component.html', + styleUrls: ['./list.component.css'] +}) +export class ListComponent { + +} From 571d086089f3cb1fd3b0de4ec219df5760f5cc32 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 16 Aug 2023 16:01:50 +0200 Subject: [PATCH 03/31] Enable dynamic routing in the app --- ui/reval-web/src/app/app.component.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ui/reval-web/src/app/app.component.html b/ui/reval-web/src/app/app.component.html index f59e4ec..459537c 100644 --- a/ui/reval-web/src/app/app.component.html +++ b/ui/reval-web/src/app/app.component.html @@ -351,7 +351,7 @@ - + @@ -383,5 +383,3 @@ - - From 06ab601ec89ce7c6e27d57b513f5201362b144c7 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Thu, 17 Aug 2023 16:52:51 +0200 Subject: [PATCH 04/31] Provide a template for data presentation --- ui/reval-web/package-lock.json | 500 +++++++++++++++++- ui/reval-web/package.json | 4 +- ui/reval-web/src/app/app-routing.module.ts | 2 +- ui/reval-web/src/app/app.module.ts | 4 + ui/reval-web/src/app/list/data.ts | 14 + ui/reval-web/src/app/list/list.component.css | 19 + ui/reval-web/src/app/list/list.component.html | 29 +- ui/reval-web/src/app/list/list.component.ts | 31 ++ 8 files changed, 598 insertions(+), 5 deletions(-) create mode 100644 ui/reval-web/src/app/list/data.ts diff --git a/ui/reval-web/package-lock.json b/ui/reval-web/package-lock.json index eddec0c..ed98f57 100644 --- a/ui/reval-web/package-lock.json +++ b/ui/reval-web/package-lock.json @@ -19,6 +19,7 @@ "@angular/platform-browser-dynamic": "^16.1.0", "@angular/router": "^16.1.0", "@openapitools/openapi-generator-cli": "^2.7.0", + "@swimlane/ngx-charts": "^20.4.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.13.0" @@ -27,6 +28,7 @@ "@angular-devkit/build-angular": "^16.1.7", "@angular/cli": "~16.1.7", "@angular/compiler-cli": "^16.1.0", + "@types/d3": "^7.4.0", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.6.0", "karma": "~6.4.0", @@ -4432,6 +4434,37 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", "dev": true }, + "node_modules/@swimlane/ngx-charts": { + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@swimlane/ngx-charts/-/ngx-charts-20.4.1.tgz", + "integrity": "sha512-DyTQe0fcqLDoLEZca45gkdjxP8iLH7kh4pCkr+TCFIkmgEdfQ5DpavNBOOVO0qd5J5uV/tbtSnkYWSx8JkbFpg==", + "dependencies": { + "d3-array": "^3.1.1", + "d3-brush": "^3.0.0", + "d3-color": "^3.1.0", + "d3-ease": "^3.0.1", + "d3-format": "^3.1.0", + "d3-hierarchy": "^3.1.0", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-selection": "^3.0.0", + "d3-shape": "^3.2.0", + "d3-time-format": "^3.0.0", + "d3-transition": "^3.0.1", + "rfdc": "^1.3.0", + "tslib": "^2.0.0" + }, + "peerDependencies": { + "@angular/animations": ">=12.0.0", + "@angular/cdk": ">=12.0.0", + "@angular/common": ">=12.0.0", + "@angular/core": ">=12.0.0", + "@angular/forms": ">=12.0.0", + "@angular/platform-browser": ">=12.0.0", + "@angular/platform-browser-dynamic": ">=12.0.0", + "rxjs": "^6.5.3 || ^7.4.0" + } + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -4540,6 +4573,259 @@ "@types/node": "*" } }, + "node_modules/@types/d3": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.0.tgz", + "integrity": "sha512-jIfNVK0ZlxcuRDKtRS/SypEyOQ6UHaFQBKv032X45VvxSJ6Yi5G9behy9h6tNTHTDGh5Vq+KbmBjUWLgY4meCA==", + "dev": true, + "dependencies": { + "@types/d3-array": "*", + "@types/d3-axis": "*", + "@types/d3-brush": "*", + "@types/d3-chord": "*", + "@types/d3-color": "*", + "@types/d3-contour": "*", + "@types/d3-delaunay": "*", + "@types/d3-dispatch": "*", + "@types/d3-drag": "*", + "@types/d3-dsv": "*", + "@types/d3-ease": "*", + "@types/d3-fetch": "*", + "@types/d3-force": "*", + "@types/d3-format": "*", + "@types/d3-geo": "*", + "@types/d3-hierarchy": "*", + "@types/d3-interpolate": "*", + "@types/d3-path": "*", + "@types/d3-polygon": "*", + "@types/d3-quadtree": "*", + "@types/d3-random": "*", + "@types/d3-scale": "*", + "@types/d3-scale-chromatic": "*", + "@types/d3-selection": "*", + "@types/d3-shape": "*", + "@types/d3-time": "*", + "@types/d3-time-format": "*", + "@types/d3-timer": "*", + "@types/d3-transition": "*", + "@types/d3-zoom": "*" + } + }, + "node_modules/@types/d3-array": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.0.5.tgz", + "integrity": "sha512-Qk7fpJ6qFp+26VeQ47WY0mkwXaiq8+76RJcncDEfMc2ocRzXLO67bLFRNI4OX1aGBoPzsM5Y2T+/m1pldOgD+A==", + "dev": true + }, + "node_modules/@types/d3-axis": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.2.tgz", + "integrity": "sha512-uGC7DBh0TZrU/LY43Fd8Qr+2ja1FKmH07q2FoZFHo1eYl8aj87GhfVoY1saJVJiq24rp1+wpI6BvQJMKgQm8oA==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-brush": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.2.tgz", + "integrity": "sha512-2TEm8KzUG3N7z0TrSKPmbxByBx54M+S9lHoP2J55QuLU0VSQ9mE96EJSAOVNEqd1bbynMjeTS9VHmz8/bSw8rA==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-chord": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.2.tgz", + "integrity": "sha512-abT/iLHD3sGZwqMTX1TYCMEulr+wBd0SzyOQnjYNLp7sngdOHYtNkMRI5v3w5thoN+BWtlHVDx2Osvq6fxhZWw==", + "dev": true + }, + "node_modules/@types/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-HKuicPHJuvPgCD+np6Se9MQvS6OCbJmOjGvylzMJRlDwUXjKTTXs6Pwgk79O09Vj/ho3u1ofXnhFOaEWWPrlwA==", + "dev": true + }, + "node_modules/@types/d3-contour": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-3.0.2.tgz", + "integrity": "sha512-k6/bGDoAGJZnZWaKzeB+9glgXCYGvh6YlluxzBREiVo8f/X2vpTEdgPy9DN7Z2i42PZOZ4JDhVdlTSTSkLDPlQ==", + "dev": true, + "dependencies": { + "@types/d3-array": "*", + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-delaunay": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.1.tgz", + "integrity": "sha512-tLxQ2sfT0p6sxdG75c6f/ekqxjyYR0+LwPrsO1mbC9YDBzPJhs2HbJJRrn8Ez1DBoHRo2yx7YEATI+8V1nGMnQ==", + "dev": true + }, + "node_modules/@types/d3-dispatch": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.2.tgz", + "integrity": "sha512-rxN6sHUXEZYCKV05MEh4z4WpPSqIw+aP7n9ZN6WYAAvZoEAghEK1WeVZMZcHRBwyaKflU43PCUAJNjFxCzPDjg==", + "dev": true + }, + "node_modules/@types/d3-drag": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.2.tgz", + "integrity": "sha512-qmODKEDvyKWVHcWWCOVcuVcOwikLVsyc4q4EBJMREsoQnR2Qoc2cZQUyFUPgO9q4S3qdSqJKBsuefv+h0Qy+tw==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-76pBHCMTvPLt44wFOieouXcGXWOF0AJCceUvaFkxSZEu4VDUdv93JfpMa6VGNFs01FHfuP4a5Ou68eRG1KBfTw==", + "dev": true + }, + "node_modules/@types/d3-ease": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.0.tgz", + "integrity": "sha512-aMo4eaAOijJjA6uU+GIeW018dvy9+oH5Y2VPPzjjfxevvGQ/oRDs+tfYC9b50Q4BygRR8yE2QCLsrT0WtAVseA==", + "dev": true + }, + "node_modules/@types/d3-fetch": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-3.0.2.tgz", + "integrity": "sha512-gllwYWozWfbep16N9fByNBDTkJW/SyhH6SGRlXloR7WdtAaBui4plTP+gbUgiEot7vGw/ZZop1yDZlgXXSuzjA==", + "dev": true, + "dependencies": { + "@types/d3-dsv": "*" + } + }, + "node_modules/@types/d3-force": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.4.tgz", + "integrity": "sha512-q7xbVLrWcXvSBBEoadowIUJ7sRpS1yvgMWnzHJggFy5cUZBq2HZL5k/pBSm0GdYWS1vs5/EDwMjSKF55PDY4Aw==", + "dev": true + }, + "node_modules/@types/d3-format": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.1.tgz", + "integrity": "sha512-5KY70ifCCzorkLuIkDe0Z9YTf9RR2CjBX1iaJG+rgM/cPP+sO+q9YdQ9WdhQcgPj1EQiJ2/0+yUkkziTG6Lubg==", + "dev": true + }, + "node_modules/@types/d3-geo": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.0.3.tgz", + "integrity": "sha512-bK9uZJS3vuDCNeeXQ4z3u0E7OeJZXjUgzFdSOtNtMCJCLvDtWDwfpRVWlyt3y8EvRzI0ccOu9xlMVirawolSCw==", + "dev": true, + "dependencies": { + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-9hjRTVoZjRFR6xo8igAJyNXQyPX6Aq++Nhb5ebrUF414dv4jr2MitM2fWiOY475wa3Za7TOS2Gh9fmqEhLTt0A==", + "dev": true + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-jx5leotSeac3jr0RePOH1KdR9rISG91QIE4Q2PYTu4OymLTZfA3SrnURSLzKH48HmXVUru50b8nje4E79oQSQw==", + "dev": true, + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.0.0.tgz", + "integrity": "sha512-0g/A+mZXgFkQxN3HniRDbXMN79K3CdTpLsevj+PXiTcb2hVyvkZUBg37StmgCQkaD84cUJ4uaDAWq7UJOQy2Tg==", + "dev": true + }, + "node_modules/@types/d3-polygon": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.0.tgz", + "integrity": "sha512-D49z4DyzTKXM0sGKVqiTDTYr+DHg/uxsiWDAkNrwXYuiZVd9o9wXZIo+YsHkifOiyBkmSWlEngHCQme54/hnHw==", + "dev": true + }, + "node_modules/@types/d3-quadtree": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.2.tgz", + "integrity": "sha512-QNcK8Jguvc8lU+4OfeNx+qnVy7c0VrDJ+CCVFS9srBo2GL9Y18CnIxBdTF3v38flrGy5s1YggcoAiu6s4fLQIw==", + "dev": true + }, + "node_modules/@types/d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-IIE6YTekGczpLYo/HehAy3JGF1ty7+usI97LqraNa8IiDur+L44d0VOjAvFQWJVdZOJHukUJw+ZdZBlgeUsHOQ==", + "dev": true + }, + "node_modules/@types/d3-scale": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.3.tgz", + "integrity": "sha512-PATBiMCpvHJSMtZAMEhc2WyL+hnzarKzI6wAHYjhsonjWJYGq5BXTzQjv4l8m2jO183/4wZ90rKvSeT7o72xNQ==", + "dev": true, + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-scale-chromatic": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.0.0.tgz", + "integrity": "sha512-dsoJGEIShosKVRBZB0Vo3C8nqSDqVGujJU6tPznsBJxNJNwMF8utmS83nvCBKQYPpjCzaaHcrf66iTRpZosLPw==", + "dev": true + }, + "node_modules/@types/d3-selection": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.5.tgz", + "integrity": "sha512-xCB0z3Hi8eFIqyja3vW8iV01+OHGYR2di/+e+AiOcXIOrY82lcvWW8Ke1DYE/EUVMsBl4Db9RppSBS3X1U6J0w==", + "dev": true + }, + "node_modules/@types/d3-shape": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.1.tgz", + "integrity": "sha512-6Uh86YFF7LGg4PQkuO2oG6EMBRLuW9cbavUW46zkIO5kuS2PfTqo2o9SkgtQzguBHbLgNnU90UNsITpsX1My+A==", + "dev": true, + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg==", + "dev": true + }, + "node_modules/@types/d3-time-format": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.0.tgz", + "integrity": "sha512-yjfBUe6DJBsDin2BMIulhSHmr5qNR5Pxs17+oW4DoVPyVIXZ+m6bs7j1UVKP08Emv6jRmYrYqxYzO63mQxy1rw==", + "dev": true + }, + "node_modules/@types/d3-timer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.0.tgz", + "integrity": "sha512-HNB/9GHqu7Fo8AQiugyJbv6ZxYz58wef0esl4Mv828w1ZKpAshw/uFWVDUcIB9KKFeFKoxS3cHY07FFgtTRZ1g==", + "dev": true + }, + "node_modules/@types/d3-transition": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.3.tgz", + "integrity": "sha512-/S90Od8Id1wgQNvIA8iFv9jRhCiZcGhPd2qX0bKF/PS+y0W5CrXKgIiELd2CvG1mlQrWK/qlYh3VxicqG1ZvgA==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-zoom": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.3.tgz", + "integrity": "sha512-OWk1yYIIWcZ07+igN6BeoG6rqhnJ/pYe+R1qWFM2DtW49zsoSjgb9G5xB0ZXA8hh2jAzey1XuRmMSoXdKw8MDA==", + "dev": true, + "dependencies": { + "@types/d3-interpolate": "*", + "@types/d3-selection": "*" + } + }, "node_modules/@types/eslint": { "version": "8.44.2", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz", @@ -4590,6 +4876,12 @@ "@types/send": "*" } }, + "node_modules/@types/geojson": { + "version": "7946.0.10", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz", + "integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==", + "dev": true + }, "node_modules/@types/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz", @@ -6593,6 +6885,203 @@ "integrity": "sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==", "dev": true }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-brush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", + "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "3", + "d3-transition": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz", + "integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==", + "dependencies": { + "d3-time": "1 - 2" + } + }, + "node_modules/d3-time-format/node_modules/d3-array": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz", + "integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==", + "dependencies": { + "internmap": "^1.0.0" + } + }, + "node_modules/d3-time-format/node_modules/d3-time": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.1.1.tgz", + "integrity": "sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ==", + "dependencies": { + "d3-array": "2" + } + }, + "node_modules/d3-time-format/node_modules/internmap": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz", + "integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==" + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "dependencies": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "d3-selection": "2 - 3" + } + }, "node_modules/data-urls": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", @@ -8475,6 +8964,14 @@ "node": ">=8" } }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "engines": { + "node": ">=12" + } + }, "node_modules/ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", @@ -11539,8 +12036,7 @@ "node_modules/rfdc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", - "dev": true + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" }, "node_modules/rimraf": { "version": "3.0.2", diff --git a/ui/reval-web/package.json b/ui/reval-web/package.json index 03ef582..e7ac7d6 100644 --- a/ui/reval-web/package.json +++ b/ui/reval-web/package.json @@ -24,6 +24,7 @@ "@angular/platform-browser-dynamic": "^16.1.0", "@angular/router": "^16.1.0", "@openapitools/openapi-generator-cli": "^2.7.0", + "@swimlane/ngx-charts": "^20.4.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.13.0" @@ -32,6 +33,7 @@ "@angular-devkit/build-angular": "^16.1.7", "@angular/cli": "~16.1.7", "@angular/compiler-cli": "^16.1.0", + "@types/d3": "^7.4.0", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.6.0", "karma": "~6.4.0", @@ -41,4 +43,4 @@ "karma-jasmine-html-reporter": "~2.1.0", "typescript": "~5.1.3" } -} \ No newline at end of file +} diff --git a/ui/reval-web/src/app/app-routing.module.ts b/ui/reval-web/src/app/app-routing.module.ts index 50d740e..6eff0f6 100644 --- a/ui/reval-web/src/app/app-routing.module.ts +++ b/ui/reval-web/src/app/app-routing.module.ts @@ -6,7 +6,7 @@ import { EvaluationComponent } from './evaluation/evaluation.component'; const routes: Routes = [ { path: '', component: EvaluationComponent }, - { path: 'about', component: ListComponent } + { path: 'list', component: ListComponent } ]; @NgModule({ diff --git a/ui/reval-web/src/app/app.module.ts b/ui/reval-web/src/app/app.module.ts index 533e886..2d5f02e 100644 --- a/ui/reval-web/src/app/app.module.ts +++ b/ui/reval-web/src/app/app.module.ts @@ -14,6 +14,8 @@ import { MatGridListModule } from '@angular/material/grid-list'; import { MatBadgeModule } from '@angular/material/badge'; import { EvaluationComponent } from './evaluation/evaluation.component'; import { ListComponent } from './list/list.component'; +import { MatListModule } from '@angular/material/list'; +import { NgxChartsModule } from '@swimlane/ngx-charts'; @NgModule({ declarations: [ @@ -33,6 +35,8 @@ import { ListComponent } from './list/list.component'; MatCardModule, MatGridListModule, MatBadgeModule, + MatListModule, + NgxChartsModule, ], providers: [], bootstrap: [AppComponent] diff --git a/ui/reval-web/src/app/list/data.ts b/ui/reval-web/src/app/list/data.ts new file mode 100644 index 0000000..071ff28 --- /dev/null +++ b/ui/reval-web/src/app/list/data.ts @@ -0,0 +1,14 @@ +export var evaluations = [ + { + "name": "negative", + "value": 38 + }, + { + "name": "unanswered", + "value": 20 + }, + { + "name": "positive", + "value": 360 + } +]; \ No newline at end of file diff --git a/ui/reval-web/src/app/list/list.component.css b/ui/reval-web/src/app/list/list.component.css index e69de29..8280372 100644 --- a/ui/reval-web/src/app/list/list.component.css +++ b/ui/reval-web/src/app/list/list.component.css @@ -0,0 +1,19 @@ +.inline-list { + display: flex; + height: fit-content; +} + +.scenario-card { + width: 100%; + padding: 10px; + border: thin solid; + border-color:grey; +} + +mat-divider { + margin-bottom: 5px; +} + +mat-card-heaer { + padding: 5px; +} \ No newline at end of file diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html index 7c1fe15..144ad58 100644 --- a/ui/reval-web/src/app/list/list.component.html +++ b/ui/reval-web/src/app/list/list.component.html @@ -1 +1,28 @@ -

list works!

+ + + + + + Szenario {{i}} + + + +
+

LLM: {{i}}

+

Prompt ID: {{i}}

+ +
+
+
+
diff --git a/ui/reval-web/src/app/list/list.component.ts b/ui/reval-web/src/app/list/list.component.ts index a92a495..c0b0fba 100644 --- a/ui/reval-web/src/app/list/list.component.ts +++ b/ui/reval-web/src/app/list/list.component.ts @@ -1,4 +1,6 @@ import { Component } from '@angular/core'; +import { MatListModule } from '@angular/material/list'; +import { evaluations } from './data'; @Component({ selector: 'app-list', @@ -6,5 +8,34 @@ import { Component } from '@angular/core'; styleUrls: ['./list.component.css'] }) export class ListComponent { + evaluations: any[] | undefined; + view: [number, number] = [400, 400]; + gradient: boolean = false; + showLegend: boolean = false; + showLabels: boolean = true; + isDoughnut: boolean = true; + + customColors = + [ + { name: "negative", value: '#eb4034' }, + { name: "unanswered", value: '#fae714' }, + { name: "positive", value: '#19bf19'}, + ] + + constructor() { + Object.assign(this, { evaluations }); + } + + onSelect(data: any): void { + console.log('Item clicked', JSON.parse(JSON.stringify(data))); + } + + onActivate(data: any): void { + console.log('Activate', JSON.parse(JSON.stringify(data))); + } + + onDeactivate(data: any): void { + console.log('Deactivate', JSON.parse(JSON.stringify(data))); + } } From 30756ec556c7fbd1213afc1bf0d21edee448816c Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 23 Aug 2023 11:11:09 +0200 Subject: [PATCH 05/31] First set of changes to connect the data to ui --- ui/reval-web/src/app/list/exampleRating.json | 39 +++++++++++++++++++ ui/reval-web/src/app/list/exampleRating.ts | 39 +++++++++++++++++++ ui/reval-web/src/app/list/list.component.html | 6 +-- ui/reval-web/src/app/list/list.component.ts | 5 ++- 4 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 ui/reval-web/src/app/list/exampleRating.json create mode 100644 ui/reval-web/src/app/list/exampleRating.ts diff --git a/ui/reval-web/src/app/list/exampleRating.json b/ui/reval-web/src/app/list/exampleRating.json new file mode 100644 index 0000000..06c5873 --- /dev/null +++ b/ui/reval-web/src/app/list/exampleRating.json @@ -0,0 +1,39 @@ +{ + "scenarios": [ + { + "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", + "name": "Szenario 1", + "desctiption": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", + "totalResponseCount": 400, + "progressStatistic": [ + { + "name": "rated", + "value": 70 + }, + { + "name": "unrated", + "value": 330 + } + ], + "resultStatistic": [ + { + "name": "positive", + "value": 12 + }, + { + "name": "negative", + "value": 46 + }, + { + "name": "neutral", + "value": 12 + } + ], + "ratingScore": { + "min": -1, + "value": 0.8, + "max": 1 + } + } + ] +} \ No newline at end of file diff --git a/ui/reval-web/src/app/list/exampleRating.ts b/ui/reval-web/src/app/list/exampleRating.ts new file mode 100644 index 0000000..72578f9 --- /dev/null +++ b/ui/reval-web/src/app/list/exampleRating.ts @@ -0,0 +1,39 @@ +export var ratings = { + "scenarios": [ + { + "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", + "name": "Szenario 1", + "desctiption": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", + "totalResponseCount": 400, + "progressStatistic": [ + { + "name": "rated", + "value": 70 + }, + { + "name": "unrated", + "value": 330 + } + ], + "resultStatistic": [ + { + "name": "positive", + "value": 12 + }, + { + "name": "negative", + "value": 46 + }, + { + "name": "neutral", + "value": 12 + } + ], + "ratingScore": { + "min": -1, + "value": 0.8, + "max": 1 + } + } + ] +} \ No newline at end of file diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html index 144ad58..a0a5dd1 100644 --- a/ui/reval-web/src/app/list/list.component.html +++ b/ui/reval-web/src/app/list/list.component.html @@ -1,5 +1,5 @@ - - + + @@ -13,7 +13,7 @@ Date: Wed, 16 Aug 2023 13:52:09 +0200 Subject: [PATCH 06/31] Create new page for listing content --- ui/reval-web/angular.json | 3 +++ ui/reval-web/src/app/app-routing.module.ts | 14 +++++++++++-- ui/reval-web/src/app/app.module.ts | 2 ++ ui/reval-web/src/app/list/list.component.css | 0 ui/reval-web/src/app/list/list.component.html | 1 + .../src/app/list/list.component.spec.ts | 21 +++++++++++++++++++ ui/reval-web/src/app/list/list.component.ts | 10 +++++++++ 7 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 ui/reval-web/src/app/list/list.component.css create mode 100644 ui/reval-web/src/app/list/list.component.html create mode 100644 ui/reval-web/src/app/list/list.component.spec.ts create mode 100644 ui/reval-web/src/app/list/list.component.ts diff --git a/ui/reval-web/angular.json b/ui/reval-web/angular.json index 067bb84..757cfbe 100644 --- a/ui/reval-web/angular.json +++ b/ui/reval-web/angular.json @@ -96,5 +96,8 @@ } } } + }, + "cli": { + "analytics": false } } diff --git a/ui/reval-web/src/app/app-routing.module.ts b/ui/reval-web/src/app/app-routing.module.ts index 0297262..50d740e 100644 --- a/ui/reval-web/src/app/app-routing.module.ts +++ b/ui/reval-web/src/app/app-routing.module.ts @@ -1,10 +1,20 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { CommonModule } from '@angular/common'; +import { ListComponent } from './list/list.component'; +import { EvaluationComponent } from './evaluation/evaluation.component'; -const routes: Routes = []; +const routes: Routes = [ + { path: '', component: EvaluationComponent }, + { path: 'about', component: ListComponent } +]; @NgModule({ - imports: [RouterModule.forRoot(routes)], + declarations: [], + imports: [ + CommonModule, + RouterModule.forRoot(routes) + ], exports: [RouterModule] }) export class AppRoutingModule { } diff --git a/ui/reval-web/src/app/app.module.ts b/ui/reval-web/src/app/app.module.ts index a3e00cc..14f69df 100644 --- a/ui/reval-web/src/app/app.module.ts +++ b/ui/reval-web/src/app/app.module.ts @@ -15,12 +15,14 @@ import { MatBadgeModule } from '@angular/material/badge'; import { EvaluationComponent } from './evaluation/evaluation.component'; import { AuthConfigModule } from './auth/auth-config.module'; import { UserprofileComponent } from './userprofile/userprofile.component'; +import { ListComponent } from './list/list.component'; @NgModule({ declarations: [ AppComponent, EvaluationComponent, UserprofileComponent, + ListComponent ], imports: [ BrowserModule, diff --git a/ui/reval-web/src/app/list/list.component.css b/ui/reval-web/src/app/list/list.component.css new file mode 100644 index 0000000..e69de29 diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html new file mode 100644 index 0000000..7c1fe15 --- /dev/null +++ b/ui/reval-web/src/app/list/list.component.html @@ -0,0 +1 @@ +

list works!

diff --git a/ui/reval-web/src/app/list/list.component.spec.ts b/ui/reval-web/src/app/list/list.component.spec.ts new file mode 100644 index 0000000..1b7458c --- /dev/null +++ b/ui/reval-web/src/app/list/list.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ListComponent } from './list.component'; + +describe('ListComponent', () => { + let component: ListComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [ListComponent] + }); + fixture = TestBed.createComponent(ListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ui/reval-web/src/app/list/list.component.ts b/ui/reval-web/src/app/list/list.component.ts new file mode 100644 index 0000000..a92a495 --- /dev/null +++ b/ui/reval-web/src/app/list/list.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-list', + templateUrl: './list.component.html', + styleUrls: ['./list.component.css'] +}) +export class ListComponent { + +} From 23c3cb7f61c70e8858c3ed9c9226b89290d82030 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 16 Aug 2023 16:01:50 +0200 Subject: [PATCH 07/31] Enable dynamic routing in the app --- ui/reval-web/src/app/app.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/reval-web/src/app/app.component.html b/ui/reval-web/src/app/app.component.html index 19b836b..2832122 100644 --- a/ui/reval-web/src/app/app.component.html +++ b/ui/reval-web/src/app/app.component.html @@ -337,6 +337,7 @@ + @@ -368,5 +369,4 @@ - - + \ No newline at end of file From 5b43c6511da2b173ab93db20e546d2dc1903dbe6 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Thu, 17 Aug 2023 16:52:51 +0200 Subject: [PATCH 08/31] Provide a template for data presentation --- ui/reval-web/package-lock.json | 500 +++++++++++++++++- ui/reval-web/package.json | 2 + ui/reval-web/src/app/app-routing.module.ts | 2 +- ui/reval-web/src/app/app.module.ts | 4 + ui/reval-web/src/app/list/data.ts | 14 + ui/reval-web/src/app/list/list.component.css | 19 + ui/reval-web/src/app/list/list.component.html | 29 +- ui/reval-web/src/app/list/list.component.ts | 31 ++ 8 files changed, 597 insertions(+), 4 deletions(-) create mode 100644 ui/reval-web/src/app/list/data.ts diff --git a/ui/reval-web/package-lock.json b/ui/reval-web/package-lock.json index c2b11f8..7b8a132 100644 --- a/ui/reval-web/package-lock.json +++ b/ui/reval-web/package-lock.json @@ -20,6 +20,7 @@ "@angular/router": "^16.1.0", "@openapitools/openapi-generator-cli": "^2.7.0", "angular-auth-oidc-client": "16.0.0", + "@swimlane/ngx-charts": "^20.4.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.13.0" @@ -28,6 +29,7 @@ "@angular-devkit/build-angular": "^16.1.7", "@angular/cli": "~16.1.7", "@angular/compiler-cli": "^16.1.0", + "@types/d3": "^7.4.0", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.6.0", "karma": "~6.4.0", @@ -4433,6 +4435,37 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", "dev": true }, + "node_modules/@swimlane/ngx-charts": { + "version": "20.4.1", + "resolved": "https://registry.npmjs.org/@swimlane/ngx-charts/-/ngx-charts-20.4.1.tgz", + "integrity": "sha512-DyTQe0fcqLDoLEZca45gkdjxP8iLH7kh4pCkr+TCFIkmgEdfQ5DpavNBOOVO0qd5J5uV/tbtSnkYWSx8JkbFpg==", + "dependencies": { + "d3-array": "^3.1.1", + "d3-brush": "^3.0.0", + "d3-color": "^3.1.0", + "d3-ease": "^3.0.1", + "d3-format": "^3.1.0", + "d3-hierarchy": "^3.1.0", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-selection": "^3.0.0", + "d3-shape": "^3.2.0", + "d3-time-format": "^3.0.0", + "d3-transition": "^3.0.1", + "rfdc": "^1.3.0", + "tslib": "^2.0.0" + }, + "peerDependencies": { + "@angular/animations": ">=12.0.0", + "@angular/cdk": ">=12.0.0", + "@angular/common": ">=12.0.0", + "@angular/core": ">=12.0.0", + "@angular/forms": ">=12.0.0", + "@angular/platform-browser": ">=12.0.0", + "@angular/platform-browser-dynamic": ">=12.0.0", + "rxjs": "^6.5.3 || ^7.4.0" + } + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -4541,6 +4574,259 @@ "@types/node": "*" } }, + "node_modules/@types/d3": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.0.tgz", + "integrity": "sha512-jIfNVK0ZlxcuRDKtRS/SypEyOQ6UHaFQBKv032X45VvxSJ6Yi5G9behy9h6tNTHTDGh5Vq+KbmBjUWLgY4meCA==", + "dev": true, + "dependencies": { + "@types/d3-array": "*", + "@types/d3-axis": "*", + "@types/d3-brush": "*", + "@types/d3-chord": "*", + "@types/d3-color": "*", + "@types/d3-contour": "*", + "@types/d3-delaunay": "*", + "@types/d3-dispatch": "*", + "@types/d3-drag": "*", + "@types/d3-dsv": "*", + "@types/d3-ease": "*", + "@types/d3-fetch": "*", + "@types/d3-force": "*", + "@types/d3-format": "*", + "@types/d3-geo": "*", + "@types/d3-hierarchy": "*", + "@types/d3-interpolate": "*", + "@types/d3-path": "*", + "@types/d3-polygon": "*", + "@types/d3-quadtree": "*", + "@types/d3-random": "*", + "@types/d3-scale": "*", + "@types/d3-scale-chromatic": "*", + "@types/d3-selection": "*", + "@types/d3-shape": "*", + "@types/d3-time": "*", + "@types/d3-time-format": "*", + "@types/d3-timer": "*", + "@types/d3-transition": "*", + "@types/d3-zoom": "*" + } + }, + "node_modules/@types/d3-array": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.0.5.tgz", + "integrity": "sha512-Qk7fpJ6qFp+26VeQ47WY0mkwXaiq8+76RJcncDEfMc2ocRzXLO67bLFRNI4OX1aGBoPzsM5Y2T+/m1pldOgD+A==", + "dev": true + }, + "node_modules/@types/d3-axis": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.2.tgz", + "integrity": "sha512-uGC7DBh0TZrU/LY43Fd8Qr+2ja1FKmH07q2FoZFHo1eYl8aj87GhfVoY1saJVJiq24rp1+wpI6BvQJMKgQm8oA==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-brush": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.2.tgz", + "integrity": "sha512-2TEm8KzUG3N7z0TrSKPmbxByBx54M+S9lHoP2J55QuLU0VSQ9mE96EJSAOVNEqd1bbynMjeTS9VHmz8/bSw8rA==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-chord": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.2.tgz", + "integrity": "sha512-abT/iLHD3sGZwqMTX1TYCMEulr+wBd0SzyOQnjYNLp7sngdOHYtNkMRI5v3w5thoN+BWtlHVDx2Osvq6fxhZWw==", + "dev": true + }, + "node_modules/@types/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-HKuicPHJuvPgCD+np6Se9MQvS6OCbJmOjGvylzMJRlDwUXjKTTXs6Pwgk79O09Vj/ho3u1ofXnhFOaEWWPrlwA==", + "dev": true + }, + "node_modules/@types/d3-contour": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-3.0.2.tgz", + "integrity": "sha512-k6/bGDoAGJZnZWaKzeB+9glgXCYGvh6YlluxzBREiVo8f/X2vpTEdgPy9DN7Z2i42PZOZ4JDhVdlTSTSkLDPlQ==", + "dev": true, + "dependencies": { + "@types/d3-array": "*", + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-delaunay": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.1.tgz", + "integrity": "sha512-tLxQ2sfT0p6sxdG75c6f/ekqxjyYR0+LwPrsO1mbC9YDBzPJhs2HbJJRrn8Ez1DBoHRo2yx7YEATI+8V1nGMnQ==", + "dev": true + }, + "node_modules/@types/d3-dispatch": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.2.tgz", + "integrity": "sha512-rxN6sHUXEZYCKV05MEh4z4WpPSqIw+aP7n9ZN6WYAAvZoEAghEK1WeVZMZcHRBwyaKflU43PCUAJNjFxCzPDjg==", + "dev": true + }, + "node_modules/@types/d3-drag": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.2.tgz", + "integrity": "sha512-qmODKEDvyKWVHcWWCOVcuVcOwikLVsyc4q4EBJMREsoQnR2Qoc2cZQUyFUPgO9q4S3qdSqJKBsuefv+h0Qy+tw==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-76pBHCMTvPLt44wFOieouXcGXWOF0AJCceUvaFkxSZEu4VDUdv93JfpMa6VGNFs01FHfuP4a5Ou68eRG1KBfTw==", + "dev": true + }, + "node_modules/@types/d3-ease": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.0.tgz", + "integrity": "sha512-aMo4eaAOijJjA6uU+GIeW018dvy9+oH5Y2VPPzjjfxevvGQ/oRDs+tfYC9b50Q4BygRR8yE2QCLsrT0WtAVseA==", + "dev": true + }, + "node_modules/@types/d3-fetch": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-3.0.2.tgz", + "integrity": "sha512-gllwYWozWfbep16N9fByNBDTkJW/SyhH6SGRlXloR7WdtAaBui4plTP+gbUgiEot7vGw/ZZop1yDZlgXXSuzjA==", + "dev": true, + "dependencies": { + "@types/d3-dsv": "*" + } + }, + "node_modules/@types/d3-force": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.4.tgz", + "integrity": "sha512-q7xbVLrWcXvSBBEoadowIUJ7sRpS1yvgMWnzHJggFy5cUZBq2HZL5k/pBSm0GdYWS1vs5/EDwMjSKF55PDY4Aw==", + "dev": true + }, + "node_modules/@types/d3-format": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.1.tgz", + "integrity": "sha512-5KY70ifCCzorkLuIkDe0Z9YTf9RR2CjBX1iaJG+rgM/cPP+sO+q9YdQ9WdhQcgPj1EQiJ2/0+yUkkziTG6Lubg==", + "dev": true + }, + "node_modules/@types/d3-geo": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.0.3.tgz", + "integrity": "sha512-bK9uZJS3vuDCNeeXQ4z3u0E7OeJZXjUgzFdSOtNtMCJCLvDtWDwfpRVWlyt3y8EvRzI0ccOu9xlMVirawolSCw==", + "dev": true, + "dependencies": { + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-9hjRTVoZjRFR6xo8igAJyNXQyPX6Aq++Nhb5ebrUF414dv4jr2MitM2fWiOY475wa3Za7TOS2Gh9fmqEhLTt0A==", + "dev": true + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-jx5leotSeac3jr0RePOH1KdR9rISG91QIE4Q2PYTu4OymLTZfA3SrnURSLzKH48HmXVUru50b8nje4E79oQSQw==", + "dev": true, + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.0.0.tgz", + "integrity": "sha512-0g/A+mZXgFkQxN3HniRDbXMN79K3CdTpLsevj+PXiTcb2hVyvkZUBg37StmgCQkaD84cUJ4uaDAWq7UJOQy2Tg==", + "dev": true + }, + "node_modules/@types/d3-polygon": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.0.tgz", + "integrity": "sha512-D49z4DyzTKXM0sGKVqiTDTYr+DHg/uxsiWDAkNrwXYuiZVd9o9wXZIo+YsHkifOiyBkmSWlEngHCQme54/hnHw==", + "dev": true + }, + "node_modules/@types/d3-quadtree": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.2.tgz", + "integrity": "sha512-QNcK8Jguvc8lU+4OfeNx+qnVy7c0VrDJ+CCVFS9srBo2GL9Y18CnIxBdTF3v38flrGy5s1YggcoAiu6s4fLQIw==", + "dev": true + }, + "node_modules/@types/d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-IIE6YTekGczpLYo/HehAy3JGF1ty7+usI97LqraNa8IiDur+L44d0VOjAvFQWJVdZOJHukUJw+ZdZBlgeUsHOQ==", + "dev": true + }, + "node_modules/@types/d3-scale": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.3.tgz", + "integrity": "sha512-PATBiMCpvHJSMtZAMEhc2WyL+hnzarKzI6wAHYjhsonjWJYGq5BXTzQjv4l8m2jO183/4wZ90rKvSeT7o72xNQ==", + "dev": true, + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-scale-chromatic": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.0.0.tgz", + "integrity": "sha512-dsoJGEIShosKVRBZB0Vo3C8nqSDqVGujJU6tPznsBJxNJNwMF8utmS83nvCBKQYPpjCzaaHcrf66iTRpZosLPw==", + "dev": true + }, + "node_modules/@types/d3-selection": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.5.tgz", + "integrity": "sha512-xCB0z3Hi8eFIqyja3vW8iV01+OHGYR2di/+e+AiOcXIOrY82lcvWW8Ke1DYE/EUVMsBl4Db9RppSBS3X1U6J0w==", + "dev": true + }, + "node_modules/@types/d3-shape": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.1.tgz", + "integrity": "sha512-6Uh86YFF7LGg4PQkuO2oG6EMBRLuW9cbavUW46zkIO5kuS2PfTqo2o9SkgtQzguBHbLgNnU90UNsITpsX1My+A==", + "dev": true, + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg==", + "dev": true + }, + "node_modules/@types/d3-time-format": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.0.tgz", + "integrity": "sha512-yjfBUe6DJBsDin2BMIulhSHmr5qNR5Pxs17+oW4DoVPyVIXZ+m6bs7j1UVKP08Emv6jRmYrYqxYzO63mQxy1rw==", + "dev": true + }, + "node_modules/@types/d3-timer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.0.tgz", + "integrity": "sha512-HNB/9GHqu7Fo8AQiugyJbv6ZxYz58wef0esl4Mv828w1ZKpAshw/uFWVDUcIB9KKFeFKoxS3cHY07FFgtTRZ1g==", + "dev": true + }, + "node_modules/@types/d3-transition": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.3.tgz", + "integrity": "sha512-/S90Od8Id1wgQNvIA8iFv9jRhCiZcGhPd2qX0bKF/PS+y0W5CrXKgIiELd2CvG1mlQrWK/qlYh3VxicqG1ZvgA==", + "dev": true, + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-zoom": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.3.tgz", + "integrity": "sha512-OWk1yYIIWcZ07+igN6BeoG6rqhnJ/pYe+R1qWFM2DtW49zsoSjgb9G5xB0ZXA8hh2jAzey1XuRmMSoXdKw8MDA==", + "dev": true, + "dependencies": { + "@types/d3-interpolate": "*", + "@types/d3-selection": "*" + } + }, "node_modules/@types/eslint": { "version": "8.44.2", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.2.tgz", @@ -4591,6 +4877,12 @@ "@types/send": "*" } }, + "node_modules/@types/geojson": { + "version": "7946.0.10", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz", + "integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==", + "dev": true + }, "node_modules/@types/http-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz", @@ -6609,6 +6901,203 @@ "integrity": "sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==", "dev": true }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-brush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", + "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "3", + "d3-transition": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz", + "integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==", + "dependencies": { + "d3-time": "1 - 2" + } + }, + "node_modules/d3-time-format/node_modules/d3-array": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz", + "integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==", + "dependencies": { + "internmap": "^1.0.0" + } + }, + "node_modules/d3-time-format/node_modules/d3-time": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.1.1.tgz", + "integrity": "sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ==", + "dependencies": { + "d3-array": "2" + } + }, + "node_modules/d3-time-format/node_modules/internmap": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz", + "integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==" + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "dependencies": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "d3-selection": "2 - 3" + } + }, "node_modules/data-urls": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", @@ -8491,6 +8980,14 @@ "node": ">=8" } }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "engines": { + "node": ">=12" + } + }, "node_modules/ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", @@ -11560,8 +12057,7 @@ "node_modules/rfdc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", - "dev": true + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" }, "node_modules/rimraf": { "version": "3.0.2", diff --git a/ui/reval-web/package.json b/ui/reval-web/package.json index 7790f82..edddc1a 100644 --- a/ui/reval-web/package.json +++ b/ui/reval-web/package.json @@ -25,6 +25,7 @@ "@angular/router": "^16.1.0", "@openapitools/openapi-generator-cli": "^2.7.0", "angular-auth-oidc-client": "16.0.0", + "@swimlane/ngx-charts": "^20.4.1", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.13.0" @@ -33,6 +34,7 @@ "@angular-devkit/build-angular": "^16.1.7", "@angular/cli": "~16.1.7", "@angular/compiler-cli": "^16.1.0", + "@types/d3": "^7.4.0", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.6.0", "karma": "~6.4.0", diff --git a/ui/reval-web/src/app/app-routing.module.ts b/ui/reval-web/src/app/app-routing.module.ts index 50d740e..6eff0f6 100644 --- a/ui/reval-web/src/app/app-routing.module.ts +++ b/ui/reval-web/src/app/app-routing.module.ts @@ -6,7 +6,7 @@ import { EvaluationComponent } from './evaluation/evaluation.component'; const routes: Routes = [ { path: '', component: EvaluationComponent }, - { path: 'about', component: ListComponent } + { path: 'list', component: ListComponent } ]; @NgModule({ diff --git a/ui/reval-web/src/app/app.module.ts b/ui/reval-web/src/app/app.module.ts index 14f69df..2336b7e 100644 --- a/ui/reval-web/src/app/app.module.ts +++ b/ui/reval-web/src/app/app.module.ts @@ -16,6 +16,8 @@ import { EvaluationComponent } from './evaluation/evaluation.component'; import { AuthConfigModule } from './auth/auth-config.module'; import { UserprofileComponent } from './userprofile/userprofile.component'; import { ListComponent } from './list/list.component'; +import { MatListModule } from '@angular/material/list'; +import { NgxChartsModule } from '@swimlane/ngx-charts'; @NgModule({ declarations: [ @@ -37,6 +39,8 @@ import { ListComponent } from './list/list.component'; MatGridListModule, MatBadgeModule, AuthConfigModule, + MatListModule, + NgxChartsModule, ], providers: [], bootstrap: [AppComponent] diff --git a/ui/reval-web/src/app/list/data.ts b/ui/reval-web/src/app/list/data.ts new file mode 100644 index 0000000..071ff28 --- /dev/null +++ b/ui/reval-web/src/app/list/data.ts @@ -0,0 +1,14 @@ +export var evaluations = [ + { + "name": "negative", + "value": 38 + }, + { + "name": "unanswered", + "value": 20 + }, + { + "name": "positive", + "value": 360 + } +]; \ No newline at end of file diff --git a/ui/reval-web/src/app/list/list.component.css b/ui/reval-web/src/app/list/list.component.css index e69de29..8280372 100644 --- a/ui/reval-web/src/app/list/list.component.css +++ b/ui/reval-web/src/app/list/list.component.css @@ -0,0 +1,19 @@ +.inline-list { + display: flex; + height: fit-content; +} + +.scenario-card { + width: 100%; + padding: 10px; + border: thin solid; + border-color:grey; +} + +mat-divider { + margin-bottom: 5px; +} + +mat-card-heaer { + padding: 5px; +} \ No newline at end of file diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html index 7c1fe15..144ad58 100644 --- a/ui/reval-web/src/app/list/list.component.html +++ b/ui/reval-web/src/app/list/list.component.html @@ -1 +1,28 @@ -

list works!

+ + + + + + Szenario {{i}} + + + +
+

LLM: {{i}}

+

Prompt ID: {{i}}

+ +
+
+
+
diff --git a/ui/reval-web/src/app/list/list.component.ts b/ui/reval-web/src/app/list/list.component.ts index a92a495..c0b0fba 100644 --- a/ui/reval-web/src/app/list/list.component.ts +++ b/ui/reval-web/src/app/list/list.component.ts @@ -1,4 +1,6 @@ import { Component } from '@angular/core'; +import { MatListModule } from '@angular/material/list'; +import { evaluations } from './data'; @Component({ selector: 'app-list', @@ -6,5 +8,34 @@ import { Component } from '@angular/core'; styleUrls: ['./list.component.css'] }) export class ListComponent { + evaluations: any[] | undefined; + view: [number, number] = [400, 400]; + gradient: boolean = false; + showLegend: boolean = false; + showLabels: boolean = true; + isDoughnut: boolean = true; + + customColors = + [ + { name: "negative", value: '#eb4034' }, + { name: "unanswered", value: '#fae714' }, + { name: "positive", value: '#19bf19'}, + ] + + constructor() { + Object.assign(this, { evaluations }); + } + + onSelect(data: any): void { + console.log('Item clicked', JSON.parse(JSON.stringify(data))); + } + + onActivate(data: any): void { + console.log('Activate', JSON.parse(JSON.stringify(data))); + } + + onDeactivate(data: any): void { + console.log('Deactivate', JSON.parse(JSON.stringify(data))); + } } From 275d47ff4fd3c3e6520235969554995e7cb4c07b Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 23 Aug 2023 11:11:09 +0200 Subject: [PATCH 09/31] First set of changes to connect the data to ui --- ui/reval-web/src/app/list/exampleRating.json | 39 +++++++++++++++++++ ui/reval-web/src/app/list/exampleRating.ts | 39 +++++++++++++++++++ ui/reval-web/src/app/list/list.component.html | 6 +-- ui/reval-web/src/app/list/list.component.ts | 5 ++- 4 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 ui/reval-web/src/app/list/exampleRating.json create mode 100644 ui/reval-web/src/app/list/exampleRating.ts diff --git a/ui/reval-web/src/app/list/exampleRating.json b/ui/reval-web/src/app/list/exampleRating.json new file mode 100644 index 0000000..06c5873 --- /dev/null +++ b/ui/reval-web/src/app/list/exampleRating.json @@ -0,0 +1,39 @@ +{ + "scenarios": [ + { + "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", + "name": "Szenario 1", + "desctiption": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", + "totalResponseCount": 400, + "progressStatistic": [ + { + "name": "rated", + "value": 70 + }, + { + "name": "unrated", + "value": 330 + } + ], + "resultStatistic": [ + { + "name": "positive", + "value": 12 + }, + { + "name": "negative", + "value": 46 + }, + { + "name": "neutral", + "value": 12 + } + ], + "ratingScore": { + "min": -1, + "value": 0.8, + "max": 1 + } + } + ] +} \ No newline at end of file diff --git a/ui/reval-web/src/app/list/exampleRating.ts b/ui/reval-web/src/app/list/exampleRating.ts new file mode 100644 index 0000000..72578f9 --- /dev/null +++ b/ui/reval-web/src/app/list/exampleRating.ts @@ -0,0 +1,39 @@ +export var ratings = { + "scenarios": [ + { + "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", + "name": "Szenario 1", + "desctiption": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", + "totalResponseCount": 400, + "progressStatistic": [ + { + "name": "rated", + "value": 70 + }, + { + "name": "unrated", + "value": 330 + } + ], + "resultStatistic": [ + { + "name": "positive", + "value": 12 + }, + { + "name": "negative", + "value": 46 + }, + { + "name": "neutral", + "value": 12 + } + ], + "ratingScore": { + "min": -1, + "value": 0.8, + "max": 1 + } + } + ] +} \ No newline at end of file diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html index 144ad58..a0a5dd1 100644 --- a/ui/reval-web/src/app/list/list.component.html +++ b/ui/reval-web/src/app/list/list.component.html @@ -1,5 +1,5 @@ - - + + @@ -13,7 +13,7 @@ Date: Wed, 23 Aug 2023 11:34:35 +0200 Subject: [PATCH 10/31] Change scenario visualization --- ui/reval-web/src/app/list/list.component.html | 7 +++---- ui/reval-web/src/app/list/list.component.ts | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html index a0a5dd1..d91c395 100644 --- a/ui/reval-web/src/app/list/list.component.html +++ b/ui/reval-web/src/app/list/list.component.html @@ -3,17 +3,16 @@ - Szenario {{i}} + Szenario {{rating.name}}
-

LLM: {{i}}

-

Prompt ID: {{i}}

+

LLM: {{rating.description}}

Date: Wed, 23 Aug 2023 11:35:31 +0200 Subject: [PATCH 11/31] Fix missing components error --- ui/reval-web/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/reval-web/package-lock.json b/ui/reval-web/package-lock.json index 7b8a132..6e9eae0 100644 --- a/ui/reval-web/package-lock.json +++ b/ui/reval-web/package-lock.json @@ -19,8 +19,8 @@ "@angular/platform-browser-dynamic": "^16.1.0", "@angular/router": "^16.1.0", "@openapitools/openapi-generator-cli": "^2.7.0", - "angular-auth-oidc-client": "16.0.0", "@swimlane/ngx-charts": "^20.4.1", + "angular-auth-oidc-client": "16.0.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.13.0" From cb1511e2bda408fe0c880f1faab51ab67b1ea849 Mon Sep 17 00:00:00 2001 From: Rico Herlt Date: Wed, 23 Aug 2023 11:44:00 +0200 Subject: [PATCH 12/31] - added new docker-compose file for hosting - updated oidc middleware to support unauthorized routes - updated redirect path of angular app --- cmd/reval/main.go | 4 ++-- docker-compose-reval.yaml | 7 +++++++ internal/oidc/ginmiddleware.go | 19 ++++++++++++++++++- .../src/app/auth/auth-config.module.ts | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 docker-compose-reval.yaml diff --git a/cmd/reval/main.go b/cmd/reval/main.go index 555748f..8bd0704 100644 --- a/cmd/reval/main.go +++ b/cmd/reval/main.go @@ -28,14 +28,14 @@ func main() { }) //register folder for static web deployment - r.Static("/ui/", config.Current.Gin_Web_Path) + r.Static(config.Current.Gin_Web_BaseUrl, config.Current.Gin_Web_Path) //setup CORS corsConfig := cors.DefaultConfig() corsConfig.AllowHeaders = append(corsConfig.AllowHeaders, config.Current.Gin_Cors_AdditionalAllowedHeaders...) corsConfig.AllowAllOrigins = config.Current.Gin_Cors_AllowAllOrigins r.Use(cors.New(corsConfig)) - r.Use(oidc.OidcAuthMiddleware(config.Current.Oidc_Authority, config.Current.Oidc_Audience)) + r.Use(oidc.OidcAuthMiddleware(config.Current.Oidc_Authority, config.Current.Oidc_Audience, config.Current.Gin_Api_BaseUrl)) //register HTTP handlers for evaluatio api si := new(controller.EvaluationApiServerInterface) diff --git a/docker-compose-reval.yaml b/docker-compose-reval.yaml new file mode 100644 index 0000000..8dcde6f --- /dev/null +++ b/docker-compose-reval.yaml @@ -0,0 +1,7 @@ +services: + reval: + image: ghcr.io/rherlt/reval:feature-fix-hosting + ports: + - "80:8080" + volumes: + - "./tmp/:/app/data/" #sqlite database path \ No newline at end of file diff --git a/internal/oidc/ginmiddleware.go b/internal/oidc/ginmiddleware.go index 4db921f..9956601 100644 --- a/internal/oidc/ginmiddleware.go +++ b/internal/oidc/ginmiddleware.go @@ -12,11 +12,14 @@ import ( var relyingParty rp.RelyingParty var userInfoCache map[string]*oidc.UserInfo +var authRoutes []string const OidcUserClaimsKey = "OidcUserClaims" const OidcUserIsAuthenticatedKey = "OidcUserIsAuthenticated" -func OidcAuthMiddleware(authority, audience string) gin.HandlerFunc { +func OidcAuthMiddleware(authority, audience string, routes ...string) gin.HandlerFunc { + + authRoutes = routes userInfoCache = map[string]*oidc.UserInfo{} _, err := rp.Discover(authority, http.DefaultClient) @@ -34,6 +37,20 @@ func OidcAuthMiddleware(authority, audience string) gin.HandlerFunc { c.Set(OidcUserIsAuthenticatedKey, false) c.Set(OidcUserClaimsKey, new(map[string]any)) + currentRoute := c.Request.URL.Path + shouldHandle := false + //check if path should be handled + for _, authRoute := range authRoutes { + if strings.HasPrefix(currentRoute, authRoute) { + shouldHandle = true + break + } + } + + if !shouldHandle { + return + } + ok, token := checkTokenType(c) if !ok { c.Set(OidcUserIsAuthenticatedKey, false) diff --git a/ui/reval-web/src/app/auth/auth-config.module.ts b/ui/reval-web/src/app/auth/auth-config.module.ts index 8445f23..11bb0b3 100644 --- a/ui/reval-web/src/app/auth/auth-config.module.ts +++ b/ui/reval-web/src/app/auth/auth-config.module.ts @@ -6,7 +6,7 @@ import { HTTP_INTERCEPTORS} from '@angular/common/http'; imports: [AuthModule.forRoot({ config: { authority: 'https://th-b.eu.auth0.com', - redirectUrl: window.location.origin, + redirectUrl: window.location.origin+'/ui/', postLogoutRedirectUri: window.location.origin, clientId: 'FNitzlm8QQkjmjDmMG1m2pgHyOATo1xo', scope: 'openid profile email offline_access', From 5d80f141e30b6c2bc9b4760852a191c8c519ad6f Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 23 Aug 2023 12:15:13 +0200 Subject: [PATCH 13/31] Change scenario cards to work with getscenarios --- ui/reval-web/src/app/list/exampleRating.json | 6 ++--- ui/reval-web/src/app/list/exampleRating.ts | 8 +++---- ui/reval-web/src/app/list/list.component.css | 3 ++- ui/reval-web/src/app/list/list.component.html | 22 +++++++++++++++---- ui/reval-web/src/app/list/list.component.ts | 15 +++++++++---- 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/ui/reval-web/src/app/list/exampleRating.json b/ui/reval-web/src/app/list/exampleRating.json index 06c5873..d17130f 100644 --- a/ui/reval-web/src/app/list/exampleRating.json +++ b/ui/reval-web/src/app/list/exampleRating.json @@ -2,10 +2,10 @@ "scenarios": [ { "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", - "name": "Szenario 1", - "desctiption": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", + "name": "Szenario Vicuna", + "description": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", "totalResponseCount": 400, - "progressStatistic": [ + "progressStatistics": [ { "name": "rated", "value": 70 diff --git a/ui/reval-web/src/app/list/exampleRating.ts b/ui/reval-web/src/app/list/exampleRating.ts index 72578f9..c9ea60c 100644 --- a/ui/reval-web/src/app/list/exampleRating.ts +++ b/ui/reval-web/src/app/list/exampleRating.ts @@ -2,10 +2,10 @@ export var ratings = { "scenarios": [ { "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", - "name": "Szenario 1", - "desctiption": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", + "name": "Llama 2 Szenario", + "description": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", "totalResponseCount": 400, - "progressStatistic": [ + "progressStatistics": [ { "name": "rated", "value": 70 @@ -15,7 +15,7 @@ export var ratings = { "value": 330 } ], - "resultStatistic": [ + "resultStatistics": [ { "name": "positive", "value": 12 diff --git a/ui/reval-web/src/app/list/list.component.css b/ui/reval-web/src/app/list/list.component.css index 8280372..96b6c43 100644 --- a/ui/reval-web/src/app/list/list.component.css +++ b/ui/reval-web/src/app/list/list.component.css @@ -5,6 +5,7 @@ .scenario-card { width: 100%; + max-width: 300px; padding: 10px; border: thin solid; border-color:grey; @@ -14,6 +15,6 @@ mat-divider { margin-bottom: 5px; } -mat-card-heaer { +mat-card-header { padding: 5px; } \ No newline at end of file diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html index d91c395..2c7b5ad 100644 --- a/ui/reval-web/src/app/list/list.component.html +++ b/ui/reval-web/src/app/list/list.component.html @@ -3,15 +3,16 @@ - Szenario {{rating.name}} + {{rating.name}}
-

LLM: {{rating.description}}

+

{{rating.description}}

+

Questions: {{rating.totalResponseCount}}

+ /> + + Rating Score: {{rating.ratingScore.value}}
diff --git a/ui/reval-web/src/app/list/list.component.ts b/ui/reval-web/src/app/list/list.component.ts index df3d886..b842410 100644 --- a/ui/reval-web/src/app/list/list.component.ts +++ b/ui/reval-web/src/app/list/list.component.ts @@ -1,6 +1,5 @@ import { Component } from '@angular/core'; import { MatListModule } from '@angular/material/list'; -import { evaluations } from './data'; import { ratings } from './exampleRating'; import { GetStatisticsResponse } from 'src/openapi-client/evaluationapi'; @@ -11,21 +10,29 @@ import { GetStatisticsResponse } from 'src/openapi-client/evaluationapi'; }) export class ListComponent { public ratings: GetStatisticsResponse | undefined; - view: [number, number] = [400, 400]; + view: [number, number] = [300, 250]; gradient: boolean = false; showLegend: boolean = false; showLabels: boolean = true; - isDoughnut: boolean = true; + isDoughnut: boolean = false; - customColors = + progressColors = [ { name: "rated", value: '#0099ff' }, { name: "unrated", value: '#c9c9c9' }, ] + + resultColors = + [ + { name: "positive", value: '#24a800' }, + { name: "negative", value: '#d61500' }, + { name: "neutral", value: '#fff700'} + ] constructor() { Object.assign(this, { ratings }); + console.log(ratings); } onSelect(data: any): void { From b4418bd3d0e80fd5204d3f84265775b267d4a466 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 23 Aug 2023 12:18:35 +0200 Subject: [PATCH 14/31] Fix minor issue --- ui/reval-web/src/app/list/list.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/list/list.component.html index 2c7b5ad..c4beb98 100644 --- a/ui/reval-web/src/app/list/list.component.html +++ b/ui/reval-web/src/app/list/list.component.html @@ -8,7 +8,7 @@
-

{{rating.description}}

+

{{rating.description}}

Questions: {{rating.totalResponseCount}}

Date: Wed, 23 Aug 2023 14:27:59 +0200 Subject: [PATCH 15/31] Improve visual demo --- ui/reval-web/src/app/list/exampleRating.ts | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ui/reval-web/src/app/list/exampleRating.ts b/ui/reval-web/src/app/list/exampleRating.ts index c9ea60c..e2f95ea 100644 --- a/ui/reval-web/src/app/list/exampleRating.ts +++ b/ui/reval-web/src/app/list/exampleRating.ts @@ -29,6 +29,41 @@ export var ratings = { "value": 12 } ], + "ratingScore": { + "min": -1, + "value": -0.5, + "max": 1 + } + }, + { + "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", + "name": "Vicuna Szenario", + "description": "Das ist das zweite tolle Szenario mit den Antworten aus Vicuna-33b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", + "totalResponseCount": 400, + "progressStatistics": [ + { + "name": "rated", + "value": 370 + }, + { + "name": "unrated", + "value": 30 + } + ], + "resultStatistics": [ + { + "name": "positive", + "value": 310 + }, + { + "name": "negative", + "value": 40 + }, + { + "name": "neutral", + "value": 20 + } + ], "ratingScore": { "min": -1, "value": 0.8, From bb7bbcb33a29ca1c7969367e01915ce1d78fa673 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 23 Aug 2023 14:49:48 +0200 Subject: [PATCH 16/31] Add backend request to statistics --- ui/reval-web/src/app/app.component.html | 4 ++-- ui/reval-web/src/app/list/list.component.ts | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ui/reval-web/src/app/app.component.html b/ui/reval-web/src/app/app.component.html index 4cbf6fc..d552a04 100644 --- a/ui/reval-web/src/app/app.component.html +++ b/ui/reval-web/src/app/app.component.html @@ -331,13 +331,13 @@ - + - + diff --git a/ui/reval-web/src/app/list/list.component.ts b/ui/reval-web/src/app/list/list.component.ts index b842410..816ecfd 100644 --- a/ui/reval-web/src/app/list/list.component.ts +++ b/ui/reval-web/src/app/list/list.component.ts @@ -1,7 +1,8 @@ import { Component } from '@angular/core'; import { MatListModule } from '@angular/material/list'; -import { ratings } from './exampleRating'; +//import { ratings } from './exampleRating'; import { GetStatisticsResponse } from 'src/openapi-client/evaluationapi'; +import { StatisticsService } from 'src/openapi-client/evaluationapi'; @Component({ selector: 'app-list', @@ -30,9 +31,15 @@ export class ListComponent { { name: "neutral", value: '#fff700'} ] - constructor() { - Object.assign(this, { ratings }); - console.log(ratings); + constructor(private readonly statisticService: StatisticsService) { + } + + ngOnInit() { + this.statisticService.getStatistics().subscribe(e => { + this.ratings = e + Object.assign(this, { e }); + }) + } onSelect(data: any): void { From 2e8b71593d7c26da886c64d25a7ab77f6c0065bd Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 23 Aug 2023 15:34:42 +0200 Subject: [PATCH 17/31] Add navigation buttons --- ui/reval-web/src/app/app.component.css | 16 ++++++++++++++++ ui/reval-web/src/app/app.component.html | 2 ++ 2 files changed, 18 insertions(+) diff --git a/ui/reval-web/src/app/app.component.css b/ui/reval-web/src/app/app.component.css index e69de29..c6d5e34 100644 --- a/ui/reval-web/src/app/app.component.css +++ b/ui/reval-web/src/app/app.component.css @@ -0,0 +1,16 @@ +.nav-item-link-edit { + background-color: #cc0a2f; + border: none; + color: white; + padding: 15px 32px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + transition-duration: 0.5s; +} + +.nav-item-link-edit:hover { + background-color: white; + color: black; +} \ No newline at end of file diff --git a/ui/reval-web/src/app/app.component.html b/ui/reval-web/src/app/app.component.html index d552a04..e285bbf 100644 --- a/ui/reval-web/src/app/app.component.html +++ b/ui/reval-web/src/app/app.component.html @@ -300,6 +300,8 @@ src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==" /> Welcome + +
From d5efe53ab708a9beebf1716abf7e46854f70370d Mon Sep 17 00:00:00 2001 From: Rico Herlt Date: Wed, 23 Aug 2023 17:18:23 +0200 Subject: [PATCH 18/31] WIP - changes needed to enable hosting --- build/reval/Dockerfile | 3 +- docker-compose-reval.yaml | 47 +++++++++++++++++-- internal/data/dataimporter.go | 2 +- internal/persistence/database.go | 1 + ui/reval-web/src/app/app.module.ts | 6 ++- .../src/app/auth/auth-config.module.ts | 4 +- 6 files changed, 55 insertions(+), 8 deletions(-) diff --git a/build/reval/Dockerfile b/build/reval/Dockerfile index 39b3db2..51c5f70 100644 --- a/build/reval/Dockerfile +++ b/build/reval/Dockerfile @@ -57,6 +57,7 @@ ENV GIN_MODE=release EXPOSE 8080 -USER nonroot:nonroot +# causes file permission issues under ubutu, but was working on windows an macos +# USER nonroot:nonroot ENTRYPOINT ["./reval"] diff --git a/docker-compose-reval.yaml b/docker-compose-reval.yaml index 8dcde6f..a51558c 100644 --- a/docker-compose-reval.yaml +++ b/docker-compose-reval.yaml @@ -1,7 +1,48 @@ services: reval: - image: ghcr.io/rherlt/reval:feature-fix-hosting + container_name: reval + image: local/reval:latest + depends_on: + - nginx-proxy + - nginx-proxy-acme + environment: + - OIDC_AUDIENCE=https://reval.th-b.com/api + - VIRTUAL_HOST=reval.th-b.com + - LETSENCRYPT_HOST=reval.th-b.com + - LETSENCRYPT_EMAIL=webmaster@th-b.com ports: - - "80:8080" + - "8080:8080" volumes: - - "./tmp/:/app/data/" #sqlite database path \ No newline at end of file + - "./tmp/:/app/data/" #sqlite database path + +# This services are required to run an NGINX reverse proxy that can isse let's encrypt certificates + nginx-proxy: + container_name: nginx-proxy + image: nginxproxy/nginx-proxy + ports: + - "80:80" + - "443:443" + volumes: + - "./tmp/hosting/certs:/etc/nginx/certs" + - "./tmp/hosting/vhost:/etc/nginx/vhost.d" + - "./tmp/hosting/html:/usr/share/nginx/html" + - "/var/run/docker.sock:/tmp/docker.sock:ro" + + nginx-proxy-acme: + container_name: nginx-proxy-acme + image: nginxproxy/acme-companion + depends_on: + - nginx-proxy + environment: + - DEFAULT_EMAIL=webmaster@th-b.com + - NGINX_PROXY_CONTAINER=nginx-proxy + volumes: + - "./tmp/hosting/certs:/etc/nginx/certs" + - "./tmp/hosting/vhost:/etc/nginx/vhost.d" + - "./tmp/hosting/html:/usr/share/nginx/html" + - "/var/run/docker.sock:/tmp/docker.sock:ro" + - "/var/run/docker.sock:/var/run/docker.sock:ro" + - "./tmp/hosting/acme:/etc/acme.sh" +volumes: + hosting: + external: true \ No newline at end of file diff --git a/internal/data/dataimporter.go b/internal/data/dataimporter.go index 0830d76..ad7e794 100644 --- a/internal/data/dataimporter.go +++ b/internal/data/dataimporter.go @@ -172,7 +172,7 @@ func mapEvaluationResult(str string) string { return string(evaluationapi.Negative) } - return string(evaluationapi.Neutral) + return string(evaluationapi.Negative) } func tryParseTime(str string) *time.Time { diff --git a/internal/persistence/database.go b/internal/persistence/database.go index 6ae9bac..e9e024a 100644 --- a/internal/persistence/database.go +++ b/internal/persistence/database.go @@ -82,6 +82,7 @@ func CloseClient() error { func setupSqlite() error { + log.Printf("setupSqlite: try to open database with connection: %s\n", config.Current.Db_Sqlite_Connection) client, err := ent.Open("sqlite3", config.Current.Db_Sqlite_Connection) if err != nil { log.Fatalf("failed opening connection to sqlite: %v", err) diff --git a/ui/reval-web/src/app/app.module.ts b/ui/reval-web/src/app/app.module.ts index a3e00cc..dcc04f5 100644 --- a/ui/reval-web/src/app/app.module.ts +++ b/ui/reval-web/src/app/app.module.ts @@ -15,6 +15,7 @@ import { MatBadgeModule } from '@angular/material/badge'; import { EvaluationComponent } from './evaluation/evaluation.component'; import { AuthConfigModule } from './auth/auth-config.module'; import { UserprofileComponent } from './userprofile/userprofile.component'; +import { Configuration } from 'src/openapi-client/evaluationapi'; @NgModule({ declarations: [ @@ -27,7 +28,10 @@ import { UserprofileComponent } from './userprofile/userprofile.component'; AppRoutingModule, BrowserAnimationsModule, HttpClientModule, - ApiModule, + ApiModule.forRoot(() => { + return new Configuration({ + basePath: 'https://reval.th-b.com/api', + })}), MatIconModule, MatDividerModule, MatButtonModule, diff --git a/ui/reval-web/src/app/auth/auth-config.module.ts b/ui/reval-web/src/app/auth/auth-config.module.ts index 11bb0b3..39c9199 100644 --- a/ui/reval-web/src/app/auth/auth-config.module.ts +++ b/ui/reval-web/src/app/auth/auth-config.module.ts @@ -14,9 +14,9 @@ import { HTTP_INTERCEPTORS} from '@angular/common/http'; silentRenew: true, useRefreshToken: true, renewTimeBeforeTokenExpiresInSeconds: 30, - secureRoutes: ['http://localhost:8080/api'], + secureRoutes: ['https://reval.th-b.com/api'], customParamsAuthRequest: { - audience: 'http://localhost:8080/api', + audience: 'https://reval.th-b.com/api', }, } })], From bc72093d65e95224798383bb865609547a329aef Mon Sep 17 00:00:00 2001 From: Rico Herlt Date: Thu, 24 Aug 2023 20:36:30 +0200 Subject: [PATCH 19/31] - updated api to support new scheme - updated data import - visually removed "neutral" button --- api/evaluationapi.yaml | 6 +- ent/migrate/schema.go | 3 +- ent/mutation.go | 151 +++++++++++---- ent/scenario.go | 27 ++- ent/scenario/scenario.go | 20 +- ent/scenario/where.go | 176 +++++++++++++----- ent/scenario_create.go | 150 +++++++++++---- ent/scenario_update.go | 104 ++++++++--- ent/schema/scenario.go | 3 +- internal/api/evaluationapi/server.gen.go | 69 +++---- internal/controller/evaluationapi.go | 2 +- internal/data/dataimporter.go | 160 ++++++++++------ internal/data/datatypes.go | 36 ++-- scripts/ent-gen.sh | 10 + scripts/openapi-gen.sh | 7 +- .../app/evaluation/evaluation.component.html | 2 +- .../api/responseEvaluation.service.ts | 2 +- .../evaluationapi/api/statistics.service.ts | 2 +- .../evaluationapi/model/errorInformation.ts | 2 +- .../evaluationapi/model/evaluations.ts | 2 +- .../model/getEvaluationResponse.ts | 2 +- .../model/getStatisticsResponse.ts | 2 +- .../evaluationapi/model/message.ts | 2 +- .../evaluationapi/model/nameValuePair.ts | 2 +- .../model/postEvaluationRequest.ts | 2 +- .../evaluationapi/model/ratingScore.ts | 2 +- .../evaluationapi/model/scenarioStatistics.ts | 6 +- 27 files changed, 667 insertions(+), 285 deletions(-) create mode 100755 scripts/ent-gen.sh diff --git a/api/evaluationapi.yaml b/api/evaluationapi.yaml index 9a610a4..f4c2f66 100755 --- a/api/evaluationapi.yaml +++ b/api/evaluationapi.yaml @@ -8,7 +8,7 @@ info: license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html - version: '0.2' + version: '0.3' servers: - url: '{protocol}://{environment}:{port}/api/' variables: @@ -225,6 +225,10 @@ components: type: string description: The description of the Scenario. example: 'Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json' + systemPrompt: + type: string + description: The used systemprompt for the scenario. + example: '....' totalResponseCount: type: integer format: int32 diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index 8c5da06..9f6e7d9 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -88,7 +88,8 @@ var ( {Name: "id", Type: field.TypeUUID}, {Name: "name", Type: field.TypeString}, {Name: "external_id", Type: field.TypeString, Nullable: true}, - {Name: "desctiption", Type: field.TypeString, Nullable: true}, + {Name: "description", Type: field.TypeString, Nullable: true}, + {Name: "systemprompt", Type: field.TypeString, Nullable: true}, {Name: "date", Type: field.TypeTime, Nullable: true}, } // ScenariosTable holds the schema information for the "scenarios" table. diff --git a/ent/mutation.go b/ent/mutation.go index c725ce9..ca44fd5 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -2421,7 +2421,8 @@ type ScenarioMutation struct { id *uuid.UUID name *string externalId *string - desctiption *string + description *string + systemprompt *string date *time.Time clearedFields map[string]struct{} responses map[uuid.UUID]struct{} @@ -2621,53 +2622,102 @@ func (m *ScenarioMutation) ResetExternalId() { delete(m.clearedFields, scenario.FieldExternalId) } -// SetDesctiption sets the "desctiption" field. -func (m *ScenarioMutation) SetDesctiption(s string) { - m.desctiption = &s +// SetDescription sets the "description" field. +func (m *ScenarioMutation) SetDescription(s string) { + m.description = &s } -// Desctiption returns the value of the "desctiption" field in the mutation. -func (m *ScenarioMutation) Desctiption() (r string, exists bool) { - v := m.desctiption +// Description returns the value of the "description" field in the mutation. +func (m *ScenarioMutation) Description() (r string, exists bool) { + v := m.description if v == nil { return } return *v, true } -// OldDesctiption returns the old "desctiption" field's value of the Scenario entity. +// OldDescription returns the old "description" field's value of the Scenario entity. // If the Scenario object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *ScenarioMutation) OldDesctiption(ctx context.Context) (v string, err error) { +func (m *ScenarioMutation) OldDescription(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldDesctiption is only allowed on UpdateOne operations") + return v, errors.New("OldDescription is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldDesctiption requires an ID field in the mutation") + return v, errors.New("OldDescription requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldDesctiption: %w", err) + return v, fmt.Errorf("querying old value for OldDescription: %w", err) } - return oldValue.Desctiption, nil + return oldValue.Description, nil } -// ClearDesctiption clears the value of the "desctiption" field. -func (m *ScenarioMutation) ClearDesctiption() { - m.desctiption = nil - m.clearedFields[scenario.FieldDesctiption] = struct{}{} +// ClearDescription clears the value of the "description" field. +func (m *ScenarioMutation) ClearDescription() { + m.description = nil + m.clearedFields[scenario.FieldDescription] = struct{}{} } -// DesctiptionCleared returns if the "desctiption" field was cleared in this mutation. -func (m *ScenarioMutation) DesctiptionCleared() bool { - _, ok := m.clearedFields[scenario.FieldDesctiption] +// DescriptionCleared returns if the "description" field was cleared in this mutation. +func (m *ScenarioMutation) DescriptionCleared() bool { + _, ok := m.clearedFields[scenario.FieldDescription] return ok } -// ResetDesctiption resets all changes to the "desctiption" field. -func (m *ScenarioMutation) ResetDesctiption() { - m.desctiption = nil - delete(m.clearedFields, scenario.FieldDesctiption) +// ResetDescription resets all changes to the "description" field. +func (m *ScenarioMutation) ResetDescription() { + m.description = nil + delete(m.clearedFields, scenario.FieldDescription) +} + +// SetSystemprompt sets the "systemprompt" field. +func (m *ScenarioMutation) SetSystemprompt(s string) { + m.systemprompt = &s +} + +// Systemprompt returns the value of the "systemprompt" field in the mutation. +func (m *ScenarioMutation) Systemprompt() (r string, exists bool) { + v := m.systemprompt + if v == nil { + return + } + return *v, true +} + +// OldSystemprompt returns the old "systemprompt" field's value of the Scenario entity. +// If the Scenario object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *ScenarioMutation) OldSystemprompt(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldSystemprompt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldSystemprompt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldSystemprompt: %w", err) + } + return oldValue.Systemprompt, nil +} + +// ClearSystemprompt clears the value of the "systemprompt" field. +func (m *ScenarioMutation) ClearSystemprompt() { + m.systemprompt = nil + m.clearedFields[scenario.FieldSystemprompt] = struct{}{} +} + +// SystempromptCleared returns if the "systemprompt" field was cleared in this mutation. +func (m *ScenarioMutation) SystempromptCleared() bool { + _, ok := m.clearedFields[scenario.FieldSystemprompt] + return ok +} + +// ResetSystemprompt resets all changes to the "systemprompt" field. +func (m *ScenarioMutation) ResetSystemprompt() { + m.systemprompt = nil + delete(m.clearedFields, scenario.FieldSystemprompt) } // SetDate sets the "date" field. @@ -2807,15 +2857,18 @@ func (m *ScenarioMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *ScenarioMutation) Fields() []string { - fields := make([]string, 0, 4) + fields := make([]string, 0, 5) if m.name != nil { fields = append(fields, scenario.FieldName) } if m.externalId != nil { fields = append(fields, scenario.FieldExternalId) } - if m.desctiption != nil { - fields = append(fields, scenario.FieldDesctiption) + if m.description != nil { + fields = append(fields, scenario.FieldDescription) + } + if m.systemprompt != nil { + fields = append(fields, scenario.FieldSystemprompt) } if m.date != nil { fields = append(fields, scenario.FieldDate) @@ -2832,8 +2885,10 @@ func (m *ScenarioMutation) Field(name string) (ent.Value, bool) { return m.Name() case scenario.FieldExternalId: return m.ExternalId() - case scenario.FieldDesctiption: - return m.Desctiption() + case scenario.FieldDescription: + return m.Description() + case scenario.FieldSystemprompt: + return m.Systemprompt() case scenario.FieldDate: return m.Date() } @@ -2849,8 +2904,10 @@ func (m *ScenarioMutation) OldField(ctx context.Context, name string) (ent.Value return m.OldName(ctx) case scenario.FieldExternalId: return m.OldExternalId(ctx) - case scenario.FieldDesctiption: - return m.OldDesctiption(ctx) + case scenario.FieldDescription: + return m.OldDescription(ctx) + case scenario.FieldSystemprompt: + return m.OldSystemprompt(ctx) case scenario.FieldDate: return m.OldDate(ctx) } @@ -2876,12 +2933,19 @@ func (m *ScenarioMutation) SetField(name string, value ent.Value) error { } m.SetExternalId(v) return nil - case scenario.FieldDesctiption: + case scenario.FieldDescription: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetDesctiption(v) + m.SetDescription(v) + return nil + case scenario.FieldSystemprompt: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSystemprompt(v) return nil case scenario.FieldDate: v, ok := value.(time.Time) @@ -2923,8 +2987,11 @@ func (m *ScenarioMutation) ClearedFields() []string { if m.FieldCleared(scenario.FieldExternalId) { fields = append(fields, scenario.FieldExternalId) } - if m.FieldCleared(scenario.FieldDesctiption) { - fields = append(fields, scenario.FieldDesctiption) + if m.FieldCleared(scenario.FieldDescription) { + fields = append(fields, scenario.FieldDescription) + } + if m.FieldCleared(scenario.FieldSystemprompt) { + fields = append(fields, scenario.FieldSystemprompt) } if m.FieldCleared(scenario.FieldDate) { fields = append(fields, scenario.FieldDate) @@ -2946,8 +3013,11 @@ func (m *ScenarioMutation) ClearField(name string) error { case scenario.FieldExternalId: m.ClearExternalId() return nil - case scenario.FieldDesctiption: - m.ClearDesctiption() + case scenario.FieldDescription: + m.ClearDescription() + return nil + case scenario.FieldSystemprompt: + m.ClearSystemprompt() return nil case scenario.FieldDate: m.ClearDate() @@ -2966,8 +3036,11 @@ func (m *ScenarioMutation) ResetField(name string) error { case scenario.FieldExternalId: m.ResetExternalId() return nil - case scenario.FieldDesctiption: - m.ResetDesctiption() + case scenario.FieldDescription: + m.ResetDescription() + return nil + case scenario.FieldSystemprompt: + m.ResetSystemprompt() return nil case scenario.FieldDate: m.ResetDate() diff --git a/ent/scenario.go b/ent/scenario.go index 12a70e9..83aaf6f 100644 --- a/ent/scenario.go +++ b/ent/scenario.go @@ -22,8 +22,10 @@ type Scenario struct { Name string `json:"name,omitempty"` // ExternalId holds the value of the "externalId" field. ExternalId string `json:"externalId,omitempty"` - // Desctiption holds the value of the "desctiption" field. - Desctiption string `json:"desctiption,omitempty"` + // Description holds the value of the "description" field. + Description string `json:"description,omitempty"` + // Systemprompt holds the value of the "systemprompt" field. + Systemprompt string `json:"systemprompt,omitempty"` // Date holds the value of the "date" field. Date time.Time `json:"date,omitempty"` // Edges holds the relations/edges for other nodes in the graph. @@ -55,7 +57,7 @@ func (*Scenario) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { - case scenario.FieldName, scenario.FieldExternalId, scenario.FieldDesctiption: + case scenario.FieldName, scenario.FieldExternalId, scenario.FieldDescription, scenario.FieldSystemprompt: values[i] = new(sql.NullString) case scenario.FieldDate: values[i] = new(sql.NullTime) @@ -94,11 +96,17 @@ func (s *Scenario) assignValues(columns []string, values []any) error { } else if value.Valid { s.ExternalId = value.String } - case scenario.FieldDesctiption: + case scenario.FieldDescription: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field desctiption", values[i]) + return fmt.Errorf("unexpected type %T for field description", values[i]) } else if value.Valid { - s.Desctiption = value.String + s.Description = value.String + } + case scenario.FieldSystemprompt: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field systemprompt", values[i]) + } else if value.Valid { + s.Systemprompt = value.String } case scenario.FieldDate: if value, ok := values[i].(*sql.NullTime); !ok { @@ -153,8 +161,11 @@ func (s *Scenario) String() string { builder.WriteString("externalId=") builder.WriteString(s.ExternalId) builder.WriteString(", ") - builder.WriteString("desctiption=") - builder.WriteString(s.Desctiption) + builder.WriteString("description=") + builder.WriteString(s.Description) + builder.WriteString(", ") + builder.WriteString("systemprompt=") + builder.WriteString(s.Systemprompt) builder.WriteString(", ") builder.WriteString("date=") builder.WriteString(s.Date.Format(time.ANSIC)) diff --git a/ent/scenario/scenario.go b/ent/scenario/scenario.go index 1fa0ba1..041b51a 100644 --- a/ent/scenario/scenario.go +++ b/ent/scenario/scenario.go @@ -17,8 +17,10 @@ const ( FieldName = "name" // FieldExternalId holds the string denoting the externalid field in the database. FieldExternalId = "external_id" - // FieldDesctiption holds the string denoting the desctiption field in the database. - FieldDesctiption = "desctiption" + // FieldDescription holds the string denoting the description field in the database. + FieldDescription = "description" + // FieldSystemprompt holds the string denoting the systemprompt field in the database. + FieldSystemprompt = "systemprompt" // FieldDate holds the string denoting the date field in the database. FieldDate = "date" // EdgeResponses holds the string denoting the responses edge name in mutations. @@ -39,7 +41,8 @@ var Columns = []string{ FieldID, FieldName, FieldExternalId, - FieldDesctiption, + FieldDescription, + FieldSystemprompt, FieldDate, } @@ -76,9 +79,14 @@ func ByExternalId(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldExternalId, opts...).ToFunc() } -// ByDesctiption orders the results by the desctiption field. -func ByDesctiption(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldDesctiption, opts...).ToFunc() +// ByDescription orders the results by the description field. +func ByDescription(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldDescription, opts...).ToFunc() +} + +// BySystemprompt orders the results by the systemprompt field. +func BySystemprompt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSystemprompt, opts...).ToFunc() } // ByDate orders the results by the date field. diff --git a/ent/scenario/where.go b/ent/scenario/where.go index a1d5d17..baa1753 100644 --- a/ent/scenario/where.go +++ b/ent/scenario/where.go @@ -66,9 +66,14 @@ func ExternalId(v string) predicate.Scenario { return predicate.Scenario(sql.FieldEQ(FieldExternalId, v)) } -// Desctiption applies equality check predicate on the "desctiption" field. It's identical to DesctiptionEQ. -func Desctiption(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldEQ(FieldDesctiption, v)) +// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ. +func Description(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldEQ(FieldDescription, v)) +} + +// Systemprompt applies equality check predicate on the "systemprompt" field. It's identical to SystempromptEQ. +func Systemprompt(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldEQ(FieldSystemprompt, v)) } // Date applies equality check predicate on the "date" field. It's identical to DateEQ. @@ -216,79 +221,154 @@ func ExternalIdContainsFold(v string) predicate.Scenario { return predicate.Scenario(sql.FieldContainsFold(FieldExternalId, v)) } -// DesctiptionEQ applies the EQ predicate on the "desctiption" field. -func DesctiptionEQ(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldEQ(FieldDesctiption, v)) +// DescriptionEQ applies the EQ predicate on the "description" field. +func DescriptionEQ(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldEQ(FieldDescription, v)) +} + +// DescriptionNEQ applies the NEQ predicate on the "description" field. +func DescriptionNEQ(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldNEQ(FieldDescription, v)) +} + +// DescriptionIn applies the In predicate on the "description" field. +func DescriptionIn(vs ...string) predicate.Scenario { + return predicate.Scenario(sql.FieldIn(FieldDescription, vs...)) +} + +// DescriptionNotIn applies the NotIn predicate on the "description" field. +func DescriptionNotIn(vs ...string) predicate.Scenario { + return predicate.Scenario(sql.FieldNotIn(FieldDescription, vs...)) +} + +// DescriptionGT applies the GT predicate on the "description" field. +func DescriptionGT(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldGT(FieldDescription, v)) +} + +// DescriptionGTE applies the GTE predicate on the "description" field. +func DescriptionGTE(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldGTE(FieldDescription, v)) +} + +// DescriptionLT applies the LT predicate on the "description" field. +func DescriptionLT(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldLT(FieldDescription, v)) +} + +// DescriptionLTE applies the LTE predicate on the "description" field. +func DescriptionLTE(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldLTE(FieldDescription, v)) +} + +// DescriptionContains applies the Contains predicate on the "description" field. +func DescriptionContains(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldContains(FieldDescription, v)) +} + +// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field. +func DescriptionHasPrefix(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldHasPrefix(FieldDescription, v)) +} + +// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field. +func DescriptionHasSuffix(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldHasSuffix(FieldDescription, v)) +} + +// DescriptionIsNil applies the IsNil predicate on the "description" field. +func DescriptionIsNil() predicate.Scenario { + return predicate.Scenario(sql.FieldIsNull(FieldDescription)) +} + +// DescriptionNotNil applies the NotNil predicate on the "description" field. +func DescriptionNotNil() predicate.Scenario { + return predicate.Scenario(sql.FieldNotNull(FieldDescription)) +} + +// DescriptionEqualFold applies the EqualFold predicate on the "description" field. +func DescriptionEqualFold(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldEqualFold(FieldDescription, v)) +} + +// DescriptionContainsFold applies the ContainsFold predicate on the "description" field. +func DescriptionContainsFold(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldContainsFold(FieldDescription, v)) +} + +// SystempromptEQ applies the EQ predicate on the "systemprompt" field. +func SystempromptEQ(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldEQ(FieldSystemprompt, v)) } -// DesctiptionNEQ applies the NEQ predicate on the "desctiption" field. -func DesctiptionNEQ(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldNEQ(FieldDesctiption, v)) +// SystempromptNEQ applies the NEQ predicate on the "systemprompt" field. +func SystempromptNEQ(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldNEQ(FieldSystemprompt, v)) } -// DesctiptionIn applies the In predicate on the "desctiption" field. -func DesctiptionIn(vs ...string) predicate.Scenario { - return predicate.Scenario(sql.FieldIn(FieldDesctiption, vs...)) +// SystempromptIn applies the In predicate on the "systemprompt" field. +func SystempromptIn(vs ...string) predicate.Scenario { + return predicate.Scenario(sql.FieldIn(FieldSystemprompt, vs...)) } -// DesctiptionNotIn applies the NotIn predicate on the "desctiption" field. -func DesctiptionNotIn(vs ...string) predicate.Scenario { - return predicate.Scenario(sql.FieldNotIn(FieldDesctiption, vs...)) +// SystempromptNotIn applies the NotIn predicate on the "systemprompt" field. +func SystempromptNotIn(vs ...string) predicate.Scenario { + return predicate.Scenario(sql.FieldNotIn(FieldSystemprompt, vs...)) } -// DesctiptionGT applies the GT predicate on the "desctiption" field. -func DesctiptionGT(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldGT(FieldDesctiption, v)) +// SystempromptGT applies the GT predicate on the "systemprompt" field. +func SystempromptGT(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldGT(FieldSystemprompt, v)) } -// DesctiptionGTE applies the GTE predicate on the "desctiption" field. -func DesctiptionGTE(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldGTE(FieldDesctiption, v)) +// SystempromptGTE applies the GTE predicate on the "systemprompt" field. +func SystempromptGTE(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldGTE(FieldSystemprompt, v)) } -// DesctiptionLT applies the LT predicate on the "desctiption" field. -func DesctiptionLT(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldLT(FieldDesctiption, v)) +// SystempromptLT applies the LT predicate on the "systemprompt" field. +func SystempromptLT(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldLT(FieldSystemprompt, v)) } -// DesctiptionLTE applies the LTE predicate on the "desctiption" field. -func DesctiptionLTE(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldLTE(FieldDesctiption, v)) +// SystempromptLTE applies the LTE predicate on the "systemprompt" field. +func SystempromptLTE(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldLTE(FieldSystemprompt, v)) } -// DesctiptionContains applies the Contains predicate on the "desctiption" field. -func DesctiptionContains(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldContains(FieldDesctiption, v)) +// SystempromptContains applies the Contains predicate on the "systemprompt" field. +func SystempromptContains(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldContains(FieldSystemprompt, v)) } -// DesctiptionHasPrefix applies the HasPrefix predicate on the "desctiption" field. -func DesctiptionHasPrefix(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldHasPrefix(FieldDesctiption, v)) +// SystempromptHasPrefix applies the HasPrefix predicate on the "systemprompt" field. +func SystempromptHasPrefix(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldHasPrefix(FieldSystemprompt, v)) } -// DesctiptionHasSuffix applies the HasSuffix predicate on the "desctiption" field. -func DesctiptionHasSuffix(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldHasSuffix(FieldDesctiption, v)) +// SystempromptHasSuffix applies the HasSuffix predicate on the "systemprompt" field. +func SystempromptHasSuffix(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldHasSuffix(FieldSystemprompt, v)) } -// DesctiptionIsNil applies the IsNil predicate on the "desctiption" field. -func DesctiptionIsNil() predicate.Scenario { - return predicate.Scenario(sql.FieldIsNull(FieldDesctiption)) +// SystempromptIsNil applies the IsNil predicate on the "systemprompt" field. +func SystempromptIsNil() predicate.Scenario { + return predicate.Scenario(sql.FieldIsNull(FieldSystemprompt)) } -// DesctiptionNotNil applies the NotNil predicate on the "desctiption" field. -func DesctiptionNotNil() predicate.Scenario { - return predicate.Scenario(sql.FieldNotNull(FieldDesctiption)) +// SystempromptNotNil applies the NotNil predicate on the "systemprompt" field. +func SystempromptNotNil() predicate.Scenario { + return predicate.Scenario(sql.FieldNotNull(FieldSystemprompt)) } -// DesctiptionEqualFold applies the EqualFold predicate on the "desctiption" field. -func DesctiptionEqualFold(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldEqualFold(FieldDesctiption, v)) +// SystempromptEqualFold applies the EqualFold predicate on the "systemprompt" field. +func SystempromptEqualFold(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldEqualFold(FieldSystemprompt, v)) } -// DesctiptionContainsFold applies the ContainsFold predicate on the "desctiption" field. -func DesctiptionContainsFold(v string) predicate.Scenario { - return predicate.Scenario(sql.FieldContainsFold(FieldDesctiption, v)) +// SystempromptContainsFold applies the ContainsFold predicate on the "systemprompt" field. +func SystempromptContainsFold(v string) predicate.Scenario { + return predicate.Scenario(sql.FieldContainsFold(FieldSystemprompt, v)) } // DateEQ applies the EQ predicate on the "date" field. diff --git a/ent/scenario_create.go b/ent/scenario_create.go index 57b63ab..ba36740 100644 --- a/ent/scenario_create.go +++ b/ent/scenario_create.go @@ -45,16 +45,30 @@ func (sc *ScenarioCreate) SetNillableExternalId(s *string) *ScenarioCreate { return sc } -// SetDesctiption sets the "desctiption" field. -func (sc *ScenarioCreate) SetDesctiption(s string) *ScenarioCreate { - sc.mutation.SetDesctiption(s) +// SetDescription sets the "description" field. +func (sc *ScenarioCreate) SetDescription(s string) *ScenarioCreate { + sc.mutation.SetDescription(s) return sc } -// SetNillableDesctiption sets the "desctiption" field if the given value is not nil. -func (sc *ScenarioCreate) SetNillableDesctiption(s *string) *ScenarioCreate { +// SetNillableDescription sets the "description" field if the given value is not nil. +func (sc *ScenarioCreate) SetNillableDescription(s *string) *ScenarioCreate { if s != nil { - sc.SetDesctiption(*s) + sc.SetDescription(*s) + } + return sc +} + +// SetSystemprompt sets the "systemprompt" field. +func (sc *ScenarioCreate) SetSystemprompt(s string) *ScenarioCreate { + sc.mutation.SetSystemprompt(s) + return sc +} + +// SetNillableSystemprompt sets the "systemprompt" field if the given value is not nil. +func (sc *ScenarioCreate) SetNillableSystemprompt(s *string) *ScenarioCreate { + if s != nil { + sc.SetSystemprompt(*s) } return sc } @@ -192,9 +206,13 @@ func (sc *ScenarioCreate) createSpec() (*Scenario, *sqlgraph.CreateSpec) { _spec.SetField(scenario.FieldExternalId, field.TypeString, value) _node.ExternalId = value } - if value, ok := sc.mutation.Desctiption(); ok { - _spec.SetField(scenario.FieldDesctiption, field.TypeString, value) - _node.Desctiption = value + if value, ok := sc.mutation.Description(); ok { + _spec.SetField(scenario.FieldDescription, field.TypeString, value) + _node.Description = value + } + if value, ok := sc.mutation.Systemprompt(); ok { + _spec.SetField(scenario.FieldSystemprompt, field.TypeString, value) + _node.Systemprompt = value } if value, ok := sc.mutation.Date(); ok { _spec.SetField(scenario.FieldDate, field.TypeTime, value) @@ -298,21 +316,39 @@ func (u *ScenarioUpsert) ClearExternalId() *ScenarioUpsert { return u } -// SetDesctiption sets the "desctiption" field. -func (u *ScenarioUpsert) SetDesctiption(v string) *ScenarioUpsert { - u.Set(scenario.FieldDesctiption, v) +// SetDescription sets the "description" field. +func (u *ScenarioUpsert) SetDescription(v string) *ScenarioUpsert { + u.Set(scenario.FieldDescription, v) return u } -// UpdateDesctiption sets the "desctiption" field to the value that was provided on create. -func (u *ScenarioUpsert) UpdateDesctiption() *ScenarioUpsert { - u.SetExcluded(scenario.FieldDesctiption) +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *ScenarioUpsert) UpdateDescription() *ScenarioUpsert { + u.SetExcluded(scenario.FieldDescription) return u } -// ClearDesctiption clears the value of the "desctiption" field. -func (u *ScenarioUpsert) ClearDesctiption() *ScenarioUpsert { - u.SetNull(scenario.FieldDesctiption) +// ClearDescription clears the value of the "description" field. +func (u *ScenarioUpsert) ClearDescription() *ScenarioUpsert { + u.SetNull(scenario.FieldDescription) + return u +} + +// SetSystemprompt sets the "systemprompt" field. +func (u *ScenarioUpsert) SetSystemprompt(v string) *ScenarioUpsert { + u.Set(scenario.FieldSystemprompt, v) + return u +} + +// UpdateSystemprompt sets the "systemprompt" field to the value that was provided on create. +func (u *ScenarioUpsert) UpdateSystemprompt() *ScenarioUpsert { + u.SetExcluded(scenario.FieldSystemprompt) + return u +} + +// ClearSystemprompt clears the value of the "systemprompt" field. +func (u *ScenarioUpsert) ClearSystemprompt() *ScenarioUpsert { + u.SetNull(scenario.FieldSystemprompt) return u } @@ -417,24 +453,45 @@ func (u *ScenarioUpsertOne) ClearExternalId() *ScenarioUpsertOne { }) } -// SetDesctiption sets the "desctiption" field. -func (u *ScenarioUpsertOne) SetDesctiption(v string) *ScenarioUpsertOne { +// SetDescription sets the "description" field. +func (u *ScenarioUpsertOne) SetDescription(v string) *ScenarioUpsertOne { + return u.Update(func(s *ScenarioUpsert) { + s.SetDescription(v) + }) +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *ScenarioUpsertOne) UpdateDescription() *ScenarioUpsertOne { + return u.Update(func(s *ScenarioUpsert) { + s.UpdateDescription() + }) +} + +// ClearDescription clears the value of the "description" field. +func (u *ScenarioUpsertOne) ClearDescription() *ScenarioUpsertOne { return u.Update(func(s *ScenarioUpsert) { - s.SetDesctiption(v) + s.ClearDescription() }) } -// UpdateDesctiption sets the "desctiption" field to the value that was provided on create. -func (u *ScenarioUpsertOne) UpdateDesctiption() *ScenarioUpsertOne { +// SetSystemprompt sets the "systemprompt" field. +func (u *ScenarioUpsertOne) SetSystemprompt(v string) *ScenarioUpsertOne { return u.Update(func(s *ScenarioUpsert) { - s.UpdateDesctiption() + s.SetSystemprompt(v) }) } -// ClearDesctiption clears the value of the "desctiption" field. -func (u *ScenarioUpsertOne) ClearDesctiption() *ScenarioUpsertOne { +// UpdateSystemprompt sets the "systemprompt" field to the value that was provided on create. +func (u *ScenarioUpsertOne) UpdateSystemprompt() *ScenarioUpsertOne { return u.Update(func(s *ScenarioUpsert) { - s.ClearDesctiption() + s.UpdateSystemprompt() + }) +} + +// ClearSystemprompt clears the value of the "systemprompt" field. +func (u *ScenarioUpsertOne) ClearSystemprompt() *ScenarioUpsertOne { + return u.Update(func(s *ScenarioUpsert) { + s.ClearSystemprompt() }) } @@ -705,24 +762,45 @@ func (u *ScenarioUpsertBulk) ClearExternalId() *ScenarioUpsertBulk { }) } -// SetDesctiption sets the "desctiption" field. -func (u *ScenarioUpsertBulk) SetDesctiption(v string) *ScenarioUpsertBulk { +// SetDescription sets the "description" field. +func (u *ScenarioUpsertBulk) SetDescription(v string) *ScenarioUpsertBulk { + return u.Update(func(s *ScenarioUpsert) { + s.SetDescription(v) + }) +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *ScenarioUpsertBulk) UpdateDescription() *ScenarioUpsertBulk { + return u.Update(func(s *ScenarioUpsert) { + s.UpdateDescription() + }) +} + +// ClearDescription clears the value of the "description" field. +func (u *ScenarioUpsertBulk) ClearDescription() *ScenarioUpsertBulk { + return u.Update(func(s *ScenarioUpsert) { + s.ClearDescription() + }) +} + +// SetSystemprompt sets the "systemprompt" field. +func (u *ScenarioUpsertBulk) SetSystemprompt(v string) *ScenarioUpsertBulk { return u.Update(func(s *ScenarioUpsert) { - s.SetDesctiption(v) + s.SetSystemprompt(v) }) } -// UpdateDesctiption sets the "desctiption" field to the value that was provided on create. -func (u *ScenarioUpsertBulk) UpdateDesctiption() *ScenarioUpsertBulk { +// UpdateSystemprompt sets the "systemprompt" field to the value that was provided on create. +func (u *ScenarioUpsertBulk) UpdateSystemprompt() *ScenarioUpsertBulk { return u.Update(func(s *ScenarioUpsert) { - s.UpdateDesctiption() + s.UpdateSystemprompt() }) } -// ClearDesctiption clears the value of the "desctiption" field. -func (u *ScenarioUpsertBulk) ClearDesctiption() *ScenarioUpsertBulk { +// ClearSystemprompt clears the value of the "systemprompt" field. +func (u *ScenarioUpsertBulk) ClearSystemprompt() *ScenarioUpsertBulk { return u.Update(func(s *ScenarioUpsert) { - s.ClearDesctiption() + s.ClearSystemprompt() }) } diff --git a/ent/scenario_update.go b/ent/scenario_update.go index 82e167c..7eaad71 100644 --- a/ent/scenario_update.go +++ b/ent/scenario_update.go @@ -56,23 +56,43 @@ func (su *ScenarioUpdate) ClearExternalId() *ScenarioUpdate { return su } -// SetDesctiption sets the "desctiption" field. -func (su *ScenarioUpdate) SetDesctiption(s string) *ScenarioUpdate { - su.mutation.SetDesctiption(s) +// SetDescription sets the "description" field. +func (su *ScenarioUpdate) SetDescription(s string) *ScenarioUpdate { + su.mutation.SetDescription(s) return su } -// SetNillableDesctiption sets the "desctiption" field if the given value is not nil. -func (su *ScenarioUpdate) SetNillableDesctiption(s *string) *ScenarioUpdate { +// SetNillableDescription sets the "description" field if the given value is not nil. +func (su *ScenarioUpdate) SetNillableDescription(s *string) *ScenarioUpdate { if s != nil { - su.SetDesctiption(*s) + su.SetDescription(*s) } return su } -// ClearDesctiption clears the value of the "desctiption" field. -func (su *ScenarioUpdate) ClearDesctiption() *ScenarioUpdate { - su.mutation.ClearDesctiption() +// ClearDescription clears the value of the "description" field. +func (su *ScenarioUpdate) ClearDescription() *ScenarioUpdate { + su.mutation.ClearDescription() + return su +} + +// SetSystemprompt sets the "systemprompt" field. +func (su *ScenarioUpdate) SetSystemprompt(s string) *ScenarioUpdate { + su.mutation.SetSystemprompt(s) + return su +} + +// SetNillableSystemprompt sets the "systemprompt" field if the given value is not nil. +func (su *ScenarioUpdate) SetNillableSystemprompt(s *string) *ScenarioUpdate { + if s != nil { + su.SetSystemprompt(*s) + } + return su +} + +// ClearSystemprompt clears the value of the "systemprompt" field. +func (su *ScenarioUpdate) ClearSystemprompt() *ScenarioUpdate { + su.mutation.ClearSystemprompt() return su } @@ -182,11 +202,17 @@ func (su *ScenarioUpdate) sqlSave(ctx context.Context) (n int, err error) { if su.mutation.ExternalIdCleared() { _spec.ClearField(scenario.FieldExternalId, field.TypeString) } - if value, ok := su.mutation.Desctiption(); ok { - _spec.SetField(scenario.FieldDesctiption, field.TypeString, value) + if value, ok := su.mutation.Description(); ok { + _spec.SetField(scenario.FieldDescription, field.TypeString, value) + } + if su.mutation.DescriptionCleared() { + _spec.ClearField(scenario.FieldDescription, field.TypeString) + } + if value, ok := su.mutation.Systemprompt(); ok { + _spec.SetField(scenario.FieldSystemprompt, field.TypeString, value) } - if su.mutation.DesctiptionCleared() { - _spec.ClearField(scenario.FieldDesctiption, field.TypeString) + if su.mutation.SystempromptCleared() { + _spec.ClearField(scenario.FieldSystemprompt, field.TypeString) } if value, ok := su.mutation.Date(); ok { _spec.SetField(scenario.FieldDate, field.TypeTime, value) @@ -285,23 +311,43 @@ func (suo *ScenarioUpdateOne) ClearExternalId() *ScenarioUpdateOne { return suo } -// SetDesctiption sets the "desctiption" field. -func (suo *ScenarioUpdateOne) SetDesctiption(s string) *ScenarioUpdateOne { - suo.mutation.SetDesctiption(s) +// SetDescription sets the "description" field. +func (suo *ScenarioUpdateOne) SetDescription(s string) *ScenarioUpdateOne { + suo.mutation.SetDescription(s) return suo } -// SetNillableDesctiption sets the "desctiption" field if the given value is not nil. -func (suo *ScenarioUpdateOne) SetNillableDesctiption(s *string) *ScenarioUpdateOne { +// SetNillableDescription sets the "description" field if the given value is not nil. +func (suo *ScenarioUpdateOne) SetNillableDescription(s *string) *ScenarioUpdateOne { if s != nil { - suo.SetDesctiption(*s) + suo.SetDescription(*s) } return suo } -// ClearDesctiption clears the value of the "desctiption" field. -func (suo *ScenarioUpdateOne) ClearDesctiption() *ScenarioUpdateOne { - suo.mutation.ClearDesctiption() +// ClearDescription clears the value of the "description" field. +func (suo *ScenarioUpdateOne) ClearDescription() *ScenarioUpdateOne { + suo.mutation.ClearDescription() + return suo +} + +// SetSystemprompt sets the "systemprompt" field. +func (suo *ScenarioUpdateOne) SetSystemprompt(s string) *ScenarioUpdateOne { + suo.mutation.SetSystemprompt(s) + return suo +} + +// SetNillableSystemprompt sets the "systemprompt" field if the given value is not nil. +func (suo *ScenarioUpdateOne) SetNillableSystemprompt(s *string) *ScenarioUpdateOne { + if s != nil { + suo.SetSystemprompt(*s) + } + return suo +} + +// ClearSystemprompt clears the value of the "systemprompt" field. +func (suo *ScenarioUpdateOne) ClearSystemprompt() *ScenarioUpdateOne { + suo.mutation.ClearSystemprompt() return suo } @@ -441,11 +487,17 @@ func (suo *ScenarioUpdateOne) sqlSave(ctx context.Context) (_node *Scenario, err if suo.mutation.ExternalIdCleared() { _spec.ClearField(scenario.FieldExternalId, field.TypeString) } - if value, ok := suo.mutation.Desctiption(); ok { - _spec.SetField(scenario.FieldDesctiption, field.TypeString, value) + if value, ok := suo.mutation.Description(); ok { + _spec.SetField(scenario.FieldDescription, field.TypeString, value) + } + if suo.mutation.DescriptionCleared() { + _spec.ClearField(scenario.FieldDescription, field.TypeString) + } + if value, ok := suo.mutation.Systemprompt(); ok { + _spec.SetField(scenario.FieldSystemprompt, field.TypeString, value) } - if suo.mutation.DesctiptionCleared() { - _spec.ClearField(scenario.FieldDesctiption, field.TypeString) + if suo.mutation.SystempromptCleared() { + _spec.ClearField(scenario.FieldSystemprompt, field.TypeString) } if value, ok := suo.mutation.Date(); ok { _spec.SetField(scenario.FieldDate, field.TypeTime, value) diff --git a/ent/schema/scenario.go b/ent/schema/scenario.go index f0c0ac2..dce20a8 100644 --- a/ent/schema/scenario.go +++ b/ent/schema/scenario.go @@ -19,7 +19,8 @@ func (Scenario) Fields() []ent.Field { Default(uuid.New), field.String("name"), field.String("externalId").Optional(), - field.String("desctiption").Optional(), + field.String("description").Optional(), + field.String("systemprompt").Optional(), field.Time("date").Optional(), } } diff --git a/internal/api/evaluationapi/server.gen.go b/internal/api/evaluationapi/server.gen.go index ff33c7b..0f9d7d4 100644 --- a/internal/api/evaluationapi/server.gen.go +++ b/internal/api/evaluationapi/server.gen.go @@ -127,6 +127,9 @@ type ScenarioStatistics struct { RatingScore RatingScore `json:"ratingScore"` ResultStatistics []NameValuePair `json:"resultStatistics"` + // SystemPrompt The used systemprompt for the scenario. + SystemPrompt *string `json:"systemPrompt,omitempty"` + // TotalResponseCount The amount of questions and response evaluated in this scenario. TotalResponseCount int32 `json:"totalResponseCount"` } @@ -329,39 +332,39 @@ func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/9RYbVPcOBL+KyrdfghXtsfzAgXz5Y7NEtYkA4Rhk7tkOUpj98yI2JJXkhkGyv/9SvI7", - "FpCkcrV7n2Zst/rl6dbTLT3gkCcpZ8CUxNMHnBJBElAgzNNhptZc0HuiKGf6RQQyFDQtHvHJx0uk+Bdg", - "aEPVGpG2NKJsyUVi/nvYwXBHkjQGPMWwPVkvjkN6Rk+C3+6D4SkNZMAudsPXwV7wJf3Xh9cnBx5sT+6j", - "jwE9o8Hd7Gbmn17+e3z2y5dNQDd0kbxRn+ZG+JYcT1YXxwexfk8+vvGDG353enk0mt3Mdme/BNvle2++", - "jN/ebS5O5jN4+/bN6P3lZLlJZ3CyHO+dn33Z2558uCbReyk3uyF2MNWBrYFEILCDGUm0y10cHCzDNSSk", - "D8jPQAQIdKkx0UGnRCkQ+sur/7wqP+784/Oh+4m497574F5f/f33370XXvy0gx2stqn2RCpB2QrneV55", - "YRJ1JAQXQYN437XWR0QWPFNIrQGBXmc8FTwFoSgYdSGPoK9izhNAGaN/ZOVCpOU6yR36/tDBhSU8xZSp", - "8ahxnjIFKxA4d3ACUpKVxYiJBJWfu4Vj7N+C2CKZQkiXNCzd4GEmIPIsKDlYwB8ZFRDh6ecirMb2VS3P", - "FzcQKu3X0S2JM4OStPhWf0RSEUWloqHso8ey5BRWRNFbS3wsSxYgEF8iVsogaGxqZV+BnrGQKUHi5w0Y", - "ke/Tf84ltUdwWhtIS5lvtvAoL61wuradDpZXuYOPQTVZuACZciYtPl6uAUVEEe2lrnMGd6rlZT9n0M37", - "TwKWeIr/NmjYcVBut0G7RHIH06hv/rdik9Cost813ZT0cjEe7+2NDtylD7vuJIR9dwEHe+44XO5H4I+H", - "C3/cL+sCPZDqJVdnZaWbFQ1WX7XkUY5ohFtKGg+cDnRliub17ng+Rc0u6gMl0UrwLIUILbZIhsCIoLyX", - "t+qDeaAKkhfTNy9XND5qeEqEiRBkW7Dr7CmGmjXc1PVlwaNtXxy8lYeO3BmhMdISHtKRk1BlJLbz3K/U", - "QWpNJaISJVsECaGxZ6uCiCiLf8V3FHKmCGX6ryp2A6DNGlgBs9aJNkQiASHQW4gQZSiYn6H9PX+Iig3c", - "9WrkD0euP3FH48vh/nS0O52Mvd3h8JPNsaXgiYU4SAJVnotZoWthRu7QLJMKREIYs+mVWUHUz4JcCnV1", - "B0nKhSJMlaEPX+4WJojGplPkt0RdF7qO5wOJMzgnVHxHgfcbh5k2noMtJApWXGy7waUNX/Yg0+YsSg8T", - "PQLwJRJEQYTMXqacDaodjlJChdRFYSrRanc4+g6q1yFWXmkQz7nsMHrNa30wBcgsVjUUmRDAvpbVL8za", - "Qu+SmL+Y1T0HWJYY7+o3LUhZ3X8s8P4J7G8j5l6gGtoLoihbzUMuTAF0oUnInYXayB1NsqSsC00dZnU3", - "67VDxaRhpjlqmThnlL2ozLVpe6Jki3CQ1EoqZCv67yj1vf2e1kegaYcrQ47BQgNmaQ39IbjZ0SkING85", - "0AW4s8w6nzRvqnDmtnDwL0S3AoUiIhEIqQApHseA5veFNEqoQhEwdMjUhgsFDJFMoncxSYg7cofjhRuu", - "iXLXy+tqe8trs++vF9vrVarcsbfrqkwsuHcjuZV5/5Qpx86HGjvW4sR5Mxu0zgoVNkOb4lTwlQApu4n+", - "qvGhS/q9ycHBorvrntPV3qDFiJbF6n/hk+KKxNUo9ppn7AmGJYn+poGtGoJEhEWo7gplhotxwXQG6w6c", - "+P63twZDZGV/sDhszZoFtG4GrswsR9mSF+dapkgxP5gxAE+x/vmnWIOIlReahl+e+S9oyNGv+r0ZtR5h", - "RSU6PA/0hLbkoi58tqqhkkjPD4g02K2AgSCqmHpiGkI5Fld3DCkJ14BGno8dnAnt21qpdDoYbDYbj5iv", - "HherQblUDt4Fr49O50fuyPO9tUpik2mqTP23jqqH54HmOhCycN73RlqSp8BISvEUjz3fGxe3FWtTa4Nm", - "I+vHFVjK5RiUbI5W5RzbAaNgAU2J5iGIilWNZ8Zkc9302V7kjcigew2TXzUHEuP2yPerJENR4SRNYxoa", - "8YFhNnNiqO5unttS9nOmKSYLDoS1oq4z7mmYJ/7khznVu+Wx+HPI6kuR8lbEXBVlSULE9hvypshK5wRX", - "saNW3nSvTLltTNPTnEX9cyXRHQB/SE0Y8vq5PI39EOTtU2qe57m9BruonL39S5ZCk6xW8T45XbfK+qXq", - "yB08kJ029jyFyDZ79wijw+1/ZcKw3Ho8SRh13/w/YYvufWeV/lZqikYrQdxWuSl62EMquOIhj/PpYPAA", - "7JYKzhJgKp8+6CN5PiApHZhhXFCyiMuDWyPXPbPFPCTxmpuLp0eXs80SOUVGDr2qxXdap7xGR0Fk4pGN", - "fX/f76k/50IhxdECUCYh8tA7Y0GvlogIQHoVeqVb9o6ZmfYnk3HxLHe8lvVS+2SiW675qyULV0qouu5o", - "FX13SlHtUiYLAtd5KhlXti2WCowrJk9XdQZ71wLnweOBpuLweud4rRnJsv1z5yWlvevzUlv7Ru4q/28A", - "AAD//0qyVwOaGgAA", + "H4sIAAAAAAAC/9RY23LbOBL9FRR2HuItkqIudtl62fUkjodOZCuWJ9lNxuuCyJYEhwQ4AGhZdunftwDe", + "TfiSVLYm+ySRbHQ3TjcODnCPQ56knAFTEo/vcUoESUCBME+HmVpxQe+IopzpFxHIUNA0f8Qnny6Q4l+B", + "oTVVK0Sa1oiyBReJ+e9hB8MtSdIY8BjD5mQ1Pw7pGT0Jfr8L+qc0kAE73w1fB3vB1/RfH1+fHHiwObmL", + "PgX0jAa3k+uJf3rx7+HZm6/rgK7pPHmrPs+M8Q05Hi3Pjw9i/Z58eusH1/z29OJoMLme7E7eBJvFB2+2", + "iN/drs9PZhN49+7t4MPFaLFOJ3CyGO5Nz77ubU4+XpHog5Tr3RA7mOqJrYBEILCDGUl0ym0cHCzDFSSk", + "C8ivQAQIdKEx0ZNOiVIg9JdX/3lVfNz5x5dD9zNx73z3wL26/Psff3jPvPhlBztYbVKdiVSCsiXebrdl", + "FqZQR0JwEdSId1NrfERkzjOF1AoQ6HEmU8FTEIqCcRfyCLouZjwBlDH6Z1YMRNquVdy+7/cdnEfCY0yZ", + "Gg7q5ClTsASBtw5OQEqytAQxM0HF53bjmPg3IDZIphDSBQ2LNHiYCYg8C0oOFvBnRgVEePwln1Yd+7Ky", + "5/NrCJXO6+iGxJlBSVpyqz4iqYiiUtFQdtFjWXIKS6LojWV+LEvmIBBfIFbYIKhjamcvQM9EyJQg8dMB", + "jMn3+Z9ySe0zOK0CpIXNN0d4UJfGdNqxnRaWl1sHH4Oqq3AOMuVMWnK8WAGKiCI6S93nDG5VI8tuzaBd", + "918ELPAY/61Xs2OvWG69ZotsHUyjbvjf80VCozJ+O3Td0ov5cLi3NzhwFz7suqMQ9t05HOy5w3CxH4E/", + "7M/9Ybetc/RAqudSnRSdbkbUWL1oyIMa0Qg3nNQZOC3oihLNqtXxdInqVdQFSqKl4FkKEZpvkAyBEUF5", + "p27lB/NAFSTPlm9WjKhz1PAUCBMhyCZn18ljDDWpuamdy5xHm645eEsPHbkTQmOkLTykZ05ClZHYznO/", + "UQepFZWISpRsECSExp6tCyKiLPnl31HImSKU6b8qXw2A1itgOczaJ1oTiQSEQG8gQpShYHaG9vf8PsoX", + "cDurgd8fuP7IHQwv+vvjwe54NPR2+/3PtsQWgicW4iAJlHXOtUI7woTcokkmFYiEMGbzK7OcqJ8EuTBq", + "+w6SlAtFmCqm3n9+tzCTqGM6eX0L1HWj6/l8JHEGU0LFdzR4d+MwauMp2EKiYMnFpj25tObLDmQ6nMXp", + "YaIlAF8gQRREyKxlylmvXOEoJVRI3RSmE61x+4PvoHo9xTIrDeKUyxajV7zWBVOAzGJVQZEJAeylrH5u", + "xuZ+F8T8xazac4BlicmuetOAlFX7jwXev4D9bcTcmaiG9pwoypazkAvTAG1oEnJroTZyS5MsKfpCU4cZ", + "3a56lVCuNIyaoxbFOaHsWWeuzdsjLZtPB0ntpES2pP+WU9/b73h9AJpOuAzkGCw0YJatoSuC6xWdgkCz", + "RgJtgFvDrPqkflNOZ2abDn5D9FagUEQkAiEVIMXjGNDsLrdGCVUoAoYOmVpzoYAhkkn0PiYJcQdufzh3", + "wxVR7mpxVS5veWXW/dV8c7VMlTv0dl2ViTn3riW3Mu9fonLsfKixYw1OnNXaoHFWKLHp2xyngi8FSNku", + "9IvkQ5v0O8rBwaK96p7y1VyguUTLYvW/yElupIJkKniSPsKtmYQI5WapMdMa4PElhj3Ps0oSxRWJS9H3", + "mmfskXgk0d90CcutRyLCIlTtP0Uv5cLE7EHWREa+/+2bkKHMYieyJGztD0t52rW+NKqRsgXPT9BMkVyp", + "GMGBx1j//FOsQMTKC420KG4XzmnI0W/6vRF1D7CiEh1OA60FdUXKJcaWFVQSaaWCSI3dEhgIonJ9FdMQ", + "CgFe3makJFwBGng+dnAmdG4rpdJxr7derz1ivnpcLHvFUNl7H7w+Op0duQPP91YqiU2lqTKd0DgUH04D", + "zaogZJ687w21JU+BkZTiMR56+pW5F1mZru7VlKEfl2Bpl2NQsj7EFYq5BUbON5p8zUMQ5aPqzEzI+mLr", + "i3051Sa99oXP9rI++pi0B75fFhnyDidpGtPQmPcMh5qzSXlL9NTitZ9oTTNZcCCsMeuq4p6GeeSPflhS", + "nfskSz6HrLp+Ke5fzKVUliREbL6hboosdU1wOXfUqJvelVNuE4RaN1rcP9USban5Q3rCkNevxbnvhyBv", + "18Pb7XZr78E2KmfvfspWqIvVaN5HdXyjrZ/rjq2De7K1YT5NIbLJ3h3CaHH7z0wYlvuVRwmj2jf/T9ii", + "fbNalr9RmnyjlSBuytrke9h9KrjiIY+3417vHtgNFZwlwNR2fK8P/9seSWnPyH5ByTwujoi1Xft0GPOQ", + "xCturrgeXAPXQ+QYGTv0qjLfaZwnax85kYkHMfb9fb/jfsqFQoqjea7KPPTeRNCjJSICkB6FXukte8do", + "pv3RaJg/yx2vEb3wPhrpLdf81ZZ5KgVU7XS0i246halOKZNQ6cKCcWUzYuHApGLqdFlVsHMBMQ0eCpqS", + "w6uV4zU0kmX5b53nnHYu6gtvzbu/y+1/AwAA//+4fCtMBBsAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/internal/controller/evaluationapi.go b/internal/controller/evaluationapi.go index b50adc2..86a7a89 100644 --- a/internal/controller/evaluationapi.go +++ b/internal/controller/evaluationapi.go @@ -43,7 +43,7 @@ func (si EvaluationApiServerInterface) GetStatistics(c *gin.Context, params eval statScenario := evaluationapi.ScenarioStatistics{ Id: scenario.ID.String(), Name: scenario.Name, - Description: &scenario.Desctiption, + Description: &scenario.Description, ProgressStatistics: persistence.ProgressStatistics(ctx, scenario.ID, totalCount), ResultStatistics: resultStatistics, RatingScore: ratingScore, diff --git a/internal/data/dataimporter.go b/internal/data/dataimporter.go index 0830d76..42cba8c 100644 --- a/internal/data/dataimporter.go +++ b/internal/data/dataimporter.go @@ -39,51 +39,77 @@ func ImportData() error { return err } -// TODO fix -func createUser(ctx context.Context, client *ent.Client) error { - u, err := client.User.Create(). - SetName("user"). - Save(ctx) +func importFromFile(ctx context.Context, client *ent.Client, filename string) { + umbrella := LoadDataFromFile(filename) + header := umbrella.Header + entries := umbrella.Entries - var _ = u + if header == nil { + fmt.Print("No header found... skip import\n", len(*entries)) + return + } + printHeader(header) - return err -} + if entries == nil { + fmt.Print("No entries found... skip import\n", len(*entries)) + return + } -func importFromFile(ctx context.Context, client *ent.Client, filename string) { - evals := LoadDataFromFile(filename) - fmt.Printf("start import %d records...\n", len(*evals)) + fmt.Printf("start import %d records...\n", len(*entries)) - now := time.Now() - scDescription := fmt.Sprintf("This scenario with %d evaluations was imported from the file '%s' at '%s'", len(*evals), filename, now.String()) + name := header.Name + if stringIsNilOrEmpty(name) { + name = &filename + } scenario, err := client.Scenario.Create(). SetNillableExternalId(nil). - SetName(filename). - SetDesctiption(scDescription). - SetDate(time.Now()). + SetName(*name). + SetNillableDescription(header.Description). + SetNillableDate(tryParseTime(*header.Date)). + SetNillableSystemprompt(header.SystemPrompt). Save(ctx) if err != nil { fmt.Println(err) + return } - for _, eval := range *evals { + for i, entry := range *entries { + + if stringIsNilOrEmpty(entry.Id) { + fmt.Printf("EntryId is not given, skip Entry with index: %d\n", i) + continue + } //try to load existing request by external id - req, err := client.Request.Query(). - Where(request.ExternalId(eval.Id)). + req, err := client.Request. + Query(). + Where(request.ExternalId(*entry.Id)). First(ctx) //in case of error create new record if err != nil { - req, err = client.Request.Create(). - SetExternalId(eval.Id). - SetFrom(eval.Request.From). - SetBody(eval.Request.Body). - SetNillableDate(tryParseTime(eval.Request.Date)). + if stringIsNilOrEmpty(entry.Request.Body) { + fmt.Printf("Request.Body is not given, skip Entry with index %d and Id %s\n", i, *entry.Id) + continue + } + + req, err = client.Request. + Create(). + SetExternalId(*entry.Id). + SetBody(*entry.Request.Body). + SetNillableFrom(entry.Request.From). + SetNillableSubject(entry.Request.Subject). + SetNillableDate(tryParseTime(*entry.Request.Date)). Save(ctx) + + if err != nil { + fmt.Printf("Error while inserting new Request for Entry with index %d and Id %s\n", i, *entry.Id) + fmt.Println(err) + } + } if err != nil { @@ -92,54 +118,58 @@ func importFromFile(ctx context.Context, client *ent.Client, filename string) { //Create response res, err := client.Response.Create(). - SetFrom(eval.Response.From). - SetBody(eval.Response.Body). - SetScenarioId(scenario.ID). - SetRequestId(req.ID). - SetNillableDate(tryParseTime(eval.Response.Date)). + SetRequestID(req.ID). + SetScenarioID(scenario.ID). + SetBody(*entry.Response.Body). + SetNillableFrom(entry.Response.From). + SetNillableSubject(entry.Response.Subject). + SetNillableDate(tryParseTime(*entry.Response.Date)). Save(ctx) if err != nil { fmt.Println(err) } - //try to get user by external Id - user, err := persistence.GetUserByExternalId(ctx, eval.Rating.From) - var userId uuid.UUID + //only import rating if available + if entry.Rating != nil { - //if user does not exists try to create one - //in case of error create new record - if err != nil { + //try to get user by external Id + user, err := persistence.GetUserByExternalId(ctx, *entry.Rating.From) + var userId uuid.UUID - userId, err = persistence.UpsertUser(ctx, eval.Rating.From, eval.Rating.From, "LLM") + //if user does not exists try to create one + //in case of error create new record if err != nil { - fmt.Println(err) + + userId, err = persistence.UpsertUser(ctx, *entry.Rating.From, *entry.Rating.From, "LLM") + if err != nil { + fmt.Println(err) + } + } else { + userId = user.ID } - } else { - userId = user.ID - } - if err != nil { - fmt.Println(err) - } + if err != nil { + fmt.Println(err) + } - //create evaluation - err = client.Evaluation.Create(). - SetEvaluationResult(mapEvaluationResult(eval.Rating.Value)). - SetResponseId(res.ID). - SetNillableDate(tryParseTime(eval.Rating.Date)). - SetUserId(userId). - Exec(ctx) + //create evaluation + err = client.Evaluation.Create(). + SetEvaluationResult(mapEvaluationResult(*entry.Rating.Value)). + SetResponseId(res.ID). + SetNillableDate(tryParseTime(*entry.Rating.Date)). + SetUserId(userId). + Exec(ctx) - if err != nil { - fmt.Println(err) + if err != nil { + fmt.Println(err) + } } - } fmt.Println("Done...") } -func LoadDataFromFile(path string) *[]Evaluations { +func LoadDataFromFile(path string) Umbrella { // Open jsonFile from dataPath fmt.Println("Open data json from: " + path) jsonFile, err := os.Open(path) @@ -154,13 +184,20 @@ func LoadDataFromFile(path string) *[]Evaluations { // read our opened jsonFile as a byte array. bytes, _ := io.ReadAll(jsonFile) - var evaluations []Evaluations + var umbrella Umbrella // we unmarshal our byteArray which contains our - // jsonFile's content into 'users' which we defined above - json.Unmarshal(bytes, &evaluations) + json.Unmarshal(bytes, &umbrella) + + return umbrella +} - return &evaluations +func printHeader(header *Header) { + fmt.Printf("File header:\nName: %s\nDate: %s\nDescription: %s\n", *header.Name, *header.Date, *header.Description) + + if header.SystemPrompt != nil || *header.SystemPrompt != "" { + fmt.Printf("System Prompt:\n%s\n\n", *header.SystemPrompt) + } } func mapEvaluationResult(str string) string { @@ -185,3 +222,10 @@ func tryParseTime(str string) *time.Time { return &time } + +func stringIsNilOrEmpty(str *string) bool { + if str == nil || *str == "" { + return true + } + return false +} diff --git a/internal/data/datatypes.go b/internal/data/datatypes.go index 16c4dea..3515a39 100644 --- a/internal/data/datatypes.go +++ b/internal/data/datatypes.go @@ -1,21 +1,33 @@ package data -type Evaluations struct { - Rating Rating `json:"rating"` - Id string `json:"id"` - Request Message `json:"request"` - Response Message `json:"response"` +type Umbrella struct { + Header *Header `json:"header,omitempty"` + Entries *[]Entry `json:"entries,omitempty"` +} + +type Header struct { + Name *string `json:"name,omitempty"` + Description *string `json:"description,omitempty"` + SystemPrompt *string `json:"systemPrompt,omitempty"` + Date *string `json:"date,omitempty"` +} + +type Entry struct { + Rating *Rating `json:"rating,omitempty"` + Id *string `json:"id,omitempty"` + Request *Message `json:"request,omitempty"` + Response *Message `json:"response,omitempty"` } type Rating struct { - From string `json:"from"` - Value string `json:"value"` - Date string `json:"date"` + From *string `json:"from,omitempty"` + Value *string `json:"value,omitempty"` + Date *string `json:"date,omitempty"` } type Message struct { - Body string `json:"body"` - Date string `json:"date"` - From string `json:"from"` - Subject string `json:"subject"` + Body *string `json:"body,omitempty"` + Date *string `json:"date,omitempty"` + From *string `json:"from,omitempty"` + Subject *string `json:"subject,omitempty"` } diff --git a/scripts/ent-gen.sh b/scripts/ent-gen.sh new file mode 100755 index 0000000..debc66c --- /dev/null +++ b/scripts/ent-gen.sh @@ -0,0 +1,10 @@ +#!/bin/bash +echo update ent schema... +go run -mod=mod entgo.io/ent/cmd/ent generate --feature sql/upsert ./../ent/schema +echo done. + +echo download dependencies again... +go mod tidy +go mod vendor +echo done. + diff --git a/scripts/openapi-gen.sh b/scripts/openapi-gen.sh index 77e428a..8e5065a 100755 --- a/scripts/openapi-gen.sh +++ b/scripts/openapi-gen.sh @@ -1,14 +1,15 @@ #!/bin/bash echo download dependencies... go mod tidy -echo done +echo done. echo generating types... ~/go/bin/oapi-codegen \ -config ../configs/debug/evaluationapi.cfg.yaml \ ../api/evaluationapi.yaml -echo done +echo done. echo download dependencies again... go mod tidy -echo done \ No newline at end of file +go mod vendor +echo done. \ No newline at end of file diff --git a/ui/reval-web/src/app/evaluation/evaluation.component.html b/ui/reval-web/src/app/evaluation/evaluation.component.html index c1b0675..df19110 100644 --- a/ui/reval-web/src/app/evaluation/evaluation.component.html +++ b/ui/reval-web/src/app/evaluation/evaluation.component.html @@ -26,7 +26,7 @@

Evaluation Id {{ evaluation.id }}


- +
diff --git a/ui/reval-web/src/openapi-client/evaluationapi/api/responseEvaluation.service.ts b/ui/reval-web/src/openapi-client/evaluationapi/api/responseEvaluation.service.ts index 3041dfd..797f038 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/api/responseEvaluation.service.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/api/responseEvaluation.service.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/api/statistics.service.ts b/ui/reval-web/src/openapi-client/evaluationapi/api/statistics.service.ts index 478f70b..b864a32 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/api/statistics.service.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/api/statistics.service.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/errorInformation.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/errorInformation.ts index 77467a4..f07e0a7 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/errorInformation.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/errorInformation.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/evaluations.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/evaluations.ts index 4994f3b..414aaa6 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/evaluations.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/evaluations.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/getEvaluationResponse.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/getEvaluationResponse.ts index 616fe46..45f3ed5 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/getEvaluationResponse.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/getEvaluationResponse.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/getStatisticsResponse.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/getStatisticsResponse.ts index d2ed131..2e6062a 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/getStatisticsResponse.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/getStatisticsResponse.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/message.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/message.ts index c78ecb7..c4fafa8 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/message.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/message.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/nameValuePair.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/nameValuePair.ts index 31fa318..c13918d 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/nameValuePair.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/nameValuePair.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/postEvaluationRequest.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/postEvaluationRequest.ts index d1bf374..e859367 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/postEvaluationRequest.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/postEvaluationRequest.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/ratingScore.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/ratingScore.ts index b527d6d..5e45796 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/ratingScore.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/ratingScore.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/ui/reval-web/src/openapi-client/evaluationapi/model/scenarioStatistics.ts b/ui/reval-web/src/openapi-client/evaluationapi/model/scenarioStatistics.ts index fe7fce1..379d372 100644 --- a/ui/reval-web/src/openapi-client/evaluationapi/model/scenarioStatistics.ts +++ b/ui/reval-web/src/openapi-client/evaluationapi/model/scenarioStatistics.ts @@ -2,7 +2,7 @@ * Evaluation API * This API is for evaluating responses from a response generator. * - * The version of the OpenAPI document: 0.2 + * The version of the OpenAPI document: 0.3 * Contact: mail@rherlt.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -29,6 +29,10 @@ export interface ScenarioStatistics { * The description of the Scenario. */ description?: string; + /** + * The used systemprompt for the scenario. + */ + systemPrompt?: string; /** * The amount of questions and response evaluated in this scenario. */ From 6c51fcdac446c7808be6810d070c2f500d4bffe5 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Thu, 7 Sep 2023 14:33:23 +0200 Subject: [PATCH 20/31] Remove example data files and rename list component to statistics --- ui/reval-web/src/app/app-routing.module.ts | 2 +- ui/reval-web/src/app/app.module.ts | 2 +- ui/reval-web/src/app/list/data.ts | 14 ---- ui/reval-web/src/app/list/exampleRating.json | 39 ---------- ui/reval-web/src/app/list/exampleRating.ts | 74 ------------------- .../statistics.component.css} | 0 .../statistics.component.html} | 0 .../statistics.component.spec.ts} | 2 +- .../statistics.component.ts} | 4 +- 9 files changed, 5 insertions(+), 132 deletions(-) delete mode 100644 ui/reval-web/src/app/list/data.ts delete mode 100644 ui/reval-web/src/app/list/exampleRating.json delete mode 100644 ui/reval-web/src/app/list/exampleRating.ts rename ui/reval-web/src/app/{list/list.component.css => statistics/statistics.component.css} (100%) rename ui/reval-web/src/app/{list/list.component.html => statistics/statistics.component.html} (100%) rename ui/reval-web/src/app/{list/list.component.spec.ts => statistics/statistics.component.spec.ts} (89%) rename ui/reval-web/src/app/{list/list.component.ts => statistics/statistics.component.ts} (93%) diff --git a/ui/reval-web/src/app/app-routing.module.ts b/ui/reval-web/src/app/app-routing.module.ts index 6eff0f6..f4ccacf 100644 --- a/ui/reval-web/src/app/app-routing.module.ts +++ b/ui/reval-web/src/app/app-routing.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CommonModule } from '@angular/common'; -import { ListComponent } from './list/list.component'; +import { ListComponent } from './statistics/statistics.component'; import { EvaluationComponent } from './evaluation/evaluation.component'; const routes: Routes = [ diff --git a/ui/reval-web/src/app/app.module.ts b/ui/reval-web/src/app/app.module.ts index 2c5a19b..7337495 100644 --- a/ui/reval-web/src/app/app.module.ts +++ b/ui/reval-web/src/app/app.module.ts @@ -15,7 +15,7 @@ import { MatBadgeModule } from '@angular/material/badge'; import { EvaluationComponent } from './evaluation/evaluation.component'; import { AuthConfigModule } from './auth/auth-config.module'; import { UserprofileComponent } from './userprofile/userprofile.component'; -import { ListComponent } from './list/list.component'; +import { ListComponent } from './statistics/statistics.component'; import { MatListModule } from '@angular/material/list'; import { NgxChartsModule } from '@swimlane/ngx-charts'; import { Configuration } from 'src/openapi-client/evaluationapi'; diff --git a/ui/reval-web/src/app/list/data.ts b/ui/reval-web/src/app/list/data.ts deleted file mode 100644 index 071ff28..0000000 --- a/ui/reval-web/src/app/list/data.ts +++ /dev/null @@ -1,14 +0,0 @@ -export var evaluations = [ - { - "name": "negative", - "value": 38 - }, - { - "name": "unanswered", - "value": 20 - }, - { - "name": "positive", - "value": 360 - } -]; \ No newline at end of file diff --git a/ui/reval-web/src/app/list/exampleRating.json b/ui/reval-web/src/app/list/exampleRating.json deleted file mode 100644 index d17130f..0000000 --- a/ui/reval-web/src/app/list/exampleRating.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "scenarios": [ - { - "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", - "name": "Szenario Vicuna", - "description": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", - "totalResponseCount": 400, - "progressStatistics": [ - { - "name": "rated", - "value": 70 - }, - { - "name": "unrated", - "value": 330 - } - ], - "resultStatistic": [ - { - "name": "positive", - "value": 12 - }, - { - "name": "negative", - "value": 46 - }, - { - "name": "neutral", - "value": 12 - } - ], - "ratingScore": { - "min": -1, - "value": 0.8, - "max": 1 - } - } - ] -} \ No newline at end of file diff --git a/ui/reval-web/src/app/list/exampleRating.ts b/ui/reval-web/src/app/list/exampleRating.ts deleted file mode 100644 index e2f95ea..0000000 --- a/ui/reval-web/src/app/list/exampleRating.ts +++ /dev/null @@ -1,74 +0,0 @@ -export var ratings = { - "scenarios": [ - { - "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", - "name": "Llama 2 Szenario", - "description": "Das ist das erste tolle Szenario mit den Antworten aus Llama-2-13b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", - "totalResponseCount": 400, - "progressStatistics": [ - { - "name": "rated", - "value": 70 - }, - { - "name": "unrated", - "value": 330 - } - ], - "resultStatistics": [ - { - "name": "positive", - "value": 12 - }, - { - "name": "negative", - "value": 46 - }, - { - "name": "neutral", - "value": 12 - } - ], - "ratingScore": { - "min": -1, - "value": -0.5, - "max": 1 - } - }, - { - "id": "7d1e8d9a-f0c6-4f12-86d4-6956e1b47e01", - "name": "Vicuna Szenario", - "description": "Das ist das zweite tolle Szenario mit den Antworten aus Vicuna-33b-chat-hf_responses_rated_by_gpt-3.5-turbo.json", - "totalResponseCount": 400, - "progressStatistics": [ - { - "name": "rated", - "value": 370 - }, - { - "name": "unrated", - "value": 30 - } - ], - "resultStatistics": [ - { - "name": "positive", - "value": 310 - }, - { - "name": "negative", - "value": 40 - }, - { - "name": "neutral", - "value": 20 - } - ], - "ratingScore": { - "min": -1, - "value": 0.8, - "max": 1 - } - } - ] -} \ No newline at end of file diff --git a/ui/reval-web/src/app/list/list.component.css b/ui/reval-web/src/app/statistics/statistics.component.css similarity index 100% rename from ui/reval-web/src/app/list/list.component.css rename to ui/reval-web/src/app/statistics/statistics.component.css diff --git a/ui/reval-web/src/app/list/list.component.html b/ui/reval-web/src/app/statistics/statistics.component.html similarity index 100% rename from ui/reval-web/src/app/list/list.component.html rename to ui/reval-web/src/app/statistics/statistics.component.html diff --git a/ui/reval-web/src/app/list/list.component.spec.ts b/ui/reval-web/src/app/statistics/statistics.component.spec.ts similarity index 89% rename from ui/reval-web/src/app/list/list.component.spec.ts rename to ui/reval-web/src/app/statistics/statistics.component.spec.ts index 1b7458c..9666089 100644 --- a/ui/reval-web/src/app/list/list.component.spec.ts +++ b/ui/reval-web/src/app/statistics/statistics.component.spec.ts @@ -1,6 +1,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ListComponent } from './list.component'; +import { ListComponent } from './statistics.component'; describe('ListComponent', () => { let component: ListComponent; diff --git a/ui/reval-web/src/app/list/list.component.ts b/ui/reval-web/src/app/statistics/statistics.component.ts similarity index 93% rename from ui/reval-web/src/app/list/list.component.ts rename to ui/reval-web/src/app/statistics/statistics.component.ts index 816ecfd..9275d67 100644 --- a/ui/reval-web/src/app/list/list.component.ts +++ b/ui/reval-web/src/app/statistics/statistics.component.ts @@ -6,8 +6,8 @@ import { StatisticsService } from 'src/openapi-client/evaluationapi'; @Component({ selector: 'app-list', - templateUrl: './list.component.html', - styleUrls: ['./list.component.css'] + templateUrl: './statistics.component.html', + styleUrls: ['./statistics.component.css'] }) export class ListComponent { public ratings: GetStatisticsResponse | undefined; From 5545e4542396346a7b5bcd2dd1cd3049e1955176 Mon Sep 17 00:00:00 2001 From: Rico Herlt Date: Wed, 13 Sep 2023 16:18:35 +0200 Subject: [PATCH 21/31] #14 implemented improved algorithm to load responses with least evaluations --- internal/persistence/database.go | 54 ++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/internal/persistence/database.go b/internal/persistence/database.go index e9e024a..0ef8f29 100644 --- a/internal/persistence/database.go +++ b/internal/persistence/database.go @@ -4,10 +4,12 @@ import ( "context" "fmt" "log" + "math/rand" "os" "strings" "time" + "entgo.io/ent/dialect/sql" "github.com/google/uuid" _ "github.com/mattn/go-sqlite3" "github.com/rherlt/reval/ent" @@ -104,12 +106,52 @@ func GetNextResponse(ctx context.Context) (*ent.Response, error) { return nil, fmt.Errorf("failed to get database client: %w", err) } - response, err := client.Response.Query(). - Order( - // responses without evaluations are sorted first. - response.ByEvaluationsCount(), - ). - First(ctx) + var v []struct { + Id uuid.UUID `json:"id"` + EvaluationCount int `json:"evalCount"` + } + + //get min evaluation count of all responses... smallest possible result is 0 + err = client.Response. + Query(). + Limit(1). + Aggregate(func(s *sql.Selector) string { + joinT := sql.Table(response.EvaluationsTable) + s.LeftJoin(joinT). + On(s.C(response.FieldID), joinT.C(response.EvaluationsColumn)) + s.GroupBy(s.C(response.FieldID), joinT.C(response.EvaluationsColumn)) + s.OrderBy("evalCount") + return sql.As(sql.Count(joinT.C(response.EvaluationsColumn)), "evalCount") + }). + Scan(ctx, &v) + + minEvaluationCount := v[0].EvaluationCount + + //get all responseIds with number of evaluations equal to minEvaluationCount + err = client.Response. + Query(). + Select(response.FieldID). + Aggregate(func(s *sql.Selector) string { + joinT := sql.Table(response.EvaluationsTable) + + s.LeftJoin(joinT). + On(s.C(response.FieldID), joinT.C(response.EvaluationsColumn)) + s.GroupBy(s.C(response.FieldID), joinT.C(response.EvaluationsColumn)) + s.Having( + sql.EQ( + "evalCount", + minEvaluationCount), + ) + s.OrderBy("evalCount") + return sql.As(sql.Count(joinT.C(response.EvaluationsColumn)), "evalCount") + }). + Scan(ctx, &v) + + //generate random between 0 and number of responses with minEvaluationCount + rnd := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(v)) + + //load random response by its id + response, err := client.Response.Get(ctx, v[rnd].Id) if err != nil { fmt.Println(err) From 158d39235d6f8947a717205d938eb83c9647a080 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Tue, 19 Sep 2023 14:12:51 +0200 Subject: [PATCH 22/31] Add function to calculate the agreement per scenario --- internal/persistence/statistics.go | 79 ++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/internal/persistence/statistics.go b/internal/persistence/statistics.go index dc17a4d..ba11734 100644 --- a/internal/persistence/statistics.go +++ b/internal/persistence/statistics.go @@ -76,3 +76,82 @@ func GetResultStatisticsByScenarioId(ctx context.Context, scenarioId uuid.UUID) return res } + +func GetAgreementByScenarioId(ctx context.Context, scenarioId uuid.UUID) float64 { + + client, err := GetClient() + if err != nil { + fmt.Errorf("Failed to get database client: %w", err) + return 0.0 + } + + // Get all responses with the specified scenarioId + responses, err := client.Response.Query(). + Where(response.ScenarioId(scenarioId)). + All(ctx) + + if err != nil { + fmt.Errorf("Failed to get responses from database: %w", err) + return 0.0 + } + + allResponses := len(responses) + matchingEvaluations := 0.0 + + for _, response := range responses { + evaluations, errr := client.Evaluation.Query(). + Where(evaluation.ResponseId(response.ID)). + WithUser(). + All(ctx) + + if errr != nil { + fmt.Errorf("Failed to get evaluations from database: %w", errr) + continue + } + + userPositive := 0 + userNegative := 0 + var chatGPTEval string + var userEval string + + for _, evaluation := range evaluations { + if evaluation.Edges.User.Name == "gpt3.5-turbo" { + chatGPTEval = evaluation.EvaluationResult + } else { + if evaluation.EvaluationResult == "positve" { + userPositive++ + } else if evaluation.EvaluationResult == "negative" { + userNegative++ + } + } + } + + if (userPositive+userNegative == 0) || chatGPTEval == "" { + allResponses-- + continue + } + + if userPositive > userNegative { + userEval = "positive" + } else if userNegative < userPositive { + userEval = "negative" + } else { + //userEval == "positive" + userEval = "negative" + } + + if userEval == chatGPTEval { + matchingEvaluations++ + } + + } + + var agreement float64 + if allResponses == 0 { + agreement = 0.0 + } else { + agreement = matchingEvaluations / float64(allResponses) + } + + return agreement +} From 6312dc6593e82ca8c874f247dd871c31d6dc463f Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Tue, 19 Sep 2023 14:28:24 +0200 Subject: [PATCH 23/31] Change RatinngScore to ChatGPT Agreement --- internal/controller/evaluationapi.go | 4 ++-- internal/persistence/statistics.go | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/internal/controller/evaluationapi.go b/internal/controller/evaluationapi.go index b50adc2..43ef9ce 100644 --- a/internal/controller/evaluationapi.go +++ b/internal/controller/evaluationapi.go @@ -9,7 +9,6 @@ import ( "github.com/rherlt/reval/internal/config" "github.com/rherlt/reval/internal/oidc" "github.com/rherlt/reval/internal/persistence" - "github.com/rherlt/reval/internal/statistics" "github.com/gin-gonic/gin" ) @@ -37,7 +36,8 @@ func (si EvaluationApiServerInterface) GetStatistics(c *gin.Context, params eval for _, scenario := range scenarios { resultStatistics := persistence.GetResultStatisticsByScenarioId(ctx, scenario.ID) - ratingScore := statistics.CalculateRatingScore(&resultStatistics) + ratingScore := persistence.GetAgreementByScenarioId(ctx, scenario.ID) + //ratingScore := statistics.CalculateRatingScore(&resultStatistics) totalCount := persistence.GetTotalResponseCountByScenarioId(ctx, scenario.ID) statScenario := evaluationapi.ScenarioStatistics{ diff --git a/internal/persistence/statistics.go b/internal/persistence/statistics.go index ba11734..ebcf68b 100644 --- a/internal/persistence/statistics.go +++ b/internal/persistence/statistics.go @@ -77,12 +77,18 @@ func GetResultStatisticsByScenarioId(ctx context.Context, scenarioId uuid.UUID) return res } -func GetAgreementByScenarioId(ctx context.Context, scenarioId uuid.UUID) float64 { +func GetAgreementByScenarioId(ctx context.Context, scenarioId uuid.UUID) evaluationapi.RatingScore { + + score := evaluationapi.RatingScore{ + Min: 0, + Value: 0, + Max: 1, + } client, err := GetClient() if err != nil { fmt.Errorf("Failed to get database client: %w", err) - return 0.0 + return score } // Get all responses with the specified scenarioId @@ -92,7 +98,7 @@ func GetAgreementByScenarioId(ctx context.Context, scenarioId uuid.UUID) float64 if err != nil { fmt.Errorf("Failed to get responses from database: %w", err) - return 0.0 + return score } allResponses := len(responses) @@ -153,5 +159,7 @@ func GetAgreementByScenarioId(ctx context.Context, scenarioId uuid.UUID) float64 agreement = matchingEvaluations / float64(allResponses) } - return agreement + score.Value = float32(agreement) + + return score } From 4d7c92be95f87da2754ee14a65ba26474193dd2b Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 20 Sep 2023 12:29:16 +0200 Subject: [PATCH 24/31] Fix typo that caused positive userEvaluations not being counted for agreement --- internal/persistence/statistics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/persistence/statistics.go b/internal/persistence/statistics.go index ebcf68b..40a4a7a 100644 --- a/internal/persistence/statistics.go +++ b/internal/persistence/statistics.go @@ -124,7 +124,7 @@ func GetAgreementByScenarioId(ctx context.Context, scenarioId uuid.UUID) evaluat if evaluation.Edges.User.Name == "gpt3.5-turbo" { chatGPTEval = evaluation.EvaluationResult } else { - if evaluation.EvaluationResult == "positve" { + if evaluation.EvaluationResult == "positive" { userPositive++ } else if evaluation.EvaluationResult == "negative" { userNegative++ From f7ce57fcbc030c36f93f01217a97bbc51e4a96ff Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Mon, 25 Sep 2023 12:12:01 +0200 Subject: [PATCH 25/31] Adjust gpt user name --- internal/persistence/statistics.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/persistence/statistics.go b/internal/persistence/statistics.go index 40a4a7a..fa69c46 100644 --- a/internal/persistence/statistics.go +++ b/internal/persistence/statistics.go @@ -79,6 +79,8 @@ func GetResultStatisticsByScenarioId(ctx context.Context, scenarioId uuid.UUID) func GetAgreementByScenarioId(ctx context.Context, scenarioId uuid.UUID) evaluationapi.RatingScore { + gptUserName := "gpt-3.5-turbo" + score := evaluationapi.RatingScore{ Min: 0, Value: 0, @@ -121,7 +123,7 @@ func GetAgreementByScenarioId(ctx context.Context, scenarioId uuid.UUID) evaluat var userEval string for _, evaluation := range evaluations { - if evaluation.Edges.User.Name == "gpt3.5-turbo" { + if evaluation.Edges.User.Name == gptUserName { chatGPTEval = evaluation.EvaluationResult } else { if evaluation.EvaluationResult == "positive" { From 0a227cb9c24049818016b2f8d3a4d6c2d9899930 Mon Sep 17 00:00:00 2001 From: Rico Herlt Date: Wed, 27 Sep 2023 14:03:18 +0200 Subject: [PATCH 26/31] Rename 'list' to statistics' --- ui/reval-web/src/app/app-routing.module.ts | 4 ++-- ui/reval-web/src/app/app.component.html | 2 +- ui/reval-web/src/app/app.module.ts | 4 ++-- .../src/app/statistics/statistics.component.spec.ts | 10 +++++----- .../src/app/statistics/statistics.component.ts | 6 ++---- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ui/reval-web/src/app/app-routing.module.ts b/ui/reval-web/src/app/app-routing.module.ts index f4ccacf..f7afdfe 100644 --- a/ui/reval-web/src/app/app-routing.module.ts +++ b/ui/reval-web/src/app/app-routing.module.ts @@ -1,12 +1,12 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CommonModule } from '@angular/common'; -import { ListComponent } from './statistics/statistics.component'; +import { StatisticsComponent } from './statistics/statistics.component'; import { EvaluationComponent } from './evaluation/evaluation.component'; const routes: Routes = [ { path: '', component: EvaluationComponent }, - { path: 'list', component: ListComponent } + { path: 'scenario', component: StatisticsComponent } ]; @NgModule({ diff --git a/ui/reval-web/src/app/app.component.html b/ui/reval-web/src/app/app.component.html index e285bbf..5a3bfef 100644 --- a/ui/reval-web/src/app/app.component.html +++ b/ui/reval-web/src/app/app.component.html @@ -301,7 +301,7 @@ /> Welcome - +
diff --git a/ui/reval-web/src/app/app.module.ts b/ui/reval-web/src/app/app.module.ts index 7337495..2b8760a 100644 --- a/ui/reval-web/src/app/app.module.ts +++ b/ui/reval-web/src/app/app.module.ts @@ -15,7 +15,7 @@ import { MatBadgeModule } from '@angular/material/badge'; import { EvaluationComponent } from './evaluation/evaluation.component'; import { AuthConfigModule } from './auth/auth-config.module'; import { UserprofileComponent } from './userprofile/userprofile.component'; -import { ListComponent } from './statistics/statistics.component'; +import { StatisticsComponent } from './statistics/statistics.component'; import { MatListModule } from '@angular/material/list'; import { NgxChartsModule } from '@swimlane/ngx-charts'; import { Configuration } from 'src/openapi-client/evaluationapi'; @@ -25,7 +25,7 @@ import { Configuration } from 'src/openapi-client/evaluationapi'; AppComponent, EvaluationComponent, UserprofileComponent, - ListComponent + StatisticsComponent ], imports: [ BrowserModule, diff --git a/ui/reval-web/src/app/statistics/statistics.component.spec.ts b/ui/reval-web/src/app/statistics/statistics.component.spec.ts index 9666089..fed9727 100644 --- a/ui/reval-web/src/app/statistics/statistics.component.spec.ts +++ b/ui/reval-web/src/app/statistics/statistics.component.spec.ts @@ -1,16 +1,16 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ListComponent } from './statistics.component'; +import { StatisticsComponent } from './statistics.component'; describe('ListComponent', () => { - let component: ListComponent; - let fixture: ComponentFixture; + let component: StatisticsComponent; + let fixture: ComponentFixture; beforeEach(() => { TestBed.configureTestingModule({ - declarations: [ListComponent] + declarations: [StatisticsComponent] }); - fixture = TestBed.createComponent(ListComponent); + fixture = TestBed.createComponent(StatisticsComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/ui/reval-web/src/app/statistics/statistics.component.ts b/ui/reval-web/src/app/statistics/statistics.component.ts index 9275d67..eefacdc 100644 --- a/ui/reval-web/src/app/statistics/statistics.component.ts +++ b/ui/reval-web/src/app/statistics/statistics.component.ts @@ -1,15 +1,13 @@ import { Component } from '@angular/core'; -import { MatListModule } from '@angular/material/list'; -//import { ratings } from './exampleRating'; import { GetStatisticsResponse } from 'src/openapi-client/evaluationapi'; import { StatisticsService } from 'src/openapi-client/evaluationapi'; @Component({ - selector: 'app-list', + selector: 'app-statistics', templateUrl: './statistics.component.html', styleUrls: ['./statistics.component.css'] }) -export class ListComponent { +export class StatisticsComponent { public ratings: GetStatisticsResponse | undefined; view: [number, number] = [300, 250]; From 777b9163be116fde92b929bbba03f388fda7fd43 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 27 Sep 2023 14:21:31 +0200 Subject: [PATCH 27/31] Fix typo --- ui/reval-web/src/app/app-routing.module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/reval-web/src/app/app-routing.module.ts b/ui/reval-web/src/app/app-routing.module.ts index f7afdfe..acb4853 100644 --- a/ui/reval-web/src/app/app-routing.module.ts +++ b/ui/reval-web/src/app/app-routing.module.ts @@ -6,7 +6,7 @@ import { EvaluationComponent } from './evaluation/evaluation.component'; const routes: Routes = [ { path: '', component: EvaluationComponent }, - { path: 'scenario', component: StatisticsComponent } + { path: 'statistics', component: StatisticsComponent } ]; @NgModule({ From 62481b377e7c5b4e03dd0490c66f95adbda5c684 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 27 Sep 2023 17:51:49 +0200 Subject: [PATCH 28/31] Change query to correctly count evaluated responses --- internal/persistence/database.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/persistence/database.go b/internal/persistence/database.go index 0ef8f29..2f620fc 100644 --- a/internal/persistence/database.go +++ b/internal/persistence/database.go @@ -16,6 +16,7 @@ import ( "github.com/rherlt/reval/ent/evaluation" "github.com/rherlt/reval/ent/request" "github.com/rherlt/reval/ent/response" + "github.com/rherlt/reval/ent/scenario" "github.com/rherlt/reval/ent/user" "github.com/rherlt/reval/internal/api/evaluationapi" "github.com/rherlt/reval/internal/config" @@ -326,17 +327,19 @@ func ProgressStatistics(ctx context.Context, scenarioId uuid.UUID, totalCount in Count int `json:"count"` } - err = client.Evaluation. + err = client.Debug().Response. Query(). Where( - evaluation.And( - evaluation.HasUserWith(user.Type(config.Current.Oidc_Authority)), - evaluation.HasResponseWith(response.ScenarioId(scenarioId)), - ), - ). + response.HasScenarioWith(scenario.ID(scenarioId)), + response.HasEvaluationsWith(evaluation.HasUserWith(user.Type(config.Current.Oidc_Authority)))). Aggregate(ent.Count()). Scan(ctx, &v) + if err != nil { + fmt.Errorf("failed to retrieve progress from database: %w", err) + return []evaluationapi.NameValuePair{} + } + var currentCount int32 = int32(v[0].Count) result := [...]evaluationapi.NameValuePair{ From 2b164e6c97f14fdcc703edd7720e7c4979e0f93b Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Wed, 27 Sep 2023 17:53:07 +0200 Subject: [PATCH 29/31] Remove debugging mode of query --- internal/persistence/database.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/persistence/database.go b/internal/persistence/database.go index 2f620fc..7d1fc45 100644 --- a/internal/persistence/database.go +++ b/internal/persistence/database.go @@ -327,7 +327,7 @@ func ProgressStatistics(ctx context.Context, scenarioId uuid.UUID, totalCount in Count int `json:"count"` } - err = client.Debug().Response. + err = client.Response. Query(). Where( response.HasScenarioWith(scenario.ID(scenarioId)), From 9a593aa86c23e205d0b98d50ddc7d3eab09eec47 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Thu, 28 Sep 2023 13:07:29 +0200 Subject: [PATCH 30/31] Cleanup statistics page and fix some bugs --- .../app/statistics/statistics.component.html | 23 +++++++++++-------- .../app/statistics/statistics.component.ts | 6 ++--- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ui/reval-web/src/app/statistics/statistics.component.html b/ui/reval-web/src/app/statistics/statistics.component.html index c4beb98..e0403d2 100644 --- a/ui/reval-web/src/app/statistics/statistics.component.html +++ b/ui/reval-web/src/app/statistics/statistics.component.html @@ -1,19 +1,19 @@ - - + + - {{rating.name}} + {{statistic.name}}
-

{{rating.description}}

-

Questions: {{rating.totalResponseCount}}

+

{{statistic.description}}

+

Responses: {{statistic.totalResponseCount}}

- - Rating Score: {{rating.ratingScore.value}} + +
+ No evaluations, yet +
+
+ Consensus with ChatGPT: {{statistic.ratingScore.value * 100}}%
diff --git a/ui/reval-web/src/app/statistics/statistics.component.ts b/ui/reval-web/src/app/statistics/statistics.component.ts index eefacdc..4c51ff4 100644 --- a/ui/reval-web/src/app/statistics/statistics.component.ts +++ b/ui/reval-web/src/app/statistics/statistics.component.ts @@ -8,8 +8,8 @@ import { StatisticsService } from 'src/openapi-client/evaluationapi'; styleUrls: ['./statistics.component.css'] }) export class StatisticsComponent { - public ratings: GetStatisticsResponse | undefined; - view: [number, number] = [300, 250]; + public statistics: GetStatisticsResponse | undefined; + view: [number, number] = [300, 200]; gradient: boolean = false; showLegend: boolean = false; @@ -34,7 +34,7 @@ export class StatisticsComponent { ngOnInit() { this.statisticService.getStatistics().subscribe(e => { - this.ratings = e + this.statistics = e Object.assign(this, { e }); }) From a422e132909f2f964a3aa0e0e879944d8916bf08 Mon Sep 17 00:00:00 2001 From: Tobias Trompell Date: Fri, 6 Oct 2023 14:15:39 +0200 Subject: [PATCH 31/31] Update layout of statistic cards --- .../app/statistics/statistics.component.css | 9 +++ .../app/statistics/statistics.component.html | 76 +++++++++++-------- .../app/statistics/statistics.component.ts | 16 ++-- 3 files changed, 62 insertions(+), 39 deletions(-) diff --git a/ui/reval-web/src/app/statistics/statistics.component.css b/ui/reval-web/src/app/statistics/statistics.component.css index 96b6c43..1a902c5 100644 --- a/ui/reval-web/src/app/statistics/statistics.component.css +++ b/ui/reval-web/src/app/statistics/statistics.component.css @@ -17,4 +17,13 @@ mat-divider { mat-card-header { padding: 5px; +} + +.span-custom { + display: inline-block; +} + +mat-list { + flex-grow: 1; + overflow: auto; } \ No newline at end of file diff --git a/ui/reval-web/src/app/statistics/statistics.component.html b/ui/reval-web/src/app/statistics/statistics.component.html index c4beb98..c602886 100644 --- a/ui/reval-web/src/app/statistics/statistics.component.html +++ b/ui/reval-web/src/app/statistics/statistics.component.html @@ -1,41 +1,55 @@ - - + + - {{rating.name}} + {{statistic.name}}
-

{{rating.description}}

-

Questions: {{rating.totalResponseCount}}

- - - Rating Score: {{rating.ratingScore.value}} +

{{statistic.description}}

+ +

Responses: {{statistic.totalResponseCount}}

+ +

Progress:

+ +
+ +

Results total:

+ +
+ +
+ No evaluations, yet +
+
+
+ Consesus with ChatGPT: {{(statistic.ratingScore.value * 100).toFixed(1)}}% +
-
+
\ No newline at end of file diff --git a/ui/reval-web/src/app/statistics/statistics.component.ts b/ui/reval-web/src/app/statistics/statistics.component.ts index eefacdc..ee8690c 100644 --- a/ui/reval-web/src/app/statistics/statistics.component.ts +++ b/ui/reval-web/src/app/statistics/statistics.component.ts @@ -8,12 +8,12 @@ import { StatisticsService } from 'src/openapi-client/evaluationapi'; styleUrls: ['./statistics.component.css'] }) export class StatisticsComponent { - public ratings: GetStatisticsResponse | undefined; - view: [number, number] = [300, 250]; + public statistics: GetStatisticsResponse | undefined; + view: [number, number] = [120, 120]; gradient: boolean = false; showLegend: boolean = false; - showLabels: boolean = true; + showLabels: boolean = false; isDoughnut: boolean = false; progressColors = @@ -34,21 +34,21 @@ export class StatisticsComponent { ngOnInit() { this.statisticService.getStatistics().subscribe(e => { - this.ratings = e + this.statistics = e Object.assign(this, { e }); }) } onSelect(data: any): void { - console.log('Item clicked', JSON.parse(JSON.stringify(data))); + //console.log('Item clicked', JSON.parse(JSON.stringify(data))); } onActivate(data: any): void { - console.log('Activate', JSON.parse(JSON.stringify(data))); + //console.log('Activate', JSON.parse(JSON.stringify(data))); } onDeactivate(data: any): void { - console.log('Deactivate', JSON.parse(JSON.stringify(data))); + //console.log('Deactivate', JSON.parse(JSON.stringify(data))); } -} +} \ No newline at end of file