Skip to content

Commit

Permalink
Add execute mode to py script and fix config priority of MI_USER and …
Browse files Browse the repository at this point in the history
…MI_PASS(cli > env > default) (yihong0618#48)

* add execute mode

* fix config priority of MI_USER and MI_PASS: cli > env > default
  • Loading branch information
CroMarmot committed Mar 3, 2023
1 parent a5864d1 commit b6ef3d2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions xiaogpt.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python3
import argparse
import asyncio
import json
Expand Down Expand Up @@ -147,8 +148,8 @@ async def login_miboy(self, session):
self.session = session
self.account = MiAccount(
session,
env.get("MI_USER") or MI_USER,
env.get("MI_PASS") or MI_PASS,
MI_USER,
MI_PASS,
str(self.mi_token_home),
)
# Forced login to refresh to refresh token
Expand Down Expand Up @@ -409,8 +410,8 @@ async def run_forever(self):
)
options = parser.parse_args()
# if set
MI_USER = options.account
MI_PASS = options.password
MI_USER = options.account or env.get("MI_USER") or MI_USER
MI_PASS = options.password or env.get("MI_PASS") or MI_PASS
OPENAI_API_KEY = options.openai_key or env.get("OPENAI_API_KEY")
if options.use_gpt3:
if not OPENAI_API_KEY:
Expand Down

0 comments on commit b6ef3d2

Please sign in to comment.