Skip to content

Commit 9792749

Browse files
committed
🇺🇸
1 parent a11a2fb commit 9792749

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

‎interpreter/core/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(
7777
import_computer_api=False,
7878
skills_path=None,
7979
import_skills=False,
80-
multi_line=False,
80+
multi_line=True,
8181
contribute_conversation=False,
8282
):
8383
# State

‎interpreter/terminal_interface/start_terminal_interface.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,17 @@ def start_terminal_interface(interpreter):
278278
sys.argv.remove(old_flag)
279279
sys.argv.append(new_flag)
280280

281-
parser = argparse.ArgumentParser(
281+
class CustomHelpParser(argparse.ArgumentParser):
282+
def print_help(self, *args, **kwargs):
283+
super().print_help(*args, **kwargs)
284+
special_help_message = '''
285+
Open Interpreter, 2024
286+
287+
Use """ to write multi-line messages.
288+
'''
289+
print(special_help_message)
290+
291+
parser = CustomHelpParser(
282292
description="Open Interpreter", usage="%(prog)s [options]"
283293
)
284294

‎interpreter/terminal_interface/utils/cli_input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
def cli_input(prompt: str = "") -> str:
2-
start_marker = "```"
3-
end_marker = "```"
2+
start_marker = '"""'
3+
end_marker = '"""'
44
message = input(prompt)
55

66
# Multi-line input mode

‎scripts/wtf.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import platform
88
import time
99

10+
import platformdirs
1011
import pyperclip
12+
import yaml
1113
from pynput.keyboard import Controller, Key
1214

1315
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
@@ -21,7 +23,7 @@
2123
1. Quickly scan the provided terminal history.
2224
2. Identify the most recent error or issue.
2325
3. Determine the most likely solution or debugging step.
24-
4. Respond with a brief explanation followed by a markdown code block containing a shell command to address the issue.
26+
4. Respond with a VERY brief explanation followed by a markdown code block containing a shell command to address the issue.
2527
2628
Rules:
2729
- Provide a single shell command in your code block, using line continuation characters (\\ for Unix-like systems, ^ for Windows) for multiline commands.
@@ -31,6 +33,7 @@
3133
- Place explanatory text before the code block.
3234
- NEVER USE COMMENTS IN YOUR CODE.
3335
- Focus on the most recent error, ignoring earlier unrelated commands.
36+
- The error may be as simple as a spelling error, or as complex as requiring tests to be run. You may even need to suggest a command that edits text in a file to fix some code.
3437
- Prioritize speed and conciseness in your response. Don't use markdown headings. Don't say more than a sentence or two. Be incredibly concise.
3538
3639
User's System: {platform.system()}
@@ -107,6 +110,18 @@ def main():
107110
{"role": "user", "content": history},
108111
]
109112

113+
# Get LLM model from profile
114+
default_profile_path = os.path.join(
115+
platformdirs.user_config_dir("open-interpreter"), "profiles", "default.yaml"
116+
)
117+
118+
try:
119+
with open(default_profile_path, "r") as file:
120+
profile = yaml.safe_load(file)
121+
model = profile.get("llm", {}).get("model", "gpt-3.5-turbo")
122+
except:
123+
model = "gpt-3.5-turbo"
124+
110125
# Process LLM response
111126
in_code = False
112127
backtick_count = 0
@@ -115,7 +130,7 @@ def main():
115130
started = False
116131

117132
for chunk in litellm.completion(
118-
model="gpt-3.5-turbo", messages=messages, temperature=0, stream=True
133+
model=model, messages=messages, temperature=0, stream=True
119134
):
120135
if not started:
121136
started = True

0 commit comments

Comments
 (0)