Problem running the code at start
Hi, I just finished implementing something very similar to your code using fastapi and websocket https://gist.github.com/bonadio/2d548a493907c133bc10de806ecd08af
But your code seems better related to the way you handle the threads. I am trying to test it but found a few problems: 1- When I try to install after a did git clone
(base) -> pdm install
All packages are synced to date, nothing to do.
Installing the project as an editable package...
✖ Install agentsflow 0.1.1 failed
See /var/folders/r6/jgl8b48s325fbkg5jwkg93fc0000gn/T/pdm-install-xk70t_x8.log for detailed debug
log.
[BuildError]: Build backend raised error: Showing the last 10 lines of the build output:
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
To find more information, look for "package discovery" on setuptools docs.
Add '-v' to see the detailed traceback
2- It is missing the "static" directory, I created manually and was able to start
3- When I try to run "npm run dev" on the frontend_src I get Server Error Error: Cannot find module 'react'
Thanks for checking it out
I'll be working on updating the README and installation instructions for the frontend_src.
1. Error Resolution I'm currently uncertain about this error. However, I've assigned the task to @TomExMachina, who will assist in resolving it.
2. Fixing Issues 2 and 3
- Run
npm installorpnpm installwithin thefrontend_srcdirectory. - After the installation, execute
npm buildorpnpm buildin the same directory. This will generate the necessary static files in the root directory.
Once these steps are completed, you can initiate the server by running in the root the command pdm run uvicorn server:app --port 8999 and then access the application in your browser via http://127.0.0.1:8999.
Starting the dev server If you want to make changes to the frontend you need to:
- run
pdm run uvicorn server:app --port 8999 - navigate to
frontend_src - run
npm installorpnpm install - run
npm devorpnpm dev.
Now you can open http://localhost:3000
Hi @jaemil Thanks for the response, but I am still unable to start de frontend
I removed the node_modules and did
/Users/viewitpro/projetos/agentsflow/frontend_src (base) -> npm install
added 459 packages, and audited 460 packages in 11s
119 packages are looking for funding
run npm fund for details
found 0 vulnerabilities
/Users/viewitpro/projetos/agentsflow/frontend_src (base) -> npm run build
[email protected] build next build
✓ Creating an optimized production build
✓ Compiled successfully
./app/page.tsx 47:6 Warning: React Hook useEffect has a missing dependency: 'addMessage'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
./components/dashboard/flow/flow.tsx 52:5 Warning: React Hook useCallback has a missing dependency: 'setEdges'. Either include it or remove the dependency array. react-hooks/exhaustive-deps 97:5 Warning: React Hook useCallback has a missing dependency: 'setNodes'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules Linting and checking validity of types .Failed to compile.
../static/types/app/layout.ts:3:40 Type error: Cannot find module 'next/dist/lib/metadata/types/metadata-interface.js' or its corresponding type declarations.
1 | // File: /Users/viewitpro/projetos/agentsflow/frontend_src/app/layout.tsx 2 | import * as entry from '../../../frontend_src/app/layout.js'
3 | import type { ResolvingMetadata } from 'next/dist/lib/metadata/types/metadata-interface.js' | ^ 4 | 5 | type TEntry = typeof import('../../../frontend_src/app/layout.js') 6 |
I tried npm run dev, but when I accessed the the web http://localhost:3000 I got
Server Error Error: Cannot find module 'react' Require stack:
- /Users/viewitpro/projetos/agentsflow/static/server/pages/_document.js
- /Users/viewitpro/projetos/agentsflow/frontend_src/node_modules/next/dist/server/require.js
- /Users/viewitpro/projetos/agentsflow/frontend_src/node_modules/next/dist/server/load-components.js
- /Users/viewitpro/projetos/agentsflow/frontend_src/node_modules/next/dist/build/utils.js
- /Users/viewitpro/projetos/agentsflow/frontend_src/node_modules/next/dist/server/dev/hot-middleware.js
- /Users/viewitpro/projetos/agentsflow/frontend_src/node_modules/next/dist/server/dev/hot-reloader-webpack.js
- /Users/viewitpro/projetos/agentsflow/frontend_src/node_modules/next/dist/server/lib/router-utils/setup-dev.js
- /Users/viewitpro/projetos/agentsflow/frontend_src/node_modules/next/dist/server/lib/router-server.js
- /Users/viewitpro/projetos/agentsflow/frontend_src/node_modules/next/dist/server/lib/start-server.js
This error happened while generating the page. Any console logs will be displayed in the terminal window.
Can you try removing all files in the static folder? And then again npm run build.
Should be fixed by https://github.com/jaemil/agentsflow/commit/0889bdcf823c51ee91dbc54bfde8c6192539f8fc which was confirmed on Linux and Windows and merged to main.
@bonadio please start over, and follow new instructions in README.md
Hi @TomExMachina I just cloned the dev branch and everything worked and the UI and server started ok
I went to the browser the UI openned I set my openai key selected the model saved I click on the Agent(0) click "start agent" click chat "say hello" but nothing happens
the console has this message
(base) -> pdm run start_server.py INFO: Started server process [26635] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8999 (Press CTRL+C to quit) INFO: 127.0.0.1:52552 - "GET / HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52553 - "GET /_next/static/css/84c09d24446a35e0.css HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52552 - "GET /_next/static/media/c9a5bc6a7c948fb0-s.p.woff2 HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52554 - "GET /_next/static/css/b4846eed11c4725f.css HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52555 - "GET /_next/static/chunks/main-app-4bb3535908368d6f.js HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52552 - "GET /_next/static/chunks/864-a9a87b8b8d0d21e6.js HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52554 - "GET /_next/static/chunks/webpack-6f8666272ffa1d1b.js HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52553 - "GET /_next/static/chunks/fd9d1056-499dce1bc445b6af.js HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52553 - "GET /_next/static/chunks/110-e35e9bc3c52a435d.js HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52554 - "GET /_next/static/chunks/app/layout-5292683cbc385dfa.js HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52553 - "GET /_next/static/chunks/c37d3baf-480f9204f6606407.js HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52552 - "GET /_next/static/chunks/559-78a5facdbe4169a7.js HTTP/1.1" 304 Not Modified INFO: 127.0.0.1:52555 - "GET /_next/static/chunks/app/page-2bb19e61138f168b.js HTTP/1.1" 304 Not Modified INFO: ('127.0.0.1', 52557) - "WebSocket /ws" [accepted] INFO: connection open INFO: 127.0.0.1:52555 - "GET /images/agent.svg HTTP/1.1" 304 Not Modified User (to assistant):
what is your purpose
[autogen.oai.completion: 10-11 22:05:29] {774} WARNING - Completion was provided with a config_list, but the list was empty. Adopting default OpenAI behavior, which reads from the 'model' parameter instead.
Looks like you have not added an OPENAPI key to your environment.
You can also import/add the key manually by adding an .env file to apps/api containing the following: OPENAI_API_KEY="sk-..."