mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 12:41:53 +09:00
browser use 버전 업데이트 및 프롬프트 개선 및 임시 파일 삭제 구조 개선
This commit is contained in:
parent
657d5370b9
commit
0f5ab6dea1
16 changed files with 442 additions and 620 deletions
33
src/main.py
33
src/main.py
|
|
@ -26,6 +26,8 @@ def setup_environment():
|
|||
Laminar.initialize(project_api_key=os.getenv("LMNR_PROJECT_API_KEY"))
|
||||
except ImportError:
|
||||
print("⚠️ Laminar 라이브러리가 설치되지 않았습니다. 관련 기능이 비활성화됩니다.")
|
||||
else:
|
||||
print("⚠️ LMNR_PROJECT_API_KEY 환경 변수가 설정되지 않았습니다. Laminar 기능이 비활성화됩니다.")
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
|
|
@ -64,6 +66,18 @@ def main():
|
|||
setup_signal_handler()
|
||||
args = parse_arguments()
|
||||
|
||||
# read and remove user data path
|
||||
log_file = os.path.join("./data", "userdata.dump")
|
||||
if not os.path.exists("./data"):
|
||||
os.makedirs("./data")
|
||||
if os.path.exists(log_file):
|
||||
with open(log_file, "r") as f:
|
||||
tmp_user_data_dir = f.read().strip()
|
||||
os.remove(tmp_user_data_dir)
|
||||
os.remove(log_file)
|
||||
print(f"🔧 강제로 종료되기 전에 사용한 {tmp_user_data_dir}를 삭제하였습니다.")
|
||||
|
||||
|
||||
try:
|
||||
asyncio.run(
|
||||
main_loop(
|
||||
|
|
@ -74,11 +88,24 @@ def main():
|
|||
)
|
||||
)
|
||||
except KeyboardInterrupt:
|
||||
print("\n프로그램이 사용자에 의해 중단되었습니다.")
|
||||
print("\n사용자에 의해 중단되었습니다. 현재까지의 작업을 저장합니다...")
|
||||
from lib.utils.progress import save_progress
|
||||
|
||||
save_progress()
|
||||
print(f"💾 진행 상황이 {progress_file}에 저장되었습니다.")
|
||||
print("다음에 같은 명령어로 실행하면 이어서 진행할 수 있습니다.")
|
||||
# terminate
|
||||
sys.exit(0)
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n❌ 예상치 못한 오류가 발생했습니다: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
finally:
|
||||
# 정상 종료 시 진행 상황 파일 삭제
|
||||
if os.path.exists(progress_file):
|
||||
# 정상 종료 시 진행 상황 파일 삭제 (종료 요청이 아닌 경우에만)
|
||||
from lib.utils.progress import is_shutdown_requested
|
||||
if not is_shutdown_requested() and os.path.exists(progress_file):
|
||||
try:
|
||||
os.remove(progress_file)
|
||||
print("진행 상황 파일이 삭제되었습니다.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue