Skip to content

Commit

Permalink
Merge branch 'main' into fix-conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
bishoy-at-pieces authored Nov 11, 2024
2 parents bb380ee + 4626893 commit 3df3dfc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/pieces/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def run(self):

config = ConfigCommands.load_config()

if config.get("skip_onboarding",False) or not Settings.pieces_client.application.onboarded:
if not config.get("skip_onboarding", False) and not Settings.pieces_client.application.onboarded:
res = input("It looks like this is your first time using the Pieces CLI.\nWould you like to start onboarding (y/n/skip)? ")
if res.lower() == "y":
return onboarding_command()
Expand Down
7 changes: 5 additions & 2 deletions src/pieces/copilot/conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ def conversation_handler(**kwargs):
return
else:
if idx:
chat = Settings.pieces_client.copilot.chats()[idx]
try:
chat = Settings.pieces_client.copilot.chats()[idx-1]
except IndexError:
Settings.show_error("Error in conversation index","Please enter a valid conversation index.")
else:
chat = Settings.pieces_client.copilot.chat

Expand Down Expand Up @@ -63,7 +66,7 @@ def conversation_handler(**kwargs):
# Show error if no conversation in the ask show error
Settings.show_error("The conversation is empty","Please enter a conversation index, or use the ask command to ask a question.")
else:
get_conversation_messages(idx)
get_conversation_messages(idx - 1)

def get_conversations(max_conversations,**kwargs):
"""This function is used to print all conversations available"""
Expand Down
8 changes: 7 additions & 1 deletion src/pieces/wrapper/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,19 @@ def model_name(self):
return self._model_name
return "GPT-3.5-turbo Chat Model"

@property
def model_id(self):
if hasattr(self,"_model_id"):
return self._model_id
return self.get_models()[self.model_name]

@model_name.setter
def model_name(self,model):
models = self.get_models()
if model not in models:
raise ValueError(f"Not a vaild model name, the available models are {', '.join(models.keys())}")
self._model_name = model
self.model_id = models[model]
self._model_id = models[model]

@property
def available_models_names(self) -> list:
Expand Down

0 comments on commit 3df3dfc

Please sign in to comment.