Обновить wrapper.py
This commit is contained in:
20
wrapper.py
20
wrapper.py
@@ -2,10 +2,11 @@ from database import search_database
|
|||||||
from geocoder import validate_address
|
from geocoder import validate_address
|
||||||
from new_parser_test import parse
|
from new_parser_test import parse
|
||||||
from route import build_route
|
from route import build_route
|
||||||
|
from ouput_chat import RouteDescriber
|
||||||
import json
|
import json
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
user_input = parse()
|
user_input,conversation_history = parse()
|
||||||
user_input = json.loads(user_input)
|
user_input = json.loads(user_input)
|
||||||
print(user_input)
|
print(user_input)
|
||||||
query =user_input['tags']
|
query =user_input['tags']
|
||||||
@@ -25,9 +26,18 @@ if __name__=='__main__':
|
|||||||
n_nodes = len(mapping)
|
n_nodes = len(mapping)
|
||||||
allow_extend = any(v[1] for v in mapping.values())
|
allow_extend = any(v[1] for v in mapping.values())
|
||||||
print(len(mapping),allow_extend)
|
print(len(mapping),allow_extend)
|
||||||
route =0
|
route_otp =0
|
||||||
if allow_extend:
|
if allow_extend:
|
||||||
while n_nodes <= 5 and (route := build_route(found_points, mapping, user_position, user_time, n_nodes,strategy='random') or route): n_nodes += 1
|
while n_nodes <= 5 and (route_otp := build_route(found_points, mapping, user_position, user_time, n_nodes,strategy='random') or route_otp): n_nodes += 1
|
||||||
else:
|
else:
|
||||||
route= build_route(found_points, mapping, user_position, user_time, n_nodes,strategy='random')
|
route_otp= build_route(found_points, mapping, user_position, user_time, n_nodes,strategy='random')
|
||||||
print(route)
|
route, places = route_otp
|
||||||
|
dscb = RouteDescriber()
|
||||||
|
print(conversation_history)
|
||||||
|
description = dscb.generate_route_description(places,conversation_history)
|
||||||
|
print(route)
|
||||||
|
print(description)
|
||||||
|
for pl in places: print(pl)
|
||||||
|
q = input('ЗАГЛУШКА')
|
||||||
|
answer = dscb.answer_question(q)
|
||||||
|
print(answer)
|
||||||
|
|||||||
Reference in New Issue
Block a user