Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qset Generator #1582

Merged
merged 42 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0f6a51d
add qset generation (limited)
cayb0rg Apr 30, 2024
f8e6be5
add input for number of questions
cayb0rg Apr 30, 2024
76d11e1
support qsets with 'assets' field
cayb0rg Apr 30, 2024
77282f3
if generating images, remove real names
cayb0rg Apr 30, 2024
c2ba53f
Add option to extend existing qset
cayb0rg May 8, 2024
f8b686c
Merge branch 'dev/10.2.0' of github.com:ucfopen/Materia into question…
cayb0rg May 8, 2024
ce250f2
Merge branch 'dev/10.2.0' of github.com:ucfopen/Materia into question…
cayb0rg Jun 10, 2024
c2a2881
Tweak prompt, fix merge conflicts
cayb0rg Jun 11, 2024
35eebfe
Make UI pretty
cayb0rg Jun 11, 2024
f404990
Hide generator for unsaved new instances
cayb0rg Jun 11, 2024
815a045
Fix error in previous commit
cayb0rg Jun 11, 2024
ec66d79
Fix file closing in image generation
cayb0rg Jun 11, 2024
8df738f
Add is_generable field to Widget model, hide generate button when API…
cayb0rg Jun 12, 2024
cf3217b
Add install.yaml custom prompt and add confirmation banner for genera…
cayb0rg Jun 18, 2024
5359ec0
Add warning to generator dialog
cayb0rg Jun 18, 2024
284ae09
Fix save history selection banner
cayb0rg Jun 18, 2024
0d60607
Return qset version with qset
cayb0rg Jun 20, 2024
8420695
Resolving composer conflicts in dev/10.3.0 update
clpetersonucf Aug 6, 2024
2af9ecd
Refactored generation code and relocated generation logic to new ques…
clpetersonucf Aug 19, 2024
6d805c4
Additional fixes
clpetersonucf Aug 19, 2024
67f252f
Reworked setting & acquisition of is_generable flag. Rewired generati…
clpetersonucf Aug 20, 2024
e4c2dcd
Untitled, unsaved instance names now update to prompt topic when gene…
clpetersonucf Aug 23, 2024
7adf0a8
is_generable flag will always return false for non-authenticated user…
clpetersonucf Aug 23, 2024
38172e9
Small style and UX tweaks to question generation modal & confirm bar
clpetersonucf Aug 23, 2024
5030a29
Reworks/additions to generation class to allow for openai OR azure op…
clpetersonucf Aug 28, 2024
e32afb5
forgot a paren, oops
clpetersonucf Aug 28, 2024
88d194e
Updated docker env with new placeholder generation variables
clpetersonucf Aug 28, 2024
8445aae
Improves error messaging in question generator
clpetersonucf Sep 4, 2024
c322c50
Fixes method by which generator grabs the qset for question generation
clpetersonucf Sep 5, 2024
8aa43a0
Generation dialog UX tweaks
clpetersonucf Sep 10, 2024
34ea69b
Addl error boundaries in generation endpoint. Updates tests.
clpetersonucf Sep 12, 2024
4f1d75e
Slight increase to generation dialog description text
clpetersonucf Sep 12, 2024
a3e6b3c
Reworks several error boundaries. Fixes default docker env. Ensures e…
clpetersonucf Sep 17, 2024
0fa59af
Fix to previous fixes. Adds format param to generator query method.
clpetersonucf Sep 17, 2024
7b9233f
Changes generation enabled error boundary. Updates dev docker compose…
clpetersonucf Sep 17, 2024
0824dbb
Adds step to build action to circumvent missing .env.local
clpetersonucf Sep 19, 2024
63519d2
Small adjustments to question generation dialog formatting
clpetersonucf Oct 1, 2024
bb60efb
Merge branch 'dev/10.3.0' into question-generation
clpetersonucf Oct 2, 2024
d562ad1
generation dialog input visual emphasis
clpetersonucf Oct 2, 2024
7fcfc31
updated comments in docker/.env and .env
clpetersonucf Oct 2, 2024
425fe05
Removed errant console log
clpetersonucf Oct 2, 2024
0c79507
Merge branch 'dev/10.3.0' into question-generation
clpetersonucf Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Only `BOOL_` options become boolean values, and ONLY `true` evaluates to true
#
# Docker/Dev notes:
# docker/config/materia-docker.env.local is loaded instead of .env.local
# docker/.env.local is used instead of .env.local

# GENERAL ===================

Expand Down Expand Up @@ -93,3 +93,14 @@ LTI_KEY="materia-production-lti-key"
#BOOL_LTI_USE_LAUNCH_ROLES=true
#BOOL_LTI_GRACEFUL_CONFIG_FALLBACK=true
#BOOL_LTI_LOG_FOR_DEBUGGING=false

# Question Generation ===

#GENERATION_ENABLED=true
#GENERATION_ALLOW_IMAGES=false
#GENERATION_API_PROVIDER=<MUST_SET>
#GENERATION_API_ENDPOINT=
#GENERATION_API_KEY=
#GENERATION_API_VERSION=
#GENERATION_API_MODEL=
#GENERATION_LOG_STATS=true
7 changes: 7 additions & 0 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Create .env.local to satisfy build requirements
run: |
cd docker
if [ ! -f .env.local ]; then
touch .env.local
fi

- name: Build App Image
run: |
cd docker
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public/js/materia.storage.table.js
public/js/student.js
public/js/vendor/*

public/openai_usage.txt

# Installed Widgets
public/widget
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"eher/oauth": "1.0.7",
"aws/aws-sdk-php": "^3.314",
"symfony/dotenv": "^5.1",
"ucfopen/materia-theme-ucf": "2.0.4"
"ucfopen/materia-theme-ucf": "2.0.4",
"openai-php/client": "^0.8.5"
},
"suggest": {
"ext-memcached": "*"
Expand Down
227 changes: 227 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 28 additions & 4 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Database settings
## docker/.env contains environment variables used by Materia during local development
## we do not recommend making edits directly to this file. Instead, make a .env.local in the same directory (docker/) and override the values below as desired.

# database settings
MYSQL_ROOT_PASSWORD=drRoots
MYSQL_USER=materia
MYSQL_PASSWORD=odin
Expand All @@ -12,12 +15,33 @@ DEV_ONLY_AUTH_SIMPLEAUTH_SALT=33e0d379060e3877d634632853c10a70dff9710b751e5af00a
DEV_ONLY_SECRET_CIPHER_KEY=e0beaea1704555ae3c75650703bb106fac24b8967c77a667124fbe745c3346ed

# s3-specific asset storage values
ASSET_STORAGE_DRIVER=s3 # overrides default value in the base .env (which isn't loaded into dev environment)

ASSET_STORAGE_S3_CREDENTIAL_PROVIDER=env # env | imds
# overrides default value in the base .env (which isn't loaded into dev environment)
ASSET_STORAGE_DRIVER=s3
# provider must be one of the following: env | imds
ASSET_STORAGE_S3_CREDENTIAL_PROVIDER=env
ASSET_STORAGE_S3_BUCKET=fake_bucket
ASSET_STORAGE_S3_ENDPOINT=http://fakes3:10001
ASSET_STORAGE_S3_KEY=KEY
ASSET_STORAGE_S3_SECRET=SECRET
# set to true if using real S3 on development
# DEV_ONLY_FAKES3_DISABLED=false

# question generation environment variables. Different variables are required depending on provider.

# DEV_ONLY_FAKES3_DISABLED=false # set to true if using real S3 on development
# required to be true for generation to be enabled
GENERATION_ENABLED=false
# explicitly enable or disable image generation. defaults to false if not provided.
GENERATION_ALLOW_IMAGES=false
# required. provider must be one of the following: openai | azure_openai
GENERATION_API_PROVIDER=openai
# required for both
GENERATION_API_KEY=
# required for azure
GENERATION_API_ENDPOINT=
# required for azure
GENERATION_API_VERSION=
# required for openai
GENERATION_API_MODEL=
# not required. stat logging is set to debug threshold
GENERATION_LOG_STATS=true
11 changes: 3 additions & 8 deletions docker/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@ services:
- ./config/nginx/nginx-dev.conf:/etc/nginx/nginx.conf:ro

app:
environment:
# values sourced from docker/env
- ASSET_STORAGE_DRIVER
- ASSET_STORAGE_S3_CREDENTIAL_PROVIDER
- ASSET_STORAGE_S3_BUCKET
- ASSET_STORAGE_S3_ENDPOINT
- ASSET_STORAGE_S3_KEY
- ASSET_STORAGE_S3_SECRET
env_file:
- .env
- .env.local
volumes:
- ..:/var/www/html/
- uploaded_widgets:/var/www/html/public/widget/
Expand Down
1 change: 1 addition & 0 deletions fuel/app/classes/basetest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ protected function make_disposable_widget(string $name = 'TestWidget', bool $res
'is_playable' => true,
'is_editable' => true,
'in_catalog' => true,
'is_generable' => false,
'restrict_publish' => $restrict_publish,
'api_version' => 2,
],
Expand Down
21 changes: 21 additions & 0 deletions fuel/app/classes/controller/qsets.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,25 @@ public function action_import()

return Response::forge($theme->render());
}

public function action_generate()
{
// Validate Logged in
if (\Service_User::verify_session() !== true ) throw new HttpNotFoundException;

$theme = Theme::instance();
$theme->set_template('layouts/react');
$theme->get_template()
->set('title', 'QSet Generation')
->set('page_type', 'generate');

Js::push_inline('var BASE_URL = "'.Uri::base().'";');
Js::push_inline('var WIDGET_URL = "'.Config::get('materia.urls.engines').'";');
Js::push_inline('var STATIC_CROSSDOMAIN = "'.Config::get('materia.urls.static').'";');

Css::push_group(['qset_generator']);
Js::push_group(['react', 'qset_generator']);

return Response::forge($theme->render());
}
}
Loading
Loading