-
Notifications
You must be signed in to change notification settings - Fork 1
test endpoint (work in progress) #442
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
Open
Shumer-1
wants to merge
84
commits into
master
Choose a base branch
from
test_endpoint
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
33b8189
add test endpoint
Shumer-1 328972f
added stub
Shumer-1 28220b6
added new endpoint and question collection
Shumer-1 2832d83
removed unused parts
Shumer-1 835b5ce
initial commit
kiyro7 39d54cf
first prototype
kiyro7 d813c88
added LLM questions marker
kiyro7 f6e00b6
fix avatar uploading and models
Shumer-1 8e42c8e
removed methodology
kiyro7 48ed43c
requirements.txt added versions
kiyro7 1bcf046
simplified docker
kiyro7 8a54af1
heuristic patterns update
kiyro7 d7a57d7
updated questions ranking and added examples
kiyro7 e20a3e0
docker-compose finally done
kiyro7 5694ae7
interactive mode
kiyro7 6ec4877
logging added
kiyro7 0b28da7
logging update
kiyro7 39f7626
docker fix (builds aprox 40 mins)
kiyro7 bee9a7a
fixed heuristic questions generation
kiyro7 fa52f19
added front and states
Shumer-1 a16784b
clearing
kiyro7 c2df6e4
created static folder
kiyro7 666535d
full logs refactor and translation to russian
kiyro7 e92b6ac
stashed new question generator code for future updates
kiyro7 e7e72da
docker update - llm & stuff and code separated
kiyro7 21b960b
global question generator refactor
kiyro7 a89eb4d
added instructions
kiyro7 72916c8
add getting questions from database
Shumer-1 dc1cbd4
docx_parser from document_insight_system prototype (works) & docker f…
kiyro7 9adab60
testing paragraphs max nesting (founded max depth - 1)
kiyro7 7db5faf
first prototype of chapters detection (works)
kiyro7 755e248
add saving answers
Shumer-1 898ee3e
fix lti
Shumer-1 3e7cb1c
generator refactor for usage of DocxUploader & docker llm-init servic…
kiyro7 2c595cb
reduced num_beams for model and shuffled chunks of text for questions…
kiyro7 8869223
Merge pull request #448 from OSLL/test_endpoint
kiyro7 3cd08d7
Merge branch 'master' into questions_generator
kiyro7 9c8122f
added celery
kiyro7 9cadc4d
compose fix
kiyro7 f3fc98e
add answer evaluation
Shumer-1 38e3128
add result page
Shumer-1 040c7f2
fix docker
Shumer-1 83c77f2
possible compose fix
kiyro7 0b9cfd2
possible compose fix #2
kiyro7 1fb009d
CELERY WORKS!!!
kiyro7 fe7c97c
add upload page
Shumer-1 b20e2ba
add celery task logic
Shumer-1 1c1da23
fix celery
Shumer-1 ab80707
add celery logic
Shumer-1 c9f5dbd
Merge pull request #450 from OSLL/test_endpoint
kiyro7 d1d807b
first fixes
kiyro7 7b68940
dockerfiles fixes
kiyro7 95c1c1b
requirements.txt fix
kiyro7 c8464d4
questions order shuffle
kiyro7 e302609
add cancel session logic
Shumer-1 db72c5e
fix auth logic and add show all interview
Shumer-1 7d89bf0
some fix saving
Shumer-1 e3b1742
refactor code
Shumer-1 db8302f
add vars to config
Shumer-1 9ba6b53
add response
Shumer-1 1251040
fix window logic
Shumer-1 d8658ee
use format file backend logic
Shumer-1 1f8bb1c
fixes (Docker, generator)
kiyro7 9961141
Merge remote-tracking branch 'origin/questions_generator' into questi…
kiyro7 fc4cb45
mongo version update
kiyro7 f3bde7b
Revert "use format file backend logic"
Shumer-1 99ba79a
Revert "fix window logic"
Shumer-1 47c74a1
fix format logic
Shumer-1 1e9560a
add document ready and update config
Shumer-1 501f750
fix window logic
Shumer-1 b619bcf
fix upload page
Shumer-1 05ba373
fix result page
Shumer-1 7aea665
add new mongo odm file
Shumer-1 8f36341
fix task service
Shumer-1 9abaa1a
remove unused config
Shumer-1 b973df1
move methods
Shumer-1 daae10b
Docker simplified & generator fixes
kiyro7 3c0cdcf
Merge remote-tracking branch 'origin/questions_generator' into questi…
kiyro7 376cef4
llm questions fix & DbManager fix
kiyro7 0358789
add some fix
Shumer-1 5372f0c
add new criteria
Shumer-1 d459e64
add time limit
Shumer-1 1774c05
some fix
Shumer-1 97f934f
add json
Shumer-1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| from flask import Blueprint, render_template, session, request, Response | ||
|
|
||
| from app.root_logger import get_root_logger | ||
| from app.lti_session_passback.auth_checkers import check_auth | ||
| from app.mongo_odm import InterviewAvatarsDBManager, QuestionsDBManager | ||
|
|
||
| routes_interview = Blueprint('routes_interview', __name__) | ||
| logger = get_root_logger() | ||
|
|
||
|
|
||
| @routes_interview.route('/interview/', methods=['GET']) | ||
| def interview_page(): | ||
| user_session = check_auth() | ||
| if not user_session: | ||
| return "User session not found", 404 | ||
|
|
||
| session_id = session.get('session_id') | ||
| if not session_id: | ||
| return "Session id not found", 404 | ||
|
|
||
| avatar_record = InterviewAvatarsDBManager().get_avatar_record(session_id) | ||
| has_avatar = avatar_record is not None | ||
| logger.info("session_id" + session_id) | ||
| questions = QuestionsDBManager().get_questions_by_session(session_id) | ||
| logger.info(f"Questions count: {len(list(questions))}") | ||
|
|
||
| return render_template( | ||
| 'interview.html', | ||
| has_avatar=has_avatar, | ||
| session_id=session_id, | ||
| questions=list(questions) | ||
| ), 200 | ||
|
|
||
|
|
||
| def _partial_response_file(grid_out): | ||
| file_size = getattr(grid_out, 'length', None) | ||
| if file_size is None: | ||
| grid_out.seek(0, 2) # SEEK_END | ||
| file_size = grid_out.tell() | ||
| grid_out.seek(0) | ||
|
|
||
| content_type = getattr(grid_out, 'content_type', None) or 'video/mp4' | ||
|
|
||
| range_header = request.headers.get('Range', None) | ||
| if not range_header: | ||
| def full_stream(): | ||
| chunk_size = 8192 | ||
| grid_out.seek(0) | ||
| while True: | ||
| chunk = grid_out.read(chunk_size) | ||
| if not chunk: | ||
| break | ||
| yield chunk | ||
|
|
||
| headers = { | ||
| 'Content-Length': str(file_size), | ||
| 'Accept-Ranges': 'bytes', | ||
| 'Content-Type': content_type, | ||
| } | ||
| return Response(full_stream(), status=200, headers=headers) | ||
|
|
||
| try: | ||
| byte_range = range_header.strip().split('=')[1] | ||
| start_str, end_str = byte_range.split('-') | ||
| except Exception: | ||
| return Response(status=416) | ||
|
|
||
| try: | ||
| start = int(start_str) if start_str else 0 | ||
| except ValueError: | ||
| start = 0 | ||
|
|
||
| try: | ||
| end = int(end_str) if end_str else file_size - 1 | ||
| except ValueError: | ||
| end = file_size - 1 | ||
|
|
||
| if end >= file_size: | ||
| end = file_size - 1 | ||
| if start > end: | ||
| return Response(status=416) | ||
|
|
||
| length = end - start + 1 | ||
|
|
||
| def stream_range(): | ||
| chunk_size = 8192 | ||
| grid_out.seek(start) | ||
| remaining = length | ||
| while remaining > 0: | ||
| size = chunk_size if remaining >= chunk_size else remaining | ||
| data = grid_out.read(size) | ||
| if not data: | ||
| break | ||
| remaining -= len(data) | ||
| yield data | ||
|
|
||
| headers = { | ||
| 'Content-Range': f'bytes {start}-{end}/{file_size}', | ||
| 'Accept-Ranges': 'bytes', | ||
| 'Content-Length': str(length), | ||
| 'Content-Type': content_type, | ||
| } | ||
| return Response(stream_range(), status=206, headers=headers) | ||
|
|
||
|
|
||
| @routes_interview.route('/avatar_video') | ||
| def avatar_video(): | ||
| user_session = check_auth() | ||
| if not user_session: | ||
| return '', 404 | ||
|
|
||
| session_id = session.get('session_id') | ||
| if not session_id: | ||
| return '', 404 | ||
|
|
||
| grid_out = InterviewAvatarsDBManager().get_avatar_file(session_id) | ||
| if grid_out is None: | ||
| return '', 404 | ||
|
|
||
| return _partial_response_file(grid_out) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А что если не создавать новый роут, а (при необходимости) добавить параметры к старому?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поддерживаю - достаточно добавить LTI-параметр для переключения на интервью, т.к. логика отличается только в том, куда перенаправить
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Согласен, поправил