Merge branch 'zdy'

This commit is contained in:
David Chang
2024-02-01 11:43:54 +08:00
4 changed files with 15 additions and 10 deletions

View File

@@ -68,7 +68,7 @@
"expected": { "expected": {
"type": "rule", "type": "rule",
"rules": { "rules": {
"unexpect": { "expect": {
"mail.identity.id1.auto_quote": { "mail.identity.id1.auto_quote": {
"method": "eq", "method": "eq",
"ref": false "ref": false

View File

@@ -1,7 +1,7 @@
{ {
"id": "06fe7178-4491-4589-810f-2e2bc9502122", "id": "06fe7178-4491-4589-810f-2e2bc9502122",
"snapshot": "thunderbird", "snapshot": "thunderbird",
"instruction": "Could you help me back up all the email files in my profile to ~/emails.bak? Please save them separately in eml format.", "instruction": "Could you help me back up all the email files in my inbox to ~/emails.bak? Please save them separately in eml format.",
"source": "https://www.quora.com/How-do-I-backup-email-files-in-Mozilla-Thunderbird", "source": "https://www.quora.com/How-do-I-backup-email-files-in-Mozilla-Thunderbird",
"config": [ "config": [
{ {

View File

@@ -1,7 +1,7 @@
{ {
"id": "2ad9387a-65d8-4e33-ad5b-7580065a27ca", "id": "2ad9387a-65d8-4e33-ad5b-7580065a27ca",
"snapshot": "thunderbird", "snapshot": "thunderbird",
"instruction": "Create two local folders for me: COMPANY and UNIVERSITY.", "instruction": "Create two local folders in Thunderbird for me: COMPANY and UNIVERSITY.",
"source": "https://support.mozilla.org/bm/questions/1027435", "source": "https://support.mozilla.org/bm/questions/1027435",
"config": [ "config": [
{ {

View File

@@ -460,14 +460,18 @@ class GPT4v_Agent:
with open("messages.json", "w") as f: with open("messages.json", "w") as f:
f.write(json.dumps(messages, indent=4)) f.write(json.dumps(messages, indent=4))
response = self.call_llm({ try:
"model": self.model, response = self.call_llm({
"messages": messages, "model": self.model,
"max_tokens": self.max_tokens "messages": messages,
}) "max_tokens": self.max_tokens
})
except:
response = ""
logger.debug("RESPONSE: %s", response) logger.debug("RESPONSE: %s", response)
# {{{
if self.exp == "seeact": if self.exp == "seeact":
messages.append({ messages.append({
"role": "assistant", "role": "assistant",
@@ -503,7 +507,7 @@ class GPT4v_Agent:
except Exception as e: except Exception as e:
print("Failed to parse action from response", e) print("Failed to parse action from response", e)
actions = None actions = None
self.thoughts.append("") self.thoughts.append("") # }}}
return actions return actions
@@ -516,7 +520,8 @@ class GPT4v_Agent:
response = requests.post( response = requests.post(
"https://api.openai.com/v1/chat/completions", "https://api.openai.com/v1/chat/completions",
headers=self.headers, headers=self.headers,
json=payload json=payload,
timeout=20
) )
if response.status_code != 200: if response.status_code != 200: