Wendong-Fan commited on
Commit
c635c67
1 Parent(s): 60eae5d

Update apps/agents/agents.py

Browse files
Files changed (1) hide show
  1. apps/agents/agents.py +6 -7
apps/agents/agents.py CHANGED
@@ -24,14 +24,14 @@ from typing import Any, Dict, List, Optional, Tuple, Union
24
 
25
  import gradio as gr
26
  import openai
27
- import openai.error
28
  import tenacity
29
 
30
  from apps.agents.text_utils import split_markdown_code
31
  from camel.agents import TaskSpecifyAgent
32
  from camel.messages import BaseMessage
33
  from camel.societies import RolePlaying
34
- from camel.typing import TaskType
35
 
36
  REPO_ROOT = os.path.realpath(
37
  os.path.join(os.path.dirname(os.path.abspath(__file__)), "../.."))
@@ -246,8 +246,8 @@ def role_playing_chat_init(state) -> \
246
 
247
  try:
248
  init_assistant_msg: BaseMessage
249
- init_assistant_msg, _ = session.init_chat()
250
- except (openai.error.RateLimitError, tenacity.RetryError,
251
  RuntimeError) as ex:
252
  print("OpenAI API exception 1 " + str(ex))
253
  state.session = None
@@ -289,7 +289,7 @@ def role_playing_chat_cont(state) -> \
289
  try:
290
  assistant_response, user_response = session.step(
291
  state.saved_assistant_msg)
292
- except (openai.error.RateLimitError, tenacity.RetryError,
293
  RuntimeError) as ex:
294
  print("OpenAI API exception 2 " + str(ex))
295
  state.session = None
@@ -416,8 +416,7 @@ def construct_ui(blocks, api_key: Optional[str] = None) -> None:
416
  "Github repo: [https://github.com/lightaime/camel]"
417
  "(https://github.com/lightaime/camel)"
418
  '<div style="display:flex; justify-content:center;">'
419
- '<img src="https://raw.githubusercontent.com/lightaime/camel/'
420
- 'master/misc/logo.png" alt="Logo" style="max-width:50%;">'
421
  '</div>')
422
  with gr.Row():
423
  with gr.Column(scale=9):
 
24
 
25
  import gradio as gr
26
  import openai
27
+
28
  import tenacity
29
 
30
  from apps.agents.text_utils import split_markdown_code
31
  from camel.agents import TaskSpecifyAgent
32
  from camel.messages import BaseMessage
33
  from camel.societies import RolePlaying
34
+ from camel.types import TaskType
35
 
36
  REPO_ROOT = os.path.realpath(
37
  os.path.join(os.path.dirname(os.path.abspath(__file__)), "../.."))
 
246
 
247
  try:
248
  init_assistant_msg: BaseMessage
249
+ init_assistant_msg = session.init_chat()
250
+ except (openai.RateLimitError, tenacity.RetryError,
251
  RuntimeError) as ex:
252
  print("OpenAI API exception 1 " + str(ex))
253
  state.session = None
 
289
  try:
290
  assistant_response, user_response = session.step(
291
  state.saved_assistant_msg)
292
+ except (openai.RateLimitError, tenacity.RetryError,
293
  RuntimeError) as ex:
294
  print("OpenAI API exception 2 " + str(ex))
295
  state.session = None
 
416
  "Github repo: [https://github.com/lightaime/camel]"
417
  "(https://github.com/lightaime/camel)"
418
  '<div style="display:flex; justify-content:center;">'
419
+ '<img src="https://raw.githubusercontent.com/camel-ai/camel/master/misc/primary_logo.png" alt="Logo" style="max-width:50%;">'
 
420
  '</div>')
421
  with gr.Row():
422
  with gr.Column(scale=9):