diff --git a/chatapi/package.json b/chatapi/package.json
index 3ed1a5eadb..519d89bbfa 100644
--- a/chatapi/package.json
+++ b/chatapi/package.json
@@ -5,6 +5,7 @@
"main": "index.ts",
"scripts": {
"start": "ts-node src/index.ts",
+ "build": "tsc",
"dev": "nodemon --exec ts-node src/index.ts",
"lint": "eslint . --ext .ts",
"lint-fix": "eslint . --ext .ts --fix"
@@ -32,16 +33,16 @@
"cors": "^2.8.5",
"express": "^4.18.2",
"nano": "^10.1.2",
- "openai": "^3.3.0"
+ "openai": "^3.3.0",
+ "dotenv": "^16.1.4",
+ "ts-node": "^10.9.1",
+ "typescript": "^5.1.3"
},
"devDependencies": {
"@types/node": "^20.3.1",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
- "dotenv": "^16.1.4",
"eslint": "^8.43.0",
- "nodemon": "^2.0.22",
- "ts-node": "^10.9.1",
- "typescript": "^5.1.3"
+ "nodemon": "^2.0.22"
}
}
diff --git a/docker/chatapi/amd64-Dockerfile b/docker/chatapi/amd64-Dockerfile
index 3ca62aa161..c9de12b172 100644
--- a/docker/chatapi/amd64-Dockerfile
+++ b/docker/chatapi/amd64-Dockerfile
@@ -3,8 +3,8 @@ FROM treehouses/node
RUN apk update
# Install dependencies
-COPY ./chatapi/package*.json ./
-RUN npm install
+COPY ./chatapi/package.json ./
+RUN npm install --production
# Copy the application code
COPY ./chatapi/src ./src/
diff --git a/docker/chatapi/arm-Dockerfile b/docker/chatapi/arm-Dockerfile
index 39068a7e9c..1591c1b3ad 100644
--- a/docker/chatapi/arm-Dockerfile
+++ b/docker/chatapi/arm-Dockerfile
@@ -10,8 +10,8 @@ FROM treehouses/node-tags:arm
RUN apk update
-COPY ./chatapi/package*.json ./
-RUN npm install
+COPY ./chatapi/package.json ./
+RUN npm install --production
COPY ./chatapi/src ./src/
COPY ./chatapi/tsconfig.json ./tsconfig.json
diff --git a/docker/chatapi/arm64-Dockerfile b/docker/chatapi/arm64-Dockerfile
index e831de5643..b272cf9dab 100644
--- a/docker/chatapi/arm64-Dockerfile
+++ b/docker/chatapi/arm64-Dockerfile
@@ -10,8 +10,8 @@ FROM treehouses/node-tags:arm64
RUN apk update
-COPY ./chatapi/package*.json ./
-RUN npm install
+COPY ./chatapi/package.json ./
+RUN npm install --production
COPY ./chatapi/src ./src/
COPY ./chatapi/tsconfig.json ./tsconfig.json
diff --git a/package.json b/package.json
index 1d0eabf059..4ad900b712 100755
--- a/package.json
+++ b/package.json
@@ -1,10 +1,10 @@
{
"name": "planet",
"license": "AGPL-3.0",
- "version": "0.13.25",
+ "version": "0.13.26",
"myplanet": {
- "latest": "v0.9.57",
- "min": "v0.9.30"
+ "latest": "v0.9.60",
+ "min": "v0.9.36"
},
"scripts": {
"ng": "ng",
diff --git a/src/app/courses/add-courses/courses-add.component.html b/src/app/courses/add-courses/courses-add.component.html
index 3a4aa9c6d9..ea5dbdca27 100644
--- a/src/app/courses/add-courses/courses-add.component.html
+++ b/src/app/courses/add-courses/courses-add.component.html
@@ -42,11 +42,13 @@
+
diff --git a/src/app/courses/add-courses/courses-add.component.ts b/src/app/courses/add-courses/courses-add.component.ts
index e50741d9e0..a1101a7cbc 100644
--- a/src/app/courses/add-courses/courses-add.component.ts
+++ b/src/app/courses/add-courses/courses-add.component.ts
@@ -18,6 +18,7 @@ import { PouchService } from '../../shared/database/pouch.service';
import { debug } from '../../debug-operator';
import { TagsService } from '../../shared/forms/tags.service';
import { showFormErrors } from '../../shared/table-helpers';
+import { ChatService } from '../../shared/chat.service';
@Component({
templateUrl: 'courses-add.component.html',
@@ -58,6 +59,7 @@ export class CoursesAddComponent implements OnInit, OnDestroy {
languageNames = languages.map(list => list.name);
mockStep = { stepTitle: $localize`Add title`, description: '!!!' };
+ rating: String;
constructor(
private router: Router,
@@ -71,7 +73,8 @@ export class CoursesAddComponent implements OnInit, OnDestroy {
private stateService: StateService,
private planetStepListService: PlanetStepListService,
private pouchService: PouchService,
- private tagsService: TagsService
+ private tagsService: TagsService,
+ private chatService: ChatService
) {
this.createForm();
this.onFormChanges();
@@ -273,4 +276,29 @@ export class CoursesAddComponent implements OnInit, OnDestroy {
return { ...this.coursesService.storeMarkdownImages({ ...course, steps }) };
}
+ rateCourse() {
+ if (this.courseForm.valid) {
+ const stepsContent = this.steps.length > 0 ?
+ `The course has ${this.steps.length} steps: ${this.steps.map(step => `${step.stepTitle} - ${step.description}`).join('\n')}`
+ : '';
+
+ const content = `In 3 clear blobs, 1. provide a rating for this course(granular rating out of 100%), 2. Explain why you gave the rating 3. Explain how to improve the course
+ Course Title: ${this.courseForm.get('courseTitle').value}
+ Course Description: ${this.courseForm.get('description').value.text}
+ Grade Level: ${this.courseForm.get('gradeLevel').value}
+ Subject Level: ${this.courseForm.get('subjectLevel').value}
+ ${stepsContent}
+ `;
+
+ this.chatService.getPrompt(content).subscribe(
+ (rating) => {
+ this.rating = rating?.chat;
+ }
+ );
+ } else {
+ showFormErrors(this.courseForm.controls);
+ return;
+ }
+ }
+
}
diff --git a/src/app/courses/add-courses/courses-step.component.html b/src/app/courses/add-courses/courses-step.component.html
index a5e1111b91..8552d7cc1a 100644
--- a/src/app/courses/add-courses/courses-step.component.html
+++ b/src/app/courses/add-courses/courses-step.component.html
@@ -29,6 +29,8 @@
+
+
{{rating}}
{{activeStep?.exam ? 'Update' : 'Add' }} Test
diff --git a/src/app/courses/add-courses/courses-step.component.ts b/src/app/courses/add-courses/courses-step.component.ts
index c57e43def1..d0475ba462 100644
--- a/src/app/courses/add-courses/courses-step.component.ts
+++ b/src/app/courses/add-courses/courses-step.component.ts
@@ -7,6 +7,7 @@ import { takeUntil } from 'rxjs/operators';
import { CoursesService } from '../courses.service';
import { DialogsAddResourcesComponent } from '../../shared/dialogs/dialogs-add-resources.component';
import { DialogsLoadingService } from '../../shared/dialogs/dialogs-loading.service';
+import { ChatService } from '../../shared/chat.service';
@Component({
selector: 'planet-courses-step',
@@ -24,6 +25,7 @@ export class CoursesStepComponent implements OnDestroy {
dialogRef: MatDialogRef
;
activeStep: any;
activeStepIndex = -1;
+ rating: Text;
private onDestroy$ = new Subject();
constructor(
@@ -31,7 +33,8 @@ export class CoursesStepComponent implements OnDestroy {
private fb: FormBuilder,
private dialog: MatDialog,
private coursesService: CoursesService,
- private dialogsLoadingService: DialogsLoadingService
+ private dialogsLoadingService: DialogsLoadingService,
+ private chatService: ChatService
) {
this.stepForm = this.fb.group({
id: '',
@@ -100,4 +103,18 @@ export class CoursesStepComponent implements OnDestroy {
this.addStepEvent.emit();
}
+ rateStep() {
+ const content = `In 3 clear blobs, 1. provide a rating for this course step(granular rating out of 100%), 2. Explain why you gave the rating 3. Explain how to improve the course step
+ ${this.stepForm.get('stepTitle').value} - ${this.stepForm.get('description').value.text}`;
+
+ this.chatService.getPrompt(content).subscribe(
+ (completion: any) => {
+ this.rating = completion?.chat;
+ },
+ (error: any) => {
+ console.log(error);
+ }
+ );
+ }
+
}
diff --git a/src/app/landing/landing.component.html b/src/app/landing/landing.component.html
deleted file mode 100644
index 961b7e9c70..0000000000
--- a/src/app/landing/landing.component.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/src/app/landing/landing.component.ts b/src/app/landing/landing.component.ts
index 0a30d96083..d1424c0d06 100644
--- a/src/app/landing/landing.component.ts
+++ b/src/app/landing/landing.component.ts
@@ -2,22 +2,33 @@ import { Component } from '@angular/core';
@Component({
selector: 'planet-landing',
- templateUrl: './landing.component.html',
- styles: [ `
- .layoutbox {
- position: relative;
- min-height: 100vh;
- overflow-x: hidden;
- max-width: 100%;
- font-family: "Roboto", "Helvetica", "Arial", sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
+ template: `
+
+ `,
+ styles: [
+ `
+ .layoutbox {
+ position: relative;
+ min-height: 100vh;
+ overflow-x: hidden;
+ max-width: 100%;
+ font-family: "Roboto", "Helvetica", "Arial", sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
- .childrenbox {
- padding-bottom: 6rem;
- }
- ` ]
+ .childrenbox {
+ padding-bottom: 6rem;
+ }
+ `,
+ ],
})
export class LandingComponent {
diff --git a/src/app/shared/forms/planet-markdown-textbox.scss b/src/app/shared/forms/planet-markdown-textbox.scss
index cc7eb1cada..cac82c94c1 100644
--- a/src/app/shared/forms/planet-markdown-textbox.scss
+++ b/src/app/shared/forms/planet-markdown-textbox.scss
@@ -22,7 +22,7 @@
planet-markdown-textbox {
.CodeMirror, .CodeMirror-scroll {
height: inherit;
- min-height: inherit;
+ min-height: 15vh !important;
max-height: 15vh;
}