66 | );
67 | }
68 |
--------------------------------------------------------------------------------
/autogen-ui/autogenui/manager.py:
--------------------------------------------------------------------------------
1 | # a manager class that can
2 | # load an autogen flow run an autogen flow and return the response to the client
3 |
4 |
5 | from typing import Dict
6 | import autogen
7 | from .utils import parse_token_usage
8 | import time
9 |
10 |
11 | class Manager(object):
12 | def __init__(self) -> None:
13 |
14 | pass
15 |
16 | def run_flow(self, prompt: str, flow: str = "default") -> None:
17 | #autogen.ChatCompletion.start_logging(compact=False)
18 | config_list = autogen.config_list_openai_aoai()
19 |
20 | llm_config = {
21 | "seed": 42, # seed for caching and reproducibility
22 | "config_list": config_list, # a list of OpenAI API configurations
23 | "temperature": 0, # temperature for sampling
24 | }
25 |
26 | assistant = autogen.AssistantAgent(
27 | name="assistant",
28 | max_consecutive_auto_reply=3, llm_config=llm_config,)
29 |
30 | # create a UserProxyAgent instance named "user_proxy"
31 | user_proxy = autogen.UserProxyAgent(
32 | name="user_proxy",
33 | human_input_mode="NEVER",
34 | llm_config=llm_config,
35 | max_consecutive_auto_reply=3,
36 | is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"),
37 | code_execution_config={
38 | "work_dir": "scratch/coding",
39 | "use_docker": False
40 | },
41 | )
42 | start_time = time.time()
43 | user_proxy.initiate_chat(
44 | assistant,
45 | message=prompt,
46 | )
47 |
48 | messages = user_proxy.chat_messages[assistant]
49 | #logged_history = autogen.ChatCompletion.logged_history
50 | autogen.ChatCompletion.stop_logging()
51 | response = {
52 | "messages": messages[1:],
53 | "usage": "", #parse_token_usage(logged_history),
54 | "duration": time.time() - start_time,
55 | }
56 | return response
57 |
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/app.py:
--------------------------------------------------------------------------------
1 | import logging
2 | from typing import Dict
3 | from ..datamodel import GenerateWebRequest
4 | from fastapi import FastAPI
5 | from fastapi.staticfiles import StaticFiles
6 | import os
7 | from fastapi.middleware.cors import CORSMiddleware
8 | import os
9 |
10 | from ..manager import Manager
11 | import traceback
12 |
13 | logger = logging.getLogger("autogenui")
14 |
15 |
16 | app = FastAPI()
17 | # allow cross origin requests for testing on localhost: 800 * ports only
18 | app.add_middleware(
19 | CORSMiddleware,
20 | allow_origins=["http://localhost:8000", "http://localhost:8001", "http://localhost:3000"],
21 | allow_credentials=True,
22 | allow_methods=["*"],
23 | allow_headers=["*"],
24 | )
25 |
26 | api = FastAPI(root_path="/api")
27 | app.mount("/api", api)
28 |
29 |
30 | root_file_path = os.path.dirname(os.path.abspath(__file__))
31 | files_static_root = os.path.join(root_file_path, "files/")
32 | static_folder_root = os.path.join(root_file_path, "ui")
33 |
34 |
35 | os.makedirs(files_static_root, exist_ok=True)
36 | api.mount("/files", StaticFiles(directory=files_static_root, html=True), name="files")
37 |
38 |
39 | app.mount("/", StaticFiles(directory=static_folder_root, html=True), name="ui")
40 |
41 |
42 | manager = Manager()
43 |
44 |
45 | @api.post("/generate")
46 | async def generate(req: GenerateWebRequest) -> Dict:
47 | """Generate a response from the autogen flow"""
48 | prompt = req.prompt
49 | history = req.history or ""
50 |
51 | prompt = f"{history}\n\n{prompt}"
52 | print("******history******", history)
53 |
54 | try:
55 | agent_response = manager.run_flow(prompt=prompt)
56 | response = {
57 | "data": agent_response,
58 | "status": True
59 | }
60 | except Exception as e:
61 | traceback.print_exc()
62 | response = {
63 | "data": str(e),
64 | "status": False
65 | }
66 |
67 | return response
68 |
69 |
70 | @api.post("/hello")
71 | async def hello() -> None:
72 | return "hello world"
73 |
--------------------------------------------------------------------------------
/autogen-ui/autogenui/flow.py:
--------------------------------------------------------------------------------
1 | from dataclasses import asdict
2 | import autogen
3 |
4 | from typing import Union, List
5 | import autogen
6 | from autogenui.datamodel import AgentFlowSpec, AgentConfig
7 |
8 |
9 | class Flow:
10 | """
11 | A class to represent a flow involving a sender and a receiver or multiple receivers.
12 |
13 | Attributes:
14 | sender (AgentConfig): The sender agent configuration.
15 | receiver (Union[AgentConfig, List[AgentConfig]]): The receiver agent configuration or list of configurations.
16 | """
17 |
18 | def __init__(self, sender: AgentConfig,
19 | receiver: Union[AgentConfig, List[AgentConfig]]) -> None:
20 | """
21 | Constructs a Flow object with the given sender and receiver configurations.
22 |
23 | Args:
24 | sender (AgentConfig): The sender agent configuration.
25 | receiver (Union[AgentConfig, List[AgentConfig]]): The receiver agent configuration or list of configurations.
26 | """
27 | self.sender = self.load_agent(sender)
28 | self.receiver = self.load_agent(receiver)
29 |
30 | def load_agent(
31 | self, agent_spec: AgentFlowSpec) -> Union[autogen.AssistantAgent, autogen.UserProxyAgent]:
32 | """
33 | Loads the appropriate agent instance based on the given agent specification.
34 |
35 | Args:
36 | agent_spec (AgentFlowSpec): The specification of the agent to be loaded.
37 |
38 | Returns:
39 | Union[autogen.AssistantAgent, autogen.UserProxyAgent]: The appropriate instance of the agent based on the agent type.
40 | """
41 | if agent_spec.type == "assistant":
42 | agent = autogen.AssistantAgent(**asdict(agent_spec.config))
43 | if agent_spec.type == "userproxy":
44 | agent = autogen.UserProxyAgent(**asdict(agent_spec.config))
45 |
46 | return agent
47 |
48 | def run(self, message: str) -> None:
49 | """
50 | Initiates the chat flow by sending the given message from the sender to the receiver(s).
51 |
52 | Args:
53 | message (str): The message to be sent.
54 | """
55 | self.sender.initiate_chat(self.receiver,
56 | message=message
57 | )
58 |
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/ui/_next/static/chunks/app/playground/page-99e96a15b24b92e3.js:
--------------------------------------------------------------------------------
1 | (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[383],{75552:function(e,s,a){Promise.resolve().then(a.bind(a,24e3))},24e3:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return PlaygroundPage},dynamic:function(){return u}});var n=a(57437),t=a(71340),l=a(2265),i=a(46816),o=a(91611),r=a(23774),c=a(80105);a(99176);var d=a(43574);let x={agent:function(e){let{data:s,isConnectable:a}=e;return(0,l.useCallback)(e=>{console.log(e.target.value)},[]),(0,n.jsxs)("div",{className:"font-light border-green text-md border rounded bg-white",children:[(0,n.jsx)(i.HH,{type:"target",position:i.Ly.Top,isConnectable:a}),(0,n.jsx)("div",{className:"p-2 capitalize border-b",children:(0,n.jsxs)("span",{className:"capitalize",children:[" ",s.label||"Agent"]})}),(0,n.jsx)("div",{className:"p-2 ",children:(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)("label",{className:"mr-2",htmlFor:"name",children:"Name"}),(0,n.jsx)(d.Z,{className:"inline-block nodrag",placeholder:"Basic usage"})]})}),(0,n.jsx)(i.HH,{type:"source",position:i.Ly.Bottom,id:"b",isConnectable:a})]})},chat:function(e){let{data:s,isConnectable:a}=e;return(0,l.useCallback)(e=>{console.log(e.target.value)},[]),(0,n.jsxs)("div",{style:{minHeight:"300px"},className:"font-light border-green text-md border rounded bg-white",children:[(0,n.jsx)(i.HH,{type:"target",position:i.Ly.Left,isConnectable:a}),(0,n.jsx)(i.HH,{type:"target",position:i.Ly.Top,isConnectable:a}),(0,n.jsx)("div",{className:"p-2 capitalize border-b",children:(0,n.jsxs)("span",{className:"capitalize",children:[" ",s.label||"Agent"]})}),(0,n.jsx)("div",{className:"p-2 ",children:(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)("label",{className:"mr-2",htmlFor:"name",children:"Name"}),(0,n.jsx)(d.Z,{className:"inline-block nodrag",placeholder:"Basic usage"})]})}),(0,n.jsx)(i.HH,{type:"source",position:i.Ly.Bottom,id:"b",isConnectable:a})]})}};function FlowView(){let[e,s,a]=(0,i.Rr)([{id:"1",position:{x:0,y:0},data:{label:"User Proxy"},type:"agent"},{id:"3",position:{x:300,y:130},data:{label:"Assistant"},type:"agent"},{id:"4",position:{x:700,y:130},data:{label:"Output"},type:"chat"}]),[t,d,u]=(0,i.ll)([{id:"e1-3",source:"1",target:"3"}]),h=(0,l.useCallback)(e=>d(s=>(0,i.Z_)(e,s)),[d]);return(0,n.jsx)("div",{className:"border rounded p-2",children:(0,n.jsx)("div",{style:{width:"100%",height:"calc(100vh - 180px"},children:(0,n.jsxs)(i.x$,{nodes:e,edges:t,onNodesChange:a,onEdgesChange:u,onConnect:h,nodeTypes:x,children:[(0,n.jsx)(o.Z,{}),(0,n.jsx)(r.a,{}),(0,n.jsx)(c.A,{variant:c.T.Dots,gap:12,size:1})]})})})}let u="force-static";function PlaygroundPage(){return(0,n.jsxs)("div",{className:"text-md ",children:[(0,n.jsx)(t.Z,{className:"mb-2",children:"Playground"}),(0,n.jsx)("div",{children:(0,n.jsx)(FlowView,{})})]})}}},function(e){e.O(0,[780,900,980,971,472,744],function(){return e(e.s=75552)}),_N_E=e.O()}]);
--------------------------------------------------------------------------------
/autogen-ui/frontend/src/app/page.tsx:
--------------------------------------------------------------------------------
1 | import ChatBoxView from "@/components/chat/chatview";
2 | import { IChatMessage } from "@/components/types";
3 | import React from "react";
4 | // import { queryBuilder } from '../lib/planetscale';
5 | // import Search from './search';
6 | // import UsersTable from './table';
7 |
8 | export const dynamic = "force-static";
9 |
10 | export default async function IndexPage() {
11 | const sampleMessages: IChatMessage[] = [
12 | {
13 | text: "what is the height of the eiffel tower",
14 | sender: "user",
15 | },
16 | {
17 | text: "The Eiffel Tower is approximately 330 meters (1,083 feet) tall. \n\nTERMINATE",
18 | sender: "bot",
19 | metadata: [
20 | {
21 | content:
22 | "The Eiffel Tower is approximately 330 meters (1,083 feet) tall. \n\nTERMINATE",
23 | role: "user",
24 | },
25 | ],
26 | },
27 | {
28 | text: "what is the components of the atmospher",
29 | sender: "user",
30 | },
31 | {
32 | text: "The atmosphere is primarily composed of nitrogen (78%) and oxygen (21%). The remaining 1% consists of argon, carbon dioxide, and trace amounts of other gases such as neon, helium, methane, krypton, and hydrogen, as well as water vapor.\n\nTERMINATE",
33 | sender: "bot",
34 | metadata: [
35 | {
36 | content:
37 | "The atmosphere is primarily composed of nitrogen (78%) and oxygen (21%). The remaining 1% consists of argon, carbon dioxide, and trace amounts of other gases such as neon, helium, methane, krypton, and hydrogen, as well as water vapor.\n\nTERMINATE",
38 | role: "user",
39 | },
40 | {
41 | content:
42 | "The atmosphere is primarily composed of nitrogen (78%) and oxygen (21%). The remaining 1% consists of argon, carbon dioxide, and trace amounts of other gases such as neon, helium, methane, krypton, and hydrogen, as well as water vapor.\n\nTERMINATE",
43 | role: "user",
44 | },
45 | {
46 | content:
47 | "The atmosphere is primarily composed of nitrogen (78%) and oxygen (21%). The remaining 1% consists of argon, carbon dioxide, and trace amounts of other gases such as neon, helium, methane, krypton, and hydrogen, as well as water vapor.\n\nTERMINATE",
48 | role: "user",
49 | },
50 | {
51 | content:
52 | "The atmosphere is primarily composed of nitrogen (78%) and oxygen (21%). The remaining 1% consists of argon, carbon dioxide, and trace amounts of other gases such as neon, helium, methane, krypton, and hydrogen, as well as water vapor.\n\nTERMINATE",
53 | role: "user",
54 | },
55 | ],
56 | },
57 | ];
58 |
59 | return (
60 |
61 |
AutoGen Agent Chat
62 |
63 |
64 |
65 | );
66 | }
67 |
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/ui/index.txt:
--------------------------------------------------------------------------------
1 | 1:HL["/_next/static/css/33645606b33eb2d3.css","style",{"crossOrigin":""}]
2 | 0:["B9KwUOa9BD1Ep-rZJrUU9",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/33645606b33eb2d3.css","precedence":"next","crossOrigin":""}]],"$L3"]]]]
3 | 2:[null,"$L4",null]
4 | 3:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"AutoGen UI"}],["$","meta","2",{"name":"description","content":"AutoGen UI is a web-based interface for building AutoGen agents."}],["$","meta","3",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
5 | 5:"$Sreact.suspense"
6 | 7:I[56954,[],""]
7 | 8:I[7264,[],""]
8 | 4:["$","html",null,{"lang":"en","className":"h-full bg-gray-50 light","children":["$","body",null,{"className":"h-full ","children":[["$","$5",null,{"children":"$L6"}],["$","div",null,{"style":{"height":"calc(100vh - 64px)"},"className":"p-4 md:p-10 mx-auto max-w-7xl","children":["$","$L7",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$L8",null,{}],"templateStyles":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$L9","$La",null],"segment":"__PAGE__"},"styles":[]}]}]]}]}]
9 | b:I[70730,["300","static/chunks/300-c1afed695231dd49.js","185","static/chunks/app/layout-b1fa3f4e008e91f7.js"],""]
10 | c:I[52004,["900","static/chunks/900-4a297f6319ba0e81.js","689","static/chunks/689-fb905c9362567d48.js","931","static/chunks/app/page-92690039f531a3b5.js"],""]
11 | 6:["$","$Lb",null,{"user":""}]
12 | a:["$","main",null,{"className":" h-full","children":[["$","div",null,{"className":"mb-4","children":"AutoGen Agent Chat "}],["$","$Lc",null,{"initMessages":[]}]]}]
13 | 9:null
14 |
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/ui/playground.txt:
--------------------------------------------------------------------------------
1 | 1:HL["/_next/static/css/33645606b33eb2d3.css","style",{"crossOrigin":""}]
2 | 0:["B9KwUOa9BD1Ep-rZJrUU9",[[["",{"children":["playground",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L2",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/33645606b33eb2d3.css","precedence":"next","crossOrigin":""}]],"$L3"]]]]
3 | 4:HL["/_next/static/css/b4846eed11c4725f.css","style",{"crossOrigin":""}]
4 | 2:[null,"$L5",null]
5 | 3:[["$","meta","0",{"charSet":"utf-8"}],["$","title","1",{"children":"AutoGen UI"}],["$","meta","2",{"name":"description","content":"AutoGen UI is a web-based interface for building AutoGen agents."}],["$","meta","3",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
6 | 6:"$Sreact.suspense"
7 | 8:I[56954,[],""]
8 | 9:I[7264,[],""]
9 | b:I[48297,[],""]
10 | c:I[24000,["780","static/chunks/c37d3baf-51f830ddfae193ff.js","900","static/chunks/900-4a297f6319ba0e81.js","980","static/chunks/980-d995cbebfdb04c27.js","383","static/chunks/app/playground/page-99e96a15b24b92e3.js"],""]
11 | 5:["$","html",null,{"lang":"en","className":"h-full bg-gray-50 light","children":["$","body",null,{"className":"h-full ","children":[["$","$6",null,{"children":"$L7"}],["$","div",null,{"style":{"height":"calc(100vh - 64px)"},"className":"p-4 md:p-10 mx-auto max-w-7xl","children":["$","$L8",null,{"parallelRouterKey":"children","segmentPath":["children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$L9",null,{}],"templateStyles":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[],"childProp":{"current":["$","$L8",null,{"parallelRouterKey":"children","segmentPath":["children","playground","children"],"loading":"$undefined","loadingStyles":"$undefined","hasLoading":false,"error":"$undefined","errorStyles":"$undefined","template":["$","$L9",null,{}],"templateStyles":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","childProp":{"current":["$La",["$","$Lb",null,{"propsForComponent":{"params":{}},"Component":"$c","isStaticGeneration":true}],null],"segment":"__PAGE__"},"styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/b4846eed11c4725f.css","precedence":"next","crossOrigin":""}]]}],"segment":"playground"},"styles":[]}]}]]}]}]
12 | d:I[70730,["300","static/chunks/300-c1afed695231dd49.js","185","static/chunks/app/layout-b1fa3f4e008e91f7.js"],""]
13 | 7:["$","$Ld",null,{"user":""}]
14 | a:null
15 |
--------------------------------------------------------------------------------
/AutoGen_IterativeCoding/AndyTools.py:
--------------------------------------------------------------------------------
1 | from autogen import GroupChatManager, GroupChat
2 | from dataclasses import dataclass
3 | import sys
4 | from typing import Dict, List, Optional, Union
5 | from autogen import Agent
6 | from autogen import ConversableAgent
7 |
8 |
9 | # make the selector which selects the speaker the Judge every time
10 | class ManualManager(GroupChatManager):
11 | def run_andy_chat(
12 | self,
13 | messages: Optional[List[Dict]] = None,
14 | sender: Optional[Agent] = None,
15 | config: Optional[GroupChat] = None,
16 | ) -> Union[str, Dict, None]:
17 |
18 | """Run a group chat."""
19 | if messages is None:
20 | messages = self._oai_messages[sender]
21 | message = messages[-1]
22 | speaker = sender
23 | groupchat = config
24 | for i in range(groupchat.max_round):
25 | # set the name to speaker's name if the role is not function
26 | if message["role"] != "function":
27 | message["name"] = speaker.name
28 | groupchat.messages.append(message)
29 | # broadcast the message to all agents except the speaker
30 | for agent in groupchat.agents:
31 | if agent != speaker:
32 | self.send(message, agent, request_reply=False, silent=True)
33 | if i == groupchat.max_round - 1:
34 | # the last round
35 | break
36 | try:
37 | # select the next speaker
38 | speaker = groupchat.select_speaker(speaker, self, groupchat.agent_by_name("Manager"))
39 | # let the speaker speak
40 | reply = speaker.generate_reply(sender=self)
41 | except KeyboardInterrupt:
42 | # let the admin agent speak if interrupted
43 | if groupchat.admin_name in groupchat.agent_names:
44 | # admin agent is one of the participants
45 | speaker = groupchat.agent_by_name(groupchat.admin_name)
46 | reply = speaker.generate_reply(sender=self)
47 | else:
48 | # admin agent is not found in the participants
49 | raise
50 | if reply is None:
51 | break
52 | # The speaker sends the message without requesting a reply
53 | speaker.send(reply, self, request_reply=False)
54 | message = self.last_message(speaker)
55 | return True, None
56 |
57 |
58 | # Make the select_speaker call handle Andy the Judge making the call opposed to an openAI call
59 | class ManualGroupChat(GroupChat):
60 | def select_speaker(self, last_speaker: Agent, selector: ConversableAgent):
61 | """Select the next speaker."""
62 | # selector.update_system_message(self.select_speaker_msg())
63 | # final, name = selector.generate_oai_reply(
64 | # self.messages
65 | # + [
66 | # {
67 | # "role": "system",
68 | # "content": f"Read the above conversation. Then select the next role from {self.agent_names} to play. Only return the role.",
69 | # }
70 | # ]
71 | # )
72 |
73 | final = True
74 | name = input("Who speaks next:")
75 |
76 | if not final:
77 | # i = self._random.randint(0, len(self._agent_names) - 1) # randomly pick an id
78 | return self.next_agent(last_speaker)
79 | try:
80 | return self.agent_by_name(name)
81 | except ValueError:
82 | return self.next_agent(last_speaker)
--------------------------------------------------------------------------------
/autogen-ui/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 | .release.sh
6 | settings.json
7 | notebooks/*
8 | .env.*
9 | testapp/*
10 |
11 | # C extensions
12 | *.so
13 |
14 | scratch
15 | coding
16 |
17 | # Distribution / packaging
18 | .Python
19 | build/
20 | develop-eggs/
21 | dist/
22 | downloads/
23 | eggs/
24 | .eggs/
25 | lib/
26 | lib64/
27 | parts/
28 | sdist/
29 | var/
30 | wheels/
31 | share/python-wheels/
32 | *.egg-info/
33 | .installed.cfg
34 | *.egg
35 | MANIFEST
36 |
37 | # PyInstaller
38 | # Usually these files are written by a python script from a template
39 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
40 | *.manifest
41 | *.spec
42 |
43 | # Installer logs
44 | pip-log.txt
45 | pip-delete-this-directory.txt
46 |
47 | # Unit test / coverage reports
48 | htmlcov/
49 | .tox/
50 | .nox/
51 | .coverage
52 | .coverage.*
53 | .cache
54 | nosetests.xml
55 | coverage.xml
56 | *.cover
57 | *.py,cover
58 | .hypothesis/
59 | .pytest_cache/
60 | cover/
61 |
62 | # Translations
63 | *.mo
64 | *.pot
65 |
66 | # Django stuff:
67 | *.log
68 | local_settings.py
69 | db.sqlite3
70 | db.sqlite3-journal
71 |
72 | # Flask stuff:
73 | instance/
74 | .webassets-cache
75 |
76 | # Scrapy stuff:
77 | .scrapy
78 |
79 | # Sphinx documentation
80 | docs/_build/
81 |
82 | # PyBuilder
83 | .pybuilder/
84 | target/
85 |
86 | # Jupyter Notebook
87 | .ipynb_checkpoints
88 |
89 | # IPython
90 | profile_default/
91 | ipython_config.py
92 |
93 | # pyenv
94 | # For a library or package, you might want to ignore these files since the code is
95 | # intended to run in multiple environments; otherwise, check them in:
96 | # .python-version
97 |
98 | # pipenv
99 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
100 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
101 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
102 | # install all needed dependencies.
103 | #Pipfile.lock
104 |
105 | # poetry
106 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
107 | # This is especially recommended for binary packages to ensure reproducibility, and is more
108 | # commonly ignored for libraries.
109 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
110 | #poetry.lock
111 |
112 | # pdm
113 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114 | #pdm.lock
115 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
116 | # in version control.
117 | # https://pdm.fming.dev/#use-with-ide
118 | .pdm.toml
119 |
120 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121 | __pypackages__/
122 |
123 | # Celery stuff
124 | celerybeat-schedule
125 | celerybeat.pid
126 |
127 | # SageMath parsed files
128 | *.sage.py
129 |
130 | # Environments
131 | .env
132 | .venv
133 | env/
134 | venv/
135 | ENV/
136 | env.bak/
137 | venv.bak/
138 |
139 | # Spyder project settings
140 | .spyderproject
141 | .spyproject
142 |
143 | # Rope project settings
144 | .ropeproject
145 |
146 | # mkdocs documentation
147 | /site
148 |
149 | # mypy
150 | .mypy_cache/
151 | .dmypy.json
152 | dmypy.json
153 |
154 | # Pyre type checker
155 | .pyre/
156 |
157 | # pytype static type analyzer
158 | .pytype/
159 |
160 | # Cython debug symbols
161 | cython_debug/
162 |
163 | # PyCharm
164 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166 | # and can be added to the global gitignore or merged into this file. For a more nuclear
167 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168 | #.idea/
169 |
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/ui/_next/static/chunks/webpack-73779742c80db59b.js:
--------------------------------------------------------------------------------
1 | !function(){"use strict";var e,r,_,t,n,u,i,o,c,a={},p={};function __webpack_require__(e){var r=p[e];if(void 0!==r)return r.exports;var _=p[e]={exports:{}},t=!0;try{a[e](_,_.exports,__webpack_require__),t=!1}finally{t&&delete p[e]}return _.exports}__webpack_require__.m=a,e=[],__webpack_require__.O=function(r,_,t,n){if(_){n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[_,t,n];return}for(var i=1/0,u=0;u=n&&Object.keys(__webpack_require__.O).every(function(e){return __webpack_require__.O[e](_[c])})?_.splice(c--,1):(o=!1,n{let{open:n}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:(0,t.jsxs)("div",{className:"flex h-16 justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex flex-shrink-0 items-center",children:(0,t.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",className:"text-gray-100",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{width:"100%",height:"100%",rx:"16",fill:"currentColor"}),(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.6482 10.1305L15.8785 7.02583L7.02979 22.5499H10.5278L17.6482 10.1305ZM19.8798 14.0457L18.11 17.1983L19.394 19.4511H16.8453L15.1056 22.5499H24.7272L19.8798 14.0457Z",fill:"black"})]})}),(0,t.jsx)("div",{className:"hidden sm:-my-px sm:ml-6 sm:flex sm:space-x-8",children:x.map(e=>(0,t.jsx)("a",{href:e.href,className:classNames(a===e.href?"border-slate-500 text-gray-900":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300","inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium"),"aria-current":a===e.href?"page":void 0,children:e.name},e.name))})]}),(0,t.jsx)("div",{className:"hidden sm:ml-6 sm:flex sm:items-center",children:(0,t.jsxs)(i.v,{as:"div",className:"relative ml-3",children:[(0,t.jsx)("div",{children:(0,t.jsxs)(i.v.Button,{className:"flex rounded-full bg-white text-sm focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2",children:[(0,t.jsx)("span",{className:"sr-only",children:"Open user menu"}),(0,t.jsx)(h(),{className:"h-8 w-8 rounded-full",src:(null==s?void 0:s.image)||"https://avatar.vercel.sh/leerob",height:32,width:32,alt:"".concat((null==s?void 0:s.name)||"placeholder"," avatar")})]})}),(0,t.jsx)(c.u,{as:r.Fragment,enter:"transition ease-out duration-200",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:(0,t.jsx)(i.v.Items,{className:"absolute right-0 z-10 mt-2 w-48 origin-top-right rounded-md bg-white py-1 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none",children:s?(0,t.jsx)(i.v.Item,{children:e=>{let{active:s}=e;return(0,t.jsx)("button",{className:classNames(s?"bg-gray-100":"","flex w-full px-4 py-2 text-sm text-gray-700"),onClick:()=>signOut(),children:"Sign out"})}}):(0,t.jsx)(i.v.Item,{children:e=>{let{active:s}=e;return(0,t.jsx)("button",{className:classNames(s?"bg-gray-100":"","flex w-full px-4 py-2 text-sm text-gray-700"),onClick:()=>signIn("github"),children:"Sign in"})}})})})]})}),(0,t.jsx)("div",{className:"-mr-2 flex items-center sm:hidden",children:(0,t.jsxs)(l.p.Button,{className:"inline-flex items-center justify-center rounded-md bg-white p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-slate-500 focus:ring-offset-2",children:[(0,t.jsx)("span",{className:"sr-only",children:"Open main menu"}),n?(0,t.jsx)(o.Z,{className:"block h-6 w-6","aria-hidden":"true"}):(0,t.jsx)(m.Z,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),(0,t.jsxs)(l.p.Panel,{className:"sm:hidden",children:[(0,t.jsx)("div",{className:"space-y-1 pt-2 pb-3",children:x.map(e=>(0,t.jsx)(l.p.Button,{as:"a",href:e.href,className:classNames(a===e.href?"bg-slate-50 border-slate-500 text-slate-700":"border-transparent text-gray-600 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-800","block pl-3 pr-4 py-2 border-l-4 text-base font-medium"),"aria-current":a===e.href?"page":void 0,children:e.name},e.name))}),(0,t.jsx)("div",{className:"border-t border-gray-200 pt-4 pb-3",children:s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center px-4",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)(h(),{className:"h-8 w-8 rounded-full",src:s.image,height:32,width:32,alt:"".concat(s.name," avatar")})}),(0,t.jsxs)("div",{className:"ml-3",children:[(0,t.jsx)("div",{className:"text-base font-medium text-gray-800",children:s.name}),(0,t.jsx)("div",{className:"text-sm font-medium text-gray-500",children:s.email})]})]}),(0,t.jsx)("div",{className:"mt-3 space-y-1",children:(0,t.jsx)("button",{onClick:()=>signOut(),className:"block px-4 py-2 text-base font-medium text-gray-500 hover:bg-gray-100 hover:text-gray-800",children:"Sign out"})})]}):(0,t.jsx)("div",{className:"mt-3 space-y-1",children:(0,t.jsx)("button",{onClick:()=>signIn("github"),className:"flex w-full px-4 py-2 text-base font-medium text-gray-500 hover:bg-gray-100 hover:text-gray-800",children:"Sign in"})})})]})]})}})}},92489:function(){}},function(e){e.O(0,[300,971,472,744],function(){return e(e.s=89033)}),_N_E=e.O()}]);
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/ui/_next/static/css/b4846eed11c4725f.css:
--------------------------------------------------------------------------------
1 | .react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__connection-path,.react-flow__edge-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid #fff;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translateX(-50%)}.react-flow__attribution{font-size:10px;background:hsla(0,0%,100%,.5);padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-group,.react-flow__node-input,.react-flow__node-output{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border:1px solid #1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-group.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover{box-shadow:0 1px 4px 1px rgba(0,0,0,.08)}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:hsla(0,0%,94%,.25)}.react-flow__nodesselection-rect,.react-flow__selection{background:rgba(0,89,220,.08);border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px rgba(0,0,0,.08)}.react-flow__controls-button{background:#fefefe;border:none;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.bottom,.react-flow__resize-control.top{cursor:ns-resize}.react-flow__resize-control.bottom.right,.react-flow__resize-control.top.left{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.bottom.left,.react-flow__resize-control.handle.top.left{left:0}.react-flow__resize-control.handle.bottom.right,.react-flow__resize-control.handle.top.right{left:100%}.react-flow__resize-control.line{border:0 solid #3367d9}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.bottom,.react-flow__resize-control.line.top{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/ui/_next/static/chunks/app/page-92690039f531a3b5.js:
--------------------------------------------------------------------------------
1 | (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{24647:function(e,s,n){Promise.resolve().then(n.bind(n,52004))},52004:function(e,s,n){"use strict";n.r(s),n.d(s,{default:function(){return ChatBoxView}});var l=n(57437),t=n(31706),a=n(62572),r=n(17933),o=n(51809),i=n(55856),c=n(85290),d=n(10887),u=n(33316),m=n(67896),h=n(33116),x=n(2265),g=n(98809),p=n(43241),v=n(78583),b=n(21037);function MarkdownView(e){var s;let{data:n}=e;return(0,l.jsx)("div",{className:" w-full chatbox prose dark:prose-invert text-primary rounded p-2 ",children:(0,l.jsx)(p.U,{remarkPlugins:[g.Z],components:{code(e){let{node:s,inline:n,className:t,children:a,...r}=e,o=/language-(\w+)/.exec(t||""),i=o?o[1]:"text";return!n&&o?(0,l.jsx)(b.Z,{...r,style:v.Z,language:i,className:"rounded",PreTag:"div",wrapLongLines:!0,children:String(a).replace(/\n$/,"")}):(0,l.jsx)("code",{...r,className:t,children:a})}},children:null==(s=(s=n).replace(/\n/g," \n"))?void 0:s.replace(/```markdown\s+([\s\S]*?)\s+```/g,(e,s)=>s)})})}function AgentMessagesView(e){let{messages:s}=e,n=(s||[]).map((e,s)=>{let n=s%2==0?"bg-primary":"bg-secondary";return(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:"text-xs border rounded p-2 mb-2 ".concat(n),children:(0,l.jsx)(MarkdownView,{data:e.content})})},"messagerow"+s)});return(0,l.jsxs)("div",{className:" overflow-x-hidden overflow-y-auto h-full scroll",children:[" ",(0,l.jsxs)("div",{className:"mb-2 text-xs",children:["The agent workflow generated ",n.length," message",n.length>1?"s":""," "]}),(0,l.jsx)("div",{children:n})]})}function ChatBoxView(e){let{initMessages:s,viewHeight:n="100%"}=e,g=x.useRef(null),p=x.useRef(null),v="http://localhost:8081/api",[b,f]=x.useState(!1),[j,N]=x.useState(null),[w,k]=x.useState({status:!0,message:"All good"}),[y,C]=x.useState([]);console.log("serverUrl",v),x.useEffect(()=>{C(s)},[s]);let Z=y.map((e,s)=>{var n,i,c,d;let h="user"===e.sender,x=!1;e.metadata&&(x=null!==e.metadata.code||(null===(i=e.metadata.images)||void 0===i?void 0:i.length)>0||(null===(c=e.metadata.files)||void 0===c?void 0:c.length)>0||(null===(d=e.metadata.scripts)||void 0===d?void 0:d.length)>0);let g=[];return h&&g.push({label:(0,l.jsx)("div",{onClick:()=>{console.log("retrying"),getCompletion(e.text)},children:(0,l.jsxs)("span",{className:"inline-block",children:[" ",(0,l.jsx)(t.Z,{role:"button",title:"Retry",className:"h-4 w-4 mr-1 inline-block"}),"Retry"]})}),key:"retrymessage"}),x&&g.push({label:(0,l.jsxs)("div",{onClick:()=>{},children:[(0,l.jsx)(a.Z,{title:"View Metadata",className:"h-4 w-4 mr-1 inline-block"}),"View Metadata"]}),key:"metadata"}),m.Z,(0,l.jsxs)("div",{className:"align-right ".concat(h?"text-right":" mb-2 border-b pb-2"," "),children:[" ",(0,l.jsxs)("div",{className:" ".concat(h?"":" w-full "," inline-flex gap-2"),children:[(0,l.jsxs)("div",{className:"",children:[" ",!h&&(0,l.jsxs)("span",{className:"inline-block text-accent bg-primary pb-2 ml-1",children:[(0,l.jsx)(r.Z,{className:"inline-block h-6 "})," "]})]}),(0,l.jsxs)("div",{className:"inline-block ".concat(h?"":" w-full "," p-2 rounded "),children:[" ",h&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:" ".concat(h?"bg-accent text-white ":"bg-light"," p-2 rounded"),children:[e.text,(0,l.jsx)("div",{role:"button",onClick:()=>{console.log("retrying"),getCompletion(e.text)}})]}),(0,l.jsxs)("span",{role:"button",onClick:()=>{console.log("retrying"),getCompletion(e.text)},className:"mt-1 text-sm inline-block",children:[" ",(0,l.jsx)(t.Z,{title:"Retry",className:"h-4 w-4 mr-1 inline-block"}),"Retry"]})]}),!h&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(MarkdownView,{data:e.text}),(0,l.jsx)(u.Z,{size:"small",className:"text-xs mt-2",items:[{key:"1",label:(0,l.jsx)("div",{children:(0,l.jsxs)("span",{className:"pr-2",children:[" ","Agent Messages (".concat(null===(n=e.metadata)||void 0===n?void 0:n.messages.length,")")]})}),children:(0,l.jsx)("div",{children:(0,l.jsx)(AgentMessagesView,{messages:e.metadata.messages})})}],onChange:e=>{console.log("changed",e)}})]})]}),h&&(0,l.jsx)(o.Z,{className:"inline-block h-6 "})]})]},"message"+s)});x.useEffect(()=>{scrollChatBox()},[y]),x.useEffect(()=>{!1===b&&g.current&&g.current&&(null===w||w&&!1===w.status)&&(g.current.value="")},[b]),x.useEffect(()=>{},[]);let chatHistory=e=>{let s="";return e.forEach(e=>{s+="".concat(e.sender,": ").concat(e.text," \n")}),s},scrollChatBox=()=>{var e;null===(e=p.current)||void 0===e||e.scroll({top:p.current.scrollHeight,behavior:"smooth"})},getLastMessage=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;for(let n=e.length-1;n>=0;n--){let l=e[n].content;if(l.length>s)return l}return null},getCompletion=e=>{k(null);let s=Object.assign([],y),n=chatHistory(y);console.log("****history****",n),s.push({text:e,sender:"user"}),C(s);let l={prompt:e,history:n};console.log("payload",l);let t="".concat(v,"/generate"),a={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(l)};f(!0),fetch(t,a).then(e=>{f(!1),200===e.status?e.json().then(e=>{if(e&&e.status){console.log("******* response received ",e);let n=getLastMessage(e.data.messages),l={text:n,sender:"bot",metadata:e.data};N(l),s.push(l),C(s=Object.assign([],s)),console.log(s)}else console.log("error",e),h.ZP.error(e.message)}):h.ZP.error("Connection error. Ensure server is up and running.")}).catch(e=>{f(!1),h.ZP.error("Connection error. Ensure server is up and running.")})};return(0,l.jsxs)("div",{style:{height:"calc(100% - 20px)"},className:"text-primary overflow-auto bg-primary relative scroll rounded flex-1 ",children:[(0,l.jsxs)("div",{style:{height:"calc(100% - 100px)"},ref:p,className:"flex overflow-auto flex-col rounded scroll pr-2 ",children:[(0,l.jsx)("div",{className:"flex-1 boder mt-4"}),(0,l.jsxs)("div",{className:"ml-2 ",children:[" ",Z]}),(0,l.jsx)("div",{className:"ml-2 h-6 mb-4 mt-2 ",children:b&&(0,l.jsxs)("div",{className:"inline-flex gap-2",children:[(0,l.jsx)("span",{className:" rounded-full bg-accent h-2 w-2 inline-block"}),(0,l.jsx)("span",{className:"animate-bounce rounded-full bg-accent h-3 w-3 inline-block"}),(0,l.jsx)("span",{className:" rounded-full bg-accent h-2 w-2 inline-block"})]})})]}),(0,l.jsxs)("div",{className:"mt-2 p-2 w-full",children:[(0,l.jsxs)("div",{className:"mt-2 rounded p-2 shadow-lg flex mb-1 ".concat(b?" opacity-50 pointer-events-none":""),children:[(0,l.jsx)("form",{className:"flex-1 ",onSubmit:e=>{e.preventDefault()},children:(0,l.jsx)("input",{id:"queryInput",name:"queryInput",onKeyDown:e=>{if("Enter"===e.key&&g.current&&!b){var s;getCompletion(null===(s=g.current)||void 0===s?void 0:s.value)}},ref:g,className:"w-full text-gray-600 rounded rounded-r-none border border-accent bg-white p-2 ropunded-sm"})}),(0,l.jsxs)("div",{role:"button",onClick:()=>{if(g.current&&!b){var e;getCompletion(null===(e=g.current)||void 0===e?void 0:e.value)}},className:"bg-accent hover:brightness-75 transition duration-300 rounded pt-2 rounded-l-none px-5 ",children:[" ",!b&&(0,l.jsxs)("div",{className:"inline-block ",children:[(0,l.jsx)(i.Z,{className:"h-6 text-white inline-block"})," "]}),b&&(0,l.jsx)("div",{className:"inline-block ",children:(0,l.jsx)(c.Z,{className:"relative -pb-2 text-white animate-spin inline-flex rounded-full h-6 w-6"})})]})]})," ",w&&!w.status&&(0,l.jsxs)("div",{className:"p-2 border rounded mt-4 text-orange-500 text-sm",children:[" ",(0,l.jsx)(d.Z,{className:"h-5 text-orange-500 inline-block mr-2"})," ",w.message]})]})]})}}},function(e){e.O(0,[900,689,971,472,744],function(){return e(e.s=24647)}),_N_E=e.O()}]);
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/ui/index.html:
--------------------------------------------------------------------------------
1 | AutoGen UI
AutoGen Agent Chat
--------------------------------------------------------------------------------
/autogen-ui/autogenui/web/ui/404.html:
--------------------------------------------------------------------------------
1 | AutoGen UI404: This page could not be found.