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

update something before release #140

Merged
merged 18 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 19 additions & 11 deletions api/psqlserver/model/Food.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class FoodModel(BaseModel):
discount_percent: int # Corrected data type to int
food_url: str = None
food_type_id: int = None
food_stock_quantity: int = None


class DailyReport:
Expand Down Expand Up @@ -47,11 +48,12 @@ def get_food_data(self):
food_name=record[1],
food_description=record[2],
food_price=float(record[3]),
food_status=bool(record[4]),
food_rate=int(record[5]),
discount_percent=int(record[6]),
food_url=record[7],
food_type_id=record[8]
food_stock_quantity=int(record[4]),
food_status=bool(record[5]),
food_rate=int(record[6]),
discount_percent=int(record[7]),
food_url=record[8],
food_type_id=record[9]

)
food_data.append(food.dict())
Expand Down Expand Up @@ -116,11 +118,12 @@ def search_food_by_name(self, food_name: str):
food_name=record[1],
food_description=record[2],
food_price=float(record[3]),
food_status=bool(record[4]),
food_rate=int(record[5]),
discount_percent=int(record[6]),
food_url=record[7],
food_type_id=record[8]
food_stock_quantity=int(record[4]),
food_status=bool(record[5]),
food_rate=int(record[6]),
discount_percent=int(record[7]),
food_url=record[8],
food_type_id=record[9]
)
food_data.append(food)
print(food_data)
Expand Down Expand Up @@ -258,6 +261,11 @@ def get_daily_sales(self):
def wikipedia_summary(self, food_name: str):
token = 'cwhc0nEvP6vBJCnYULFK5k-1qPGVgnt6KmCtEXv7pIZEMrnROoiRXYqwYUopCJMc1ubDEw.'
bard = Bard(token=token)
content = bard.get_answer(f'{food_name} là gì trong ẩm thực. chỉ cần đưa ra thông tin, dưới 180 từ ?')['content']
content = bard.get_answer(f'As a waiter of a restaurant, generate a description of {food_name} '
'in a non-scientific way. The description should be easy to understand for normal people. '
'The description must be written in Vietnamese with a language that is close to human language '
'as possible. Avoid descriptive and robotic descriptions. The description length must be limited '
'to 1 paragraph and must not exceed 30 words. Do not add recommendations in the last sentence.')
['content']

return content
5 changes: 4 additions & 1 deletion api/psqlserver/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ fastapi
protobuf==3.20
pymssql
google-auth
Unidecode
Unidecode
wikipedia
bardapi
pytz
555 changes: 286 additions & 269 deletions init/full.sql

Large diffs are not rendered by default.

Loading