|
|
|
|
@ -21,35 +21,35 @@ def show_main_process(): |
|
|
|
|
show_ai = ShowAI(cinema, show_date) |
|
|
|
|
prompt = show_ai.general_prompt() |
|
|
|
|
start = datetime.datetime.now() |
|
|
|
|
# result, message, tokens = show_ai.get_show_result_ai() |
|
|
|
|
# end = datetime.datetime.now() |
|
|
|
|
# print('prompt:', prompt) |
|
|
|
|
# print('result:', result) |
|
|
|
|
# print('message:', message) |
|
|
|
|
# print('tokens:', tokens) |
|
|
|
|
# # 获取排片数据 |
|
|
|
|
# _show = next((s for s in result.split('------') if s.startswith('\n影厅别名,影厅id')), '') |
|
|
|
|
# _show = _show.strip() |
|
|
|
|
# print('_show:', _show) |
|
|
|
|
# # 获取销售额 |
|
|
|
|
# _sales = next((s for s in result.split('\n') if re.search('预估销售数据', s)), '') |
|
|
|
|
# _sales = str(re.findall(r'\d+\.?\d*', _sales)[0]) |
|
|
|
|
# print('_sales:', _sales) |
|
|
|
|
# # 处理返回结果 |
|
|
|
|
# try: |
|
|
|
|
# AiShow.objects.create( |
|
|
|
|
# cinema=cinema.name, |
|
|
|
|
# zz_code=cinema.zz_code, |
|
|
|
|
# show_date=show_date, |
|
|
|
|
# is_ai_show=True, |
|
|
|
|
# show=_show, |
|
|
|
|
# sales=_sales, |
|
|
|
|
# prompt=prompt, |
|
|
|
|
# result=result, |
|
|
|
|
# message=message, |
|
|
|
|
# take_times=int((end - start).seconds), |
|
|
|
|
# take_tokens=tokens |
|
|
|
|
# ) |
|
|
|
|
# except Exception as e: |
|
|
|
|
# print(e) |
|
|
|
|
result, message, tokens = show_ai.get_show_result_ai() |
|
|
|
|
end = datetime.datetime.now() |
|
|
|
|
print('prompt:', prompt) |
|
|
|
|
print('result:', result) |
|
|
|
|
print('message:', message) |
|
|
|
|
print('tokens:', tokens) |
|
|
|
|
# 获取排片数据 |
|
|
|
|
_show = next((s for s in result.split('------') if s.startswith('\n影厅别名,影厅id')), '') |
|
|
|
|
_show = _show.strip() |
|
|
|
|
print('_show:', _show) |
|
|
|
|
# 获取销售额 |
|
|
|
|
_sales = next((s for s in result.split('\n') if re.search('预估销售数据', s)), '') |
|
|
|
|
_sales = str(re.findall(r'\d+\.?\d*', _sales)[0]) |
|
|
|
|
print('_sales:', _sales) |
|
|
|
|
# 处理返回结果 |
|
|
|
|
try: |
|
|
|
|
AiShow.objects.create( |
|
|
|
|
cinema=cinema.name, |
|
|
|
|
zz_code=cinema.zz_code, |
|
|
|
|
show_date=show_date, |
|
|
|
|
is_ai_show=True, |
|
|
|
|
show=_show, |
|
|
|
|
sales=_sales, |
|
|
|
|
prompt=prompt, |
|
|
|
|
result=result, |
|
|
|
|
message=message, |
|
|
|
|
take_times=int((end - start).seconds), |
|
|
|
|
take_tokens=tokens |
|
|
|
|
) |
|
|
|
|
except Exception as e: |
|
|
|
|
print(e) |
|
|
|
|
return True |
|
|
|
|
|