Skip to content

Develop#99

Open
galaxyhm wants to merge 3 commits into
masterfrom
develop
Open

Develop#99
galaxyhm wants to merge 3 commits into
masterfrom
develop

Conversation

@galaxyhm

Copy link
Copy Markdown
Owner

Can you review a my code.

@galaxyhm galaxyhm requested a review from Copilot May 20, 2025 01:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates file removals, dependency updates, and refactors training, FastAPI, and Django code for the ShortZip project.

  • Removed legacy tokenization, notebooks, and requirement files in favor of updated scripts and requirements.
  • Updated model_notebook/training.py with new imports, metrics via evaluate, and adjusted data paths.
  • Refactored FastAPI/Django views, tightened error handling, and updated settings for dynamic host/port via JSON.

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tokenization_kobert.py Entire tokenizer implementation removed
model_notebook/training.py Fixed imports, switched to evaluate, data path updates
fastapi/requirements.txt Simplified dependencies to core packages
fastapi/main.py Commented out legacy summarization function; added text preprocessing
django_app/ARTICLE_SUMMARY2/ARTICLE_SUMMARY2/settings.py Added dynamic FastAPI host/port loading
django_app/ARTICLE_SUMMARY2/board/views.py Enhanced error responses, adjusted URL-check logic
Comments suppressed due to low confidence (4)

tokenization_kobert.py:1

  • The entire tokenizer implementation was removed, which will break any code depending on KoBertTokenizer. If this was unintentional, please restore or migrate the tokenizer logic.
diff --git a/tokenization_kobert.py b/tokenization_kobert.py

model_notebook/training.py:115

  • Variable df is undefined here; likely intended to be train_df. This will raise a NameError at runtime.
hg_dataset = Dataset(pa.Table.from_pandas(df))

fastapi/requirements.txt:2

  • Critical dependencies such as transformers and requests were removed from requirements, which will break imports used in the FastAPI code.
fastapi

fastapi/main.py:10

  • [nitpick] Function name textProcessing does not follow snake_case naming convention. Consider renaming to text_processing.
def textProcessing( text: str) -> str:

Comment on lines +88 to +92
fastapi.close()

with open(BASE_DIR / 'db_connect.json') as db_connect:
db_data = json.load(db_connect)
db_connect.close()

Copilot AI May 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling .close() on the file handle inside a with open(...) block is redundant because with already handles closing.

Suggested change
fastapi.close()
with open(BASE_DIR / 'db_connect.json') as db_connect:
db_data = json.load(db_connect)
db_connect.close()
with open(BASE_DIR / 'db_connect.json') as db_connect:
db_data = json.load(db_connect)

Copilot uses AI. Check for mistakes.
if models.NewsArticleInfo.objects.filter(url=url) :
# 해당 URL을 가진 기사가 데이터베이스에 존재하면, 수정일자를 비교하여 최신 버전인지 확인.
if models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date__isnull=True)) or models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date = crawl_data_dict.get('modify_date'))):
if (models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date__isnull=True)) and crawl_data_dict.get('modify_date') != -1 ) or models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date = crawl_data_dict.get('modify_date'))):

Copilot AI May 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] This conditional is hard to read. Consider extracting parts into well-named boolean variables or simplifying the logic for clarity.

Suggested change
if (models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date__isnull=True)) and crawl_data_dict.get('modify_date') != -1 ) or models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date = crawl_data_dict.get('modify_date'))):
is_new_article_with_modify_date = models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date__isnull=True)) and crawl_data_dict.get('modify_date') != -1
is_article_up_to_date = models.NewsArticleInfo.objects.filter(Q(url=url) & Q(modify_date=crawl_data_dict.get('modify_date')))
if is_new_article_with_modify_date or is_article_up_to_date:

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants