Mahinour1 commited on
Commit
c084ff7
·
1 Parent(s): a2a0d04

disable websocket2

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -0
  2. app.py +7 -1
Dockerfile CHANGED
@@ -56,6 +56,9 @@ RUN mkdir -p /home/user/app/.files && \
56
  mkdir -p /home/user/.local && \
57
  chown -R user:user /home/user
58
 
 
 
 
59
  RUN pip install pydantic==2.10.1 chainlit
60
 
61
  COPY chainlit.md .
 
56
  mkdir -p /home/user/.local && \
57
  chown -R user:user /home/user
58
 
59
+ RUN chown -R user:user /home/user && \
60
+ chmod -R 755 /home/user/app
61
+
62
  RUN pip install pydantic==2.10.1 chainlit
63
 
64
  COPY chainlit.md .
app.py CHANGED
@@ -39,7 +39,11 @@ from tools import search_pypi, write_to_docx
39
  from prompts import describe_imports, main_prompt, documenter_prompt
40
  from states import AgentState
41
 
42
- os.environ["CHAINLIT_DISABLE_WEBSOCKETS"] = "true"
 
 
 
 
43
 
44
 
45
  # Global variables to store processed data
@@ -51,6 +55,8 @@ qdrant_client = None
51
 
52
  @cl.on_chat_start
53
  async def on_chat_start():
 
 
54
  await cl.Message(content="Welcome to the Python Code Documentation Assistant! Please upload a Python file to get started.").send()
55
 
56
  @cl.on_message
 
39
  from prompts import describe_imports, main_prompt, documenter_prompt
40
  from states import AgentState
41
 
42
+ if os.environ.get("SPACE_ID"): # Check if running on HF Spaces
43
+ os.environ["CHAINLIT_DISABLE_WEBSOCKETS"] = "true"
44
+ # Also consider setting these for HF Spaces
45
+ os.environ["CHAINLIT_SERVER_PORT"] = "7860"
46
+ os.environ["CHAINLIT_SERVER_HOST"] = "0.0.0.0"
47
 
48
 
49
  # Global variables to store processed data
 
55
 
56
  @cl.on_chat_start
57
  async def on_chat_start():
58
+ print("Chat session started")
59
+
60
  await cl.Message(content="Welcome to the Python Code Documentation Assistant! Please upload a Python file to get started.").send()
61
 
62
  @cl.on_message