diff --git a/dockerfiles/.env b/dockerfiles/.env index 9e5f5f8a..71898228 100644 --- a/dockerfiles/.env +++ b/dockerfiles/.env @@ -1,4 +1,10 @@ - +# MongoDB Configuration +ENV_MONGO_DB_HOST=botsharp_mongo +ENV_MONGO_DB_PORT=27017 +ENV_MONGO_DB_DATABASE=botsharp +ENV_MONGO_INITDB_ROOT_USERNAME=root +ENV_MONGO_INITDB_ROOT_PASSWORD=admin +ASPNETCORE_HTTP_PORTS=5500 diff --git a/dockerfiles/Readme.md b/dockerfiles/Readme.md new file mode 100644 index 00000000..23bdac8c --- /dev/null +++ b/dockerfiles/Readme.md @@ -0,0 +1,16 @@ +## Run Container + +# Prerequisites: +1. Install Powershell +2. Install Docker Environment + +# start container + +``` +run-docker-compose.ps1 +``` + +# stop container +``` +stop-docker-compose.ps1 +``` diff --git a/dockerfiles/WebStarter.Dockerfile b/dockerfiles/WebStarter.Dockerfile index 3b74890c..550e52c2 100644 --- a/dockerfiles/WebStarter.Dockerfile +++ b/dockerfiles/WebStarter.Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base USER app WORKDIR /app -EXPOSE 8080 +EXPOSE 5500 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release diff --git a/dockerfiles/appsettings.json b/dockerfiles/appsettings.json index 380008ef..ff53ffb4 100644 --- a/dockerfiles/appsettings.json +++ b/dockerfiles/appsettings.json @@ -6,11 +6,32 @@ } }, "AllowedHosts": "*", + "AllowedOrigins": [ + "http://localhost:5015" + ], "Jwt": { "Issuer": "botsharp", "Audience": "botsharp", - "Key": "31ba6052aa6f4569901facc3a41fcb4a" + "Key": "31ba6052aa6f4569901facc3a41fcb4adfd9b46dd00c40af8a753fbdc2b89869" + }, + + "OAuth": { + "GitHub": { + "ClientId": "", + "ClientSecret": "" + }, + "Google": { + "ClientId": "", + "ClientSecret": "" + }, + "Keycloak": { + "BaseAddress": "http://keycloak.localhost:8080", + "Realm": "master", + "ClientId": "botsharp", + "ClientSecret": "36FeOoyZzkOWrRZLmhwxplC2kGbFGn68", + "Version": 22 + } }, "LlmProviders": [ @@ -26,14 +47,36 @@ "CompletionCost": 0.002 }, { - "Name": "gpt-35-turbo", + "Name": "gpt-35-turbo-instruct", "ApiKey": "", - "Endpoint": "https://ai4c-demo.openai.azure.com/", + "Endpoint": "https://gpt-35-turbo-instruct.openai.azure.com/", "Type": "text", "PromptCost": 0.0015, "CompletionCost": 0.002 } ] + }, + { + "Provider": "llama-sharp", + "Models": [ + { + "Name": "llama-2-7b-guanaco-qlora.Q2_K.gguf", + "Type": "chat" + } + ] + }, + { + "Provider": "huggingface", + "Models": [ + { + "Name": "mistralai/Mistral-7B-v0.1", + "Type": "text" + }, + { + "Name": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "Type": "text" + } + ] } ], @@ -58,7 +101,13 @@ "DataDir": "conversations", "ShowVerboseLog": false, "EnableLlmCompletionLog": false, - "EnableExecutionLog": true + "EnableExecutionLog": true, + "EnableContentLog": true, + "EnableStateLog": true + }, + + "Statistics": { + "DataDir": "stats" }, "LlamaSharp": { @@ -110,9 +159,9 @@ }, "Database": { - "Default": "FileRepository", + "Default": "MongoRepository", "TablePrefix": "BotSharp", - "BotSharpMongoDb": "", + "BotSharpMongoDb": "mongodb://root:admin@botsharp_mongo:27017/botsharp?authSource=admin&authMechanism=SCRAM-SHA-256", "FileRepository": "data", "Assemblies": [ "BotSharp.Core" ] }, @@ -139,8 +188,10 @@ "PluginLoader": { "Assemblies": [ - "BotSharp.Plugin.MongoStorage", "BotSharp.Core", + "BotSharp.Logger", + "BotSharp.Plugin.MongoStorage", + "BotSharp.Plugin.Dashboard", "BotSharp.Plugin.AzureOpenAI", "BotSharp.Plugin.GoogleAI", "BotSharp.Plugin.MetaAI", @@ -155,4 +206,4 @@ "BotSharp.Plugin.LLamaSharp" ] } -} +} \ No newline at end of file diff --git a/dockerfiles/botsharp.json b/dockerfiles/botsharp.json new file mode 100644 index 00000000..471f2082 --- /dev/null +++ b/dockerfiles/botsharp.json @@ -0,0 +1,64 @@ +{ + "clientId": "botsharp", + "name": "botsharp 登陆", + "description": "", + "rootUrl": "http://localhost:5500", + "adminUrl": "http://localhost:5500", + "baseUrl": "http://localhost:5500", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": true, + "clientAuthenticatorType": "client-secret", + "secret": "36FeOoyZzkOWrRZLmhwxplC2kGbFGn68", + "redirectUris": [ + "http://localhost:5500/*" + ], + "webOrigins": [ + "http://localhost:5500" + ], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": true, + "protocol": "openid-connect", + "attributes": { + "client.secret.creation.time": "1708154349", + "oauth2.device.authorization.grant.enabled": "false", + "backchannel.logout.revoke.offline.tokens": "false", + "use.refresh.tokens": "true", + "oidc.ciba.grant.enabled": "false", + "backchannel.logout.session.required": "true", + "client_credentials.use_refresh_token": "false", + "tls.client.certificate.bound.access.tokens": "false", + "require.pushed.authorization.requests": "false", + "acr.loa.map": "{}", + "display.on.consent.screen": "false", + "token.response.type.bearer.lower-case": "false" + }, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": true, + "nodeReRegistrationTimeout": -1, + "defaultClientScopes": [ + "web-origins", + "acr", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ], + "access": { + "view": true, + "configure": true, + "manage": true + } +} \ No newline at end of file diff --git a/dockerfiles/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/agent.json b/dockerfiles/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/agent.json new file mode 100644 index 00000000..536ca340 --- /dev/null +++ b/dockerfiles/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/agent.json @@ -0,0 +1,11 @@ +{ + "id": "01e2fc5c-2c89-4ec7-8470-7688608b496c", + "name": "Chatbot", + "description": "Chatbot is used to test the performance of different large models and does not interact with external APIs.", + "type": "task", + "createdDateTime": "2024-01-15T10:39:32Z", + "updatedDateTime": "2024-01-15T14:39:32Z", + "iconUrl": "/images/logo.png", + "disabled": false, + "isPublic": true +} \ No newline at end of file diff --git a/dockerfiles/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/instruction.liquid b/dockerfiles/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/instruction.liquid new file mode 100644 index 00000000..d944594b --- /dev/null +++ b/dockerfiles/data/agents/01e2fc5c-2c89-4ec7-8470-7688608b496c/instruction.liquid @@ -0,0 +1 @@ +You are a AI Assistant. You can answer user's question. diff --git a/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/agent.json b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/agent.json new file mode 100644 index 00000000..3159bb08 --- /dev/null +++ b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/agent.json @@ -0,0 +1,18 @@ +{ + "id": "01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a", + "name": "AI Assistant", + "description": "AI assistant that can complete many different tasks", + "type": "routing", + "createdDateTime": "2023-08-18T10:39:32.2349685Z", + "updatedDateTime": "2023-08-18T14:39:32.2349686Z", + "iconUrl": "https://cdn.iconscout.com/icon/premium/png-256-thumb/route-1613278-1368497.png", + "disabled": false, + "isPublic": true, + "profiles": [ "tool" ], + "routingRules": [ + { + "type": "planner", + "field": "HFPlanner" + } + ] +} \ No newline at end of file diff --git a/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid new file mode 100644 index 00000000..9147979f --- /dev/null +++ b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/instruction.liquid @@ -0,0 +1,40 @@ +You're {{router.name}} ({{router.description}}). Follow these steps to handle user request: +1. Read the [CONVERSATION] content. +2. Select a appropriate function from [FUNCTIONS]. +3. Determine which agent is suitable to handle this conversation. +4. Re-think on whether the function you chose matches the reason. +5. For agent required arguments, leave it as blank object if user doesn't provide it. +6. Response must be in JSON format. + +[FUNCTIONS] +{% for handler in routing_handlers %} +# {{ handler.description}} +{% if handler.parameters and handler.parameters != empty -%} +Parameters: + - function: {{ handler.name }} + {% for p in handler.parameters -%} + - {{ p.name }}: {{ p.description }}{{ "\r\n " }} + {%- endfor %} +{%- endif %} +{% endfor %} + +[AGENTS] +{% for agent in routing_agents %} +* Agent: {{ agent.name }} +{{ agent.description}} +{% if agent.required_fields and agent.required_fields != empty -%} +Required args: + {% for f in agent.required_fields -%} + - {{ f.name }} (type: {{ f.type }}): {{ f.description }}{{ "\r\n " }} + {%- endfor %} +{%- endif %} +{% if agent.optional_fields and agent.optional_fields != empty -%} +Optional args: + {% for f in agent.optional_fields -%} + - {{ f.name }} (type: {{ f.type }}): {{ f.description }}{{ "\r\n " }} + {%- endfor %} +{%- endif %} +{% endfor %} + +[CONVERSATION] +{{ conversation }} diff --git a/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/.welcome.liquid b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/.welcome.liquid new file mode 100644 index 00000000..d5a24fbf --- /dev/null +++ b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/.welcome.liquid @@ -0,0 +1,19 @@ +[ + { + "text": "Hello, I'm an AI assistant that help you do variety of tasks." + }, + { + "rich_type": "quick_reply", + "text": "How can I help you today?", + "quick_replies": [ + { + "title":"Access website", + "payload":"Launch Browser" + }, + { + "title":"Who are you?", + "payload":"who are you?" + } + ] + } +] \ No newline at end of file diff --git a/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.hf.liquid b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.hf.liquid new file mode 100644 index 00000000..20874a60 --- /dev/null +++ b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.hf.liquid @@ -0,0 +1 @@ +Break down the user’s most recent needs and figure out the next steps. \ No newline at end of file diff --git a/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.naive.liquid b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.naive.liquid new file mode 100644 index 00000000..449bd4d7 --- /dev/null +++ b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.naive.liquid @@ -0,0 +1,3 @@ +What is the next step based on the CONVERSATION? +Route to the Agent that last handled the conversation if necessary. +If user wants to speak to customer service, use function human_intervention_needed. \ No newline at end of file diff --git a/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.sequential.get_remaining_task.liquid b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.sequential.get_remaining_task.liquid new file mode 100644 index 00000000..0c93d4e8 --- /dev/null +++ b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.sequential.get_remaining_task.liquid @@ -0,0 +1,12 @@ +User will give you a task list with steps, which is going to be executed. +If a specific step has been exectued, you will get something indicates the result. +If there is no any result provided, it means all the steps have not been executed yet. +You need to figure out which steps have not been completed. +Tell me what is the first remaining step from user steps that have not been completed based on the context. +Output in JSON +{ + "description": "step detail with arguments", + "total_remaining_steps": 0, + "should_stop": false, + "stop_reason": "the reason why it should stop" +} \ No newline at end of file diff --git a/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.sequential.liquid b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.sequential.liquid new file mode 100644 index 00000000..d0d3a4ad --- /dev/null +++ b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/planner_prompt.sequential.liquid @@ -0,0 +1,2 @@ +In order to sequentially execute user tasks, +What is the next step based on the CONVERSATION? \ No newline at end of file diff --git a/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/response_with_function.liquid b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/response_with_function.liquid new file mode 100644 index 00000000..d45771b3 --- /dev/null +++ b/dockerfiles/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/templates/response_with_function.liquid @@ -0,0 +1,9 @@ +[Output Requirements] +1. Read the [Functions] definition, you can utilize the function to retrieve data or execute actions. +2. Think step by step, check if specific function will provider data to help complete user request based on the conversation. +3. If you need to call a function to decide how to response user, + response in format: {"role": "function", "reason":"why choose this function", "function_name": "", "args": {}}, + otherwise response in format: {"role": "assistant", "reason":"why response to user", "content":"next step question"}. +4. If the conversation already contains the function execution result, don't need to call it again. +5. If user mentioned some specific requirment, don't ask this question in your response. +6. Don't repeat the same question in your response. \ No newline at end of file diff --git a/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/agent.json b/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/agent.json new file mode 100644 index 00000000..a2b96927 --- /dev/null +++ b/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/agent.json @@ -0,0 +1,14 @@ +{ + "id": "87c458fc-ec5f-40ae-8ed6-05dda8a07523", + "name": "HTTP Handler", + "description": "Use Web Open API to interact with 3rd system.", + "type": "task", + "createdDateTime": "2024-01-06T00:00:00Z", + "updatedDateTime": "2024-01-06T00:00:00Z", + "disabled": false, + "isPublic": true, + "profiles": [ "tool", "webapi" ], + "llmConfig": { + "max_recursion_depth": 1 + } +} \ No newline at end of file diff --git a/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/functions.json b/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/functions.json new file mode 100644 index 00000000..b5a2cf7b --- /dev/null +++ b/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/functions.json @@ -0,0 +1,3 @@ +[ + +] diff --git a/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/instruction.liquid b/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/instruction.liquid new file mode 100644 index 00000000..0f98d3da --- /dev/null +++ b/dockerfiles/data/agents/87c458fc-ec5f-40ae-8ed6-05dda8a07523/instruction.liquid @@ -0,0 +1 @@ +You are an HTTP handler and know how to use Open API to interact with other systems. \ No newline at end of file diff --git a/dockerfiles/data/agents/8970b1e5-d260-4e2c-90b1-f1415a257c18/agent.json b/dockerfiles/data/agents/8970b1e5-d260-4e2c-90b1-f1415a257c18/agent.json new file mode 100644 index 00000000..d05e0481 --- /dev/null +++ b/dockerfiles/data/agents/8970b1e5-d260-4e2c-90b1-f1415a257c18/agent.json @@ -0,0 +1,19 @@ +{ + "id": "8970b1e5-d260-4e2c-90b1-f1415a257c18", + "name": "Pizza Bot", + "description": "AI assistant that can help customer place pizza order.", + "type": "routing", + "inheritAgentId": "01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a", + "createdDateTime": "2023-08-18T10:39:32.2349685Z", + "updatedDateTime": "2023-08-18T14:39:32.2349686Z", + "iconUrl": "https://cdn-icons-png.flaticon.com/512/6978/6978255.png", + "disabled": true, + "isPublic": true, + "profiles": [ "pizza" ], + "routingRules": [ + { + "type": "planner", + "field": "NaviePlanner" + } + ] +} \ No newline at end of file diff --git a/dockerfiles/data/agents/8970b1e5-d260-4e2c-90b1-f1415a257c18/templates/task.place_pizza_order.liquid b/dockerfiles/data/agents/8970b1e5-d260-4e2c-90b1-f1415a257c18/templates/task.place_pizza_order.liquid new file mode 100644 index 00000000..800bde83 --- /dev/null +++ b/dockerfiles/data/agents/8970b1e5-d260-4e2c-90b1-f1415a257c18/templates/task.place_pizza_order.liquid @@ -0,0 +1,11 @@ +Role: You're a customer who is going to buy a pizza. +* You like pepperoni flavor. +* You will pay the order in cash. +* Your address is 347 S Gladstone Ave, Aurora, IL 60506. +* Your phone number is +16308926431 + +Requirments: +* Greeting to clerk. +* You want to know what kind of pizza do they have. +* You want to buy three piece of pizza. +* Say Bye if the order is placed and payment is completed. \ No newline at end of file diff --git a/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/agent.json b/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/agent.json new file mode 100644 index 00000000..949e201c --- /dev/null +++ b/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/agent.json @@ -0,0 +1,18 @@ +{ + "name": "Order Inquiry", + "description": "Check the order status like payment, delivery or baking.", + "createdDateTime": "2023-08-18T14:39:32.2349685Z", + "updatedDateTime": "2023-08-18T14:39:32.2349686Z", + "id": "b284db86-e9c2-4c25-a59e-4649797dd130", + "disabled": true, + "isPublic": true, + "profiles": [ "pizza" ], + "routingRules": [ + { + "field": "order_number", + "description": "order number", + "type": "string", + "redirectTo": "c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd" + } + ] +} \ No newline at end of file diff --git a/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/functions.json b/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/functions.json new file mode 100644 index 00000000..fbcb82dd --- /dev/null +++ b/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/functions.json @@ -0,0 +1,16 @@ +[ + { + "name": "get_order_status", + "description": "get order status like delivery remaining time", + "parameters": { + "type": "object", + "properties": { + "order_number": { + "type": "string", + "description": "order number." + } + }, + "required": ["order_number"] + } + } +] diff --git a/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/instruction.liquid b/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/instruction.liquid new file mode 100644 index 00000000..00540546 --- /dev/null +++ b/dockerfiles/data/agents/b284db86-e9c2-4c25-a59e-4649797dd130/instruction.liquid @@ -0,0 +1,6 @@ +You're a Order Inquiry agent to tell user current status of the specific order. + +You can also access below available information related to current order to answer user's questions: +* Today is {{current_date}}, the time now is {{current_time}}, today is {{current_weekday}}. +{% if phone_num %}* Phone number is: {{phone_num}}.{% endif %} +{% if order_number %}* order number is: {{order_number}}.{% endif %} diff --git a/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/agent.json b/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/agent.json new file mode 100644 index 00000000..73b5151f --- /dev/null +++ b/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/agent.json @@ -0,0 +1,14 @@ +{ + "id": "beda4c12-e1ec-4b4b-b328-3df4a6687c4f", + "name": "SQL Driver", + "description": "Convert the requirements into corresponding SQL statements according to the table structure and execute them if needed.", + "type": "task", + "createdDateTime": "2023-11-15T13:49:00Z", + "updatedDateTime": "2023-11-15T13:49:00Z", + "disabled": false, + "isPublic": false, + "profiles": [ "tool", "sql" ], + "llmConfig": { + "max_recursion_depth": 1 + } +} \ No newline at end of file diff --git a/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/functions.json b/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/functions.json new file mode 100644 index 00000000..e09e23a1 --- /dev/null +++ b/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/functions.json @@ -0,0 +1,14 @@ +[{ + "name": "execute_sql", + "description": "generate sql statement and execute the query.", + "parameters": { + "type": "object", + "properties": { + "sql_statement": { + "type": "string", + "description": "SQL statement" + } + }, + "required": ["sql_statement"] + } +}] \ No newline at end of file diff --git a/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/instruction.liquid b/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/instruction.liquid new file mode 100644 index 00000000..fca8fa07 --- /dev/null +++ b/dockerfiles/data/agents/beda4c12-e1ec-4b4b-b328-3df4a6687c4f/instruction.liquid @@ -0,0 +1 @@ +You are a SQL Driver who knows how to convert human language to SQL statements. \ No newline at end of file diff --git a/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/agent.json b/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/agent.json new file mode 100644 index 00000000..4751fb78 --- /dev/null +++ b/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/agent.json @@ -0,0 +1,10 @@ +{ + "name": "Ordering", + "description": "Provide types of pizza available, unit price and total cost. Place the order and returned the order number.", + "createdDateTime": "2023-07-26T02:29:25.123224Z", + "updatedDateTime": "2023-07-26T02:29:25.123274Z", + "id": "c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd", + "disabled": true, + "isPublic": true, + "profiles": [ "pizza" ] +} \ No newline at end of file diff --git a/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/functions.json b/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/functions.json new file mode 100644 index 00000000..140aec8a --- /dev/null +++ b/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/functions.json @@ -0,0 +1,51 @@ +[ + { + "name": "get_pizza_price", + "description": "call this function to get the pizza price", + "parameters": { + "type": "object", + "properties": { + "pizza_type": { + "type": "string", + "description": "The pizza type." + }, + "quantity": { + "type": "string", + "description": "quantity of pizza." + } + }, + "required": ["pizza_type", "quantity"] + } + }, + { + "name": "get_pizza_types", + "description": "get all pizza types", + "parameters": { + "type": "object", + "properties": {}, + "required": [] + } + }, + { + "name": "place_an_order", + "description": "Place an order when user has confirmed the pizza type and quantity.", + "parameters": { + "type": "object", + "properties": { + "pizza_type": { + "type": "string", + "description": "The pizza type." + }, + "quantity": { + "type": "number", + "description": "quantity of pizza." + }, + "unit_price": { + "type": "number", + "description": "unit price" + } + }, + "required": ["pizza_type", "quantity", "unit_price"] + } + } +] diff --git a/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/instruction.liquid b/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/instruction.liquid new file mode 100644 index 00000000..73b33cc3 --- /dev/null +++ b/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/instruction.liquid @@ -0,0 +1,10 @@ +You are now a Pizza Ordering agent, and you can help customers order a pizza according to the user's preferences. + +Follow below step to place order: +1: Ask user preferences, call function get_pizza_types to provide the variety of pizza options. +2: Confirm with user the pizza type and quantity. +3: Call function place_an_order to purchase. +4: Ask user how to pay for this order. + +Use below information to help ordering process: +* Today is {{current_date}}, the time now is {{current_time}}, day of week is {{current_weekday}}. diff --git a/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/responses/func.get_pizza_price.0.liquid b/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/responses/func.get_pizza_price.0.liquid new file mode 100644 index 00000000..62041ece --- /dev/null +++ b/dockerfiles/data/agents/c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd/responses/func.get_pizza_price.0.liquid @@ -0,0 +1,13 @@ +{% assign pizza_type = pizza_type | downcase %} +{% if pizza_type contains "cheese" -%} + The price for a slice of {{pizza_type}} pizza is ${{ cheese_unit_price }}. Would you like to proceed the order? +{%- elsif pizza_type contains "pepperoni" -%} + The price for a slice of {{pizza_type}} pizza is ${{ pepperoni_unit_price }}. Would you like to proceed the order? +{%- elsif pizza_type contains "margherita" -%} + The price for a slice of {{pizza_type}} pizza is ${{ margherita_unit_price }}. Would you like to proceed the order? +{%- else -%} + We don't have {{pizza_type}} pizza, would you like something else? +{%- endif %} +{% if quantity == nil -%} + How many slices would you like to order? +{%- endif %} \ No newline at end of file diff --git a/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/agent.json b/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/agent.json new file mode 100644 index 00000000..e9bac6f5 --- /dev/null +++ b/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/agent.json @@ -0,0 +1,11 @@ +{ + "id": "dfd9b46d-d00c-40af-8a75-3fbdc2b89869", + "name": "Evaluator", + "description": "Evaluate the performance of the LLM agents", + "createdDateTime": "2023-08-18T00:00:00Z", + "updatedDateTime": "2023-08-18T00:00:00Z", + "disabled": true, + "llmConfig": { + "model": "gpt-35-turbo-instruct" + } +} \ No newline at end of file diff --git a/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/instruction.liquid b/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/instruction.liquid new file mode 100644 index 00000000..d0bed0db --- /dev/null +++ b/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/instruction.liquid @@ -0,0 +1,7 @@ +This is a model evaluation program, which interactive with model to complete a certain task based on the background information given to you. + +{{ task_prompt }} + +user: Hi! +assistant: Hello, How can I help you? +user: \ No newline at end of file diff --git a/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/templates/instruction.executor.liquid b/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/templates/instruction.executor.liquid new file mode 100644 index 00000000..b708a99e --- /dev/null +++ b/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/templates/instruction.executor.liquid @@ -0,0 +1,7 @@ +This is a model executing program, which interactive with model to complete a certain task based on the background information given to you. + +{{ task_prompt }} + +user: Hi! +assistant: Hello, How can I help you? +user: \ No newline at end of file diff --git a/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/templates/instruction.reviewer.liquid b/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/templates/instruction.reviewer.liquid new file mode 100644 index 00000000..e4071e08 --- /dev/null +++ b/dockerfiles/data/agents/dfd9b46d-d00c-40af-8a75-3fbdc2b89869/templates/instruction.reviewer.liquid @@ -0,0 +1,9 @@ +You are a task reviewer. You analyze the user's intention through the [CONVERSAION] and then generate the corresponding information to verify the result. + +[CONVERSAION] +{{ execution_log }} + +Populate values to validate the result. Response in JSON format: { + "is_conversation_end": "True or False", + "validation_parameters: "fields used to call validation function" +} \ No newline at end of file diff --git a/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/agent.json b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/agent.json new file mode 100644 index 00000000..75ab5838 --- /dev/null +++ b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/agent.json @@ -0,0 +1,14 @@ +{ + "id": "f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b", + "name": "Web Driver", + "description": "Perform the web page related task in browser by using automation tools.", + "type": "task", + "createdDateTime": "2024-01-02T00:00:00Z", + "updatedDateTime": "2024-01-02T00:00:00Z", + "disabled": false, + "isPublic": true, + "profiles": [ "tool", "browser" ], + "llmConfig": { + "max_recursion_depth": 1 + } +} \ No newline at end of file diff --git a/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions.json b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions.json new file mode 100644 index 00000000..7dcebe01 --- /dev/null +++ b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/functions.json @@ -0,0 +1,228 @@ +[ + { + "name": "open_browser", + "description": "open a browser", + "parameters": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "website url starts with https://" + } + }, + "required": [ "url" ] + } + }, + { + "name": "close_browser", + "description": "Close browser", + "parameters": { + "type": "object", + "properties": { + }, + "required": [] + } + }, + { + "name": "go_to_page", + "description": "go to another page", + "parameters": { + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "page url start with https://" + } + }, + "required": [ "url" ] + } + }, + { + "name": "scroll_page", + "description": "Scroll page down or up", + "parameters": { + "type": "object", + "properties": { + "direction": { + "type": "string", + "description": "down, up, left, right" + } + }, + "required": [ "direction" ] + } + }, + { + "name": "take_screenshot", + "description": "Tak screenshot to show current page screen", + "parameters": { + "type": "object", + "properties": { + }, + "required": [] + } + }, + { + "name": "click_button", + "description": "Click a button in a web page.", + "parameters": { + "type": "object", + "properties": { + "element_name": { + "type": "string", + "description": "the html element name." + } + }, + "required": [ "element_name" ] + } + }, + { + "name": "extract_data_from_page", + "description": "Extract data from current web page.", + "parameters": { + "type": "object", + "properties": { + "question": { + "type": "string", + "description": "the information user wants to know" + } + }, + "required": [ "question" ] + } + }, + { + "name": "input_user_text", + "description": "Input non-sensitive text in current web page.", + "parameters": { + "type": "object", + "properties": { + "element_text": { + "type": "string", + "description": "text or placeholder shown in the element." + }, + "input_text": { + "type": "string", + "description": "non-sensitive text user provided." + }, + "press_enter": { + "type": "boolean", + "description": "whether to press Enter key" + }, + "attribute_name": { + "type": "string", + "description": "attribute name in the element" + }, + "attribute_value": { + "type": "string", + "description": "attribute value in the element" + } + }, + "required": [ "element_text", "input_text" ] + } + }, + { + "name": "change_list_value", + "description": "Update value from dropdown list or radio button", + "parameters": { + "type": "object", + "properties": { + "element_name": { + "type": "string", + "description": "the html selection element name." + }, + "update_value": { + "type": "string", + "description": "the value in the list." + } + }, + "required": [ "element_name", "update_value" ] + } + }, + { + "name": "input_user_password", + "description": "Input password in current web page", + "parameters": { + "type": "object", + "properties": { + "password": { + "type": "string", + "description": "user password" + } + }, + "required": [ "password" ] + } + }, + { + "name": "change_checkbox", + "description": "Check or uncheck checkbox", + "parameters": { + "type": "object", + "properties": { + "element_text": { + "type": "string", + "description": "the element title" + }, + "update_value": { + "type": "string", + "description": "check or uncheck" + }, + "match_rule": { + "type": "string", + "description": "text matching rule: EndWith, StartWith, Contains, Match" + } + }, + "required": [ "element_text", "update_value", "match_rule" ] + } + }, + { + "name": "click_element", + "description": "Click or check an element contains some text", + "parameters": { + "type": "object", + "properties": { + "element_type": { + "type": "string", + "description": "the element tag name" + }, + "element_text": { + "type": "string", + "description": "text or placeholder shown in the element." + }, + "attribute_name": { + "type": "string", + "description": "attribute name in the element" + }, + "attribute_value": { + "type": "string", + "description": "attribute value in the element" + }, + "match_rule": { + "type": "string", + "description": "text matching rule: EndWith, StartWith, Contains, Match" + } + }, + "required": [ "element_type", "element_text", "match_rule" ] + } + }, + { + "name": "check_radio_button", + "description": "Check value in a radio button", + "parameters": { + "type": "object", + "properties": { + "element_text": { + "type": "string", + "description": "the element title" + }, + "update_value": { + "type": "string", + "description": "the value in the radio button." + }, + "match_rule": { + "type": "string", + "description": "text matching rule: EndWith, StartWith, Contains, Match" + } + }, + "required": [ "update_value", "element_text", "match_rule" ] + } + } +] diff --git a/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/instruction.liquid b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/instruction.liquid new file mode 100644 index 00000000..1960b0fc --- /dev/null +++ b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/instruction.liquid @@ -0,0 +1,9 @@ +You are a Web Driver that can manipulate web elements through automation tools. + +Follow below steps to response: +1. Analyze user's request. +2. Call appropriate function to execute the instruction. +3. If user requests execute multiple steps, execute them sequentially. + +Additional response requirements: +* Call function input_user_password if user wants to input password. \ No newline at end of file diff --git a/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/templates/extract_data.liquid b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/templates/extract_data.liquid new file mode 100644 index 00000000..12e8773b --- /dev/null +++ b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/templates/extract_data.liquid @@ -0,0 +1,4 @@ +{{ content }} + +=== According to above text === +Find the answer of "{{ question }}" \ No newline at end of file diff --git a/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/templates/html_parser.liquid b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/templates/html_parser.liquid new file mode 100644 index 00000000..cd4db60c --- /dev/null +++ b/dockerfiles/data/agents/f3ae2a0f-e6ba-4ee1-a0b9-75d7431ff32b/templates/html_parser.liquid @@ -0,0 +1,6 @@ +{{ html_content }} + +=== According to above HTML === +Find the html element in the similar meaning of "{{ element_name }}". +Output in JSON format {"tag_name": "", "element_id": "the id attribute", "element_name", "the name attribute", "index": -1}. +The index is the position of the element which starts with 0. \ No newline at end of file diff --git a/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/agent.json b/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/agent.json new file mode 100644 index 00000000..9eb33118 --- /dev/null +++ b/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/agent.json @@ -0,0 +1,9 @@ +{ + "name": "Knowledge Base", + "description": "Local knowledge base, providing relevant answers or background knowledge to help handle user questions.", + "createdDateTime": "2024-01-02T00:00:00Z", + "updatedDateTime": "2024-01-02T00:00:00Z", + "id": "f5679799-ba89-4fef-936a-bcc311e5f14d", + "allowRouting": true, + "isPublic": true + } \ No newline at end of file diff --git a/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/functions.json b/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/functions.json new file mode 100644 index 00000000..5adc8d82 --- /dev/null +++ b/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/functions.json @@ -0,0 +1,16 @@ +[ + { + "name": "search_knowledges", + "description": "Retrieve relevant knowledges", + "parameters": { + "type": "object", + "properties": { + "question": { + "type": "string", + "description": "User question" + } + }, + "required": ["question"] + } + } +] \ No newline at end of file diff --git a/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/instruction.liquid b/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/instruction.liquid new file mode 100644 index 00000000..2bdfa8be --- /dev/null +++ b/dockerfiles/data/agents/f5679799-ba89-4fef-936a-bcc311e5f14d/instruction.liquid @@ -0,0 +1 @@ +You are a local knowledge base that retrieves the most relevant answers to certain questions. \ No newline at end of file diff --git a/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/agent.json b/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/agent.json new file mode 100644 index 00000000..af5d6cd9 --- /dev/null +++ b/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/agent.json @@ -0,0 +1,19 @@ +{ + "name": "Payment", + "description": "Make payment when user wants to pay for the order", + "createdDateTime": "2023-07-26T02:29:25.123224Z", + "updatedDateTime": "2023-07-26T02:29:25.123274Z", + "id": "fe8c60aa-b114-4ef3-93cb-a8efeac80f75", + "disabled": true, + "isPublic": true, + "profiles": [ "pizza" ], + "routingRules": [ + { + "field": "order_number", + "description": "order number", + "type": "string", + "required": true, + "redirectTo": "c2b57a74-ae4e-4c81-b3ad-9ac5bff982bd" + } + ] +} \ No newline at end of file diff --git a/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/functions.json b/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/functions.json new file mode 100644 index 00000000..13ed0ebd --- /dev/null +++ b/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/functions.json @@ -0,0 +1,20 @@ +[ + { + "name": "make_payment", + "description": "call this function to make payment", + "parameters": { + "type": "object", + "properties": { + "order_number": { + "type": "string", + "description": "order number." + }, + "total_amount": { + "type": "string", + "description": "total amount." + } + }, + "required": ["order_number", "total_amount"] + } + } +] diff --git a/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/instruction.liquid b/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/instruction.liquid new file mode 100644 index 00000000..9cabeb9b --- /dev/null +++ b/dockerfiles/data/agents/fe8c60aa-b114-4ef3-93cb-a8efeac80f75/instruction.liquid @@ -0,0 +1 @@ +You are now a Casher, handle order payment. \ No newline at end of file diff --git a/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/conversation.json b/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/conversation.json new file mode 100644 index 00000000..cd42fdd3 --- /dev/null +++ b/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/conversation.json @@ -0,0 +1,11 @@ +{ + "id": "6bd19bda-fdae-434c-8ddf-788ee5e6ff4f", + "agentId": "01e2fc5c-2c89-4ec7-8470-7688608b496c", + "userId": "456e35c5-caf0-4d45-9084-b44a8ca717e4", + "taskId": null, + "title": "你好,我可以问下pdf 文件用什么软件打开 ", + "status": "open", + "channel": "openapi", + "updatedTime": "2024-02-18T08:18:29.2088118Z", + "createdTime": "2024-02-18T08:13:10.8880785Z" +} \ No newline at end of file diff --git a/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/dialogs.txt b/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/dialogs.txt new file mode 100644 index 00000000..e3a2b1f2 --- /dev/null +++ b/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/dialogs.txt @@ -0,0 +1,4 @@ +02/18/2024 08:18:20.752 AM|user|01e2fc5c-2c89-4ec7-8470-7688608b496c|c7fc2ae0-cc22-4846-93d1-ee17d34537ed|456e35c5-caf0-4d45-9084-b44a8ca717e4 + - 你好,我可以问下pdf 文件用什么软件打开 +02/18/2024 08:18:29.163 AM|assistant|01e2fc5c-2c89-4ec7-8470-7688608b496c|c7fc2ae0-cc22-4846-93d1-ee17d34537ed| + - 你好!你可以使用许多不同的软件来打开PDF文件。以下是一些常见的选择: 1. Adobe Acrobat Reader:这是最常用的PDF阅读器,可以在Adobe官方网站上免费下载。 2. Foxit Reader:这是另一个流行的免费PDF阅读器,也可以在其官方网站上下载。 3. Google Chrome:如果你使用的是Chrome浏览器,它已经内置了一个PDF阅读器。只需在浏览器中打开PDF文件即可。 4. Microsoft Edge:Windows 10操作系统中的默认浏览器,也具有内置的PDF阅读器。 5. Preview(预览):这是苹果电脑上的默认PDF阅读器,可以在Mac电脑上直接打开PDF文件。 除了这些,还有许多其他的PDF阅读器可供选择,你可以根据自己的需求和喜好选择适合你的软件。 diff --git a/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/state.json b/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/state.json new file mode 100644 index 00000000..df1dc5b6 --- /dev/null +++ b/dockerfiles/data/conversations/6bd19bda-fdae-434c-8ddf-788ee5e6ff4f/state.json @@ -0,0 +1,56 @@ +[ + { + "key": "channel", + "values": [ + { + "data": "openapi", + "updateTime": "2024-02-18T08:18:20.7601253Z" + } + ] + }, + { + "key": "temperature", + "values": [ + { + "data": "0.5", + "updateTime": "2024-02-18T08:18:20.7613053Z" + } + ] + }, + { + "key": "sampling_factor", + "values": [ + { + "data": "0.5", + "updateTime": "2024-02-18T08:18:20.7613341Z" + } + ] + }, + { + "key": "prompt_total", + "values": [ + { + "data": "41", + "updateTime": "2024-02-18T08:18:29.1630906Z" + } + ] + }, + { + "key": "completion_total", + "values": [ + { + "data": "261", + "updateTime": "2024-02-18T08:18:29.1630967Z" + } + ] + }, + { + "key": "llm_total_cost", + "values": [ + { + "data": "0.0005835", + "updateTime": "2024-02-18T08:18:29.1631479Z" + } + ] + } +] \ No newline at end of file diff --git a/dockerfiles/data/models/dbpedia.ftz b/dockerfiles/data/models/dbpedia.ftz new file mode 100644 index 00000000..8f649cc9 Binary files /dev/null and b/dockerfiles/data/models/dbpedia.ftz differ diff --git a/dockerfiles/data/models/intent-classifier.h5 b/dockerfiles/data/models/intent-classifier.h5 new file mode 100644 index 00000000..e4be7ee5 Binary files /dev/null and b/dockerfiles/data/models/intent-classifier.h5 differ diff --git a/dockerfiles/data/models/label.txt b/dockerfiles/data/models/label.txt new file mode 100644 index 00000000..03fb5a19 --- /dev/null +++ b/dockerfiles/data/models/label.txt @@ -0,0 +1,3 @@ +goodbye +greeting +other diff --git a/dockerfiles/data/plugins/config.json b/dockerfiles/data/plugins/config.json new file mode 100644 index 00000000..8df9c515 --- /dev/null +++ b/dockerfiles/data/plugins/config.json @@ -0,0 +1,7 @@ +{ + "enabledPlugins": [ + "6e52d42d-1e23-406b-8599-36af36c83209", + "d42a0c21-b461-44f6-ada2-499510d260af", + "058094a7-4ad3-4284-b94d-ac1373cf63d8" + ] +} \ No newline at end of file diff --git a/dockerfiles/data/stats/2024/02/0218-stats.json b/dockerfiles/data/stats/2024/02/0218-stats.json new file mode 100644 index 00000000..4999fb32 --- /dev/null +++ b/dockerfiles/data/stats/2024/02/0218-stats.json @@ -0,0 +1,5 @@ +{ + "id": "49b0b681-b828-4cf3-ba02-7f7f0953a2b6", + "conversationCount": 1, + "updatedDateTime": "2024-02-18T08:13:11.1001016Z" +} \ No newline at end of file diff --git a/dockerfiles/data/users/10d12798-08fb-4aa6-977b-5dd94d82dbfe/user.json b/dockerfiles/data/users/10d12798-08fb-4aa6-977b-5dd94d82dbfe/user.json new file mode 100644 index 00000000..d2eb033f --- /dev/null +++ b/dockerfiles/data/users/10d12798-08fb-4aa6-977b-5dd94d82dbfe/user.json @@ -0,0 +1,12 @@ +{ + "userName": "guest", + "firstName": "Guest", + "lastName": "Anonymous", + "email": "guest@gmail.com", + "salt": "55f8fafcf829479ca97e635937440fee", + "password": "3b459ae9988628d41f0362c499a768dd", + "role": "client", + "updatedTime": "2023-11-13T18:00:00Z", + "createdTime": "2023-11-13T18:00:00Z", + "id": "10d12798-08fb-4aa6-977b-5dd94d82dbfe" +} \ No newline at end of file diff --git a/dockerfiles/data/users/456e35c5-caf0-4d45-9084-b44a8ca717e4/user.json b/dockerfiles/data/users/456e35c5-caf0-4d45-9084-b44a8ca717e4/user.json new file mode 100644 index 00000000..637dafb1 --- /dev/null +++ b/dockerfiles/data/users/456e35c5-caf0-4d45-9084-b44a8ca717e4/user.json @@ -0,0 +1,13 @@ +{ + "userName": "admin", + "firstName": "Administrator", + "lastName": "", + "email": "admin@gmail.com", + "salt": "55f8fafcf829479ca97e635937440fee", + "password": "3b459ae9988628d41f0362c499a768dd", + "role": "admin", + "updatedTime": "2023-08-14T18:14:03.4602072Z", + "createdTime": "2023-08-14T18:14:03.4602075Z", + "id": "456e35c5-caf0-4d45-9084-b44a8ca717e4", + "externalId":"" +} \ No newline at end of file diff --git a/dockerfiles/data/users/d0e6680d-03d5-4ed8-bdcd-aa7d86f2a1bc/user.json b/dockerfiles/data/users/d0e6680d-03d5-4ed8-bdcd-aa7d86f2a1bc/user.json new file mode 100644 index 00000000..ab408d77 --- /dev/null +++ b/dockerfiles/data/users/d0e6680d-03d5-4ed8-bdcd-aa7d86f2a1bc/user.json @@ -0,0 +1,12 @@ +{ + "userName": "nancy", + "firstName": "Nancy", + "lastName": "Luna", + "email": "user1@gmail.com", + "salt": "55f8fafcf829479ca97e635937440fee", + "password": "3b459ae9988628d41f0362c499a768dd", + "role": "client", + "updatedTime": "2023-11-13T18:00:00Z", + "createdTime": "2023-11-13T18:00:00Z", + "id": "d0e6680d-03d5-4ed8-bdcd-aa7d86f2a1bc" +} \ No newline at end of file diff --git a/dockerfiles/data/users/e465af5f-044f-414b-b670-92834929b96c/user.json b/dockerfiles/data/users/e465af5f-044f-414b-b670-92834929b96c/user.json new file mode 100644 index 00000000..97df16c0 --- /dev/null +++ b/dockerfiles/data/users/e465af5f-044f-414b-b670-92834929b96c/user.json @@ -0,0 +1,12 @@ +{ + "userName": "elon", + "firstName": "Elon", + "lastName": "Musk", + "email": "csr1@gmail.com", + "salt": "55f8fafcf829479ca97e635937440fee", + "password": "3b459ae9988628d41f0362c499a768dd", + "role": "csr", + "updatedTime": "2023-11-13T18:00:00Z", + "createdTime": "2023-11-13T18:00:00Z", + "id": "e465af5f-044f-414b-b670-92834929b96c" +} \ No newline at end of file diff --git a/dockerfiles/docker-compose.infrastructure.override.yml b/dockerfiles/docker-compose.infrastructure.override.yml new file mode 100644 index 00000000..35055873 --- /dev/null +++ b/dockerfiles/docker-compose.infrastructure.override.yml @@ -0,0 +1,31 @@ +version: '3.8' + +services: + mongodb: + environment: + MONGO_INITDB_ROOT_USERNAME: ${ENV_MONGO_INITDB_ROOT_USERNAME} + MONGO_INITDB_ROOT_PASSWORD: ${ENV_MONGO_INITDB_ROOT_PASSWORD} + ports: + - 27017:27017 + + keycloak.localhost: + environment: + - KEYCLOAK_ADMIN=admin + - KEYCLOAK_ADMIN_PASSWORD=admin + - KC_DB=postgres + - KC_DB_URL_HOST=postgresql.localhost + - KC_DB_URL_DATABASE=keycloak + - KC_DB_PASSWORD=123456 + - KC_DB_USERNAME=keycloak + - KC_DB_SCHEMA=public + ports: + - 8080:8080 + + postgresql.localhost: + environment: + # ALLOW_EMPTY_PASSWORD is recommended only for development. + - POSTGRES_PASSWORD=123456 + - POSTGRESQL_USERNAME=keycloak + - POSTGRESQL_DATABASE=keycloak + ports: + - 5432:5432 \ No newline at end of file diff --git a/dockerfiles/docker-compose.infrastructure.yml b/dockerfiles/docker-compose.infrastructure.yml new file mode 100644 index 00000000..d70b7671 --- /dev/null +++ b/dockerfiles/docker-compose.infrastructure.yml @@ -0,0 +1,37 @@ +version: '3' + +services: + mongodb: + image: mongo:7.0-jammy + container_name: botsharp_mongo + volumes: + - mongo7_data_7.0-jammy:/data/db + networks: + - botsharp-network + + keycloak.localhost: + image: quay.io/keycloak/keycloak:22.0.3 + command: start-dev + container_name: keycloak.localhost + depends_on: + - postgresql.localhost + networks: + - botsharp-network + + + postgresql.localhost: + image: docker.io/bitnami/postgresql:16 + container_name: postgresql.localhost + volumes: + - postgres_data_16:/var/lib/postgresql/data + networks: + - botsharp-network + + +volumes: + mongo7_data_7.0-jammy: + postgres_data_16: + +networks: + botsharp-network: + external: true \ No newline at end of file diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml index d2f660bd..57921d9a 100644 --- a/dockerfiles/docker-compose.yml +++ b/dockerfiles/docker-compose.yml @@ -7,11 +7,11 @@ services: context: ../ dockerfile: dockerfiles/WebStarter.Dockerfile ports: - - 8080:8080 + - 5500:5500 env_file: - ./.env volumes: - ./appsettings.json:/app/appsettings.json - networks: ['botsharp-network'] - -networks: {botsharp-network: {}} + - ./data:/app/data + networks: + - botsharp-network diff --git a/dockerfiles/run-docker-compose.ps1 b/dockerfiles/run-docker-compose.ps1 new file mode 100644 index 00000000..a96dab7a --- /dev/null +++ b/dockerfiles/run-docker-compose.ps1 @@ -0,0 +1,2 @@ +docker network create botsharp-network +docker-compose -f docker-compose.yml -f docker-compose.infrastructure.yml -f docker-compose.infrastructure.override.yml up -d \ No newline at end of file diff --git a/dockerfiles/stop-docker-compose.ps1 b/dockerfiles/stop-docker-compose.ps1 new file mode 100644 index 00000000..13fb9360 --- /dev/null +++ b/dockerfiles/stop-docker-compose.ps1 @@ -0,0 +1,2 @@ +docker-compose -f docker-compose.yml -f docker-compose.infrastructure.yml -f docker-compose.infrastructure.override.yml down +docker network rm botsharp-network \ No newline at end of file diff --git a/src/WebStarter/Program.cs b/src/WebStarter/Program.cs index 0bd669ac..4fd7e3a0 100644 --- a/src/WebStarter/Program.cs +++ b/src/WebStarter/Program.cs @@ -20,14 +20,16 @@ Log.Logger = new LoggerConfiguration() .CreateLogger(); builder.Host.UseSerilog(); -// Add BotSharp -builder.Services.AddBotSharpCore(builder.Configuration) - .AddBotSharpOpenAPI(builder.Configuration, new[] +string[] allowedOrigins = builder.Configuration.GetSection("AllowedOrigins").Get() ?? new[] { "http://0.0.0.0:5015", "https://botsharp.scisharpstack.org", "https://chat.scisharpstack.org" - }, builder.Environment, true) + }; + + // Add BotSharp + builder.Services.AddBotSharpCore(builder.Configuration) + .AddBotSharpOpenAPI(builder.Configuration, allowedOrigins, builder.Environment, true) .AddBotSharpLogger(builder.Configuration); // Add SignalR for WebSocket diff --git a/src/WebStarter/appsettings.json b/src/WebStarter/appsettings.json index 132ba6cc..9f6a9ff8 100644 --- a/src/WebStarter/appsettings.json +++ b/src/WebStarter/appsettings.json @@ -6,7 +6,12 @@ } }, "AllowedHosts": "*", - + "AllowedOrigins": [ + "http://localhost:5015", + "http://0.0.0.0:5015", + "https://botsharp.scisharpstack.org", + "https://chat.scisharpstack.org" + ], "Jwt": { "Issuer": "botsharp", "Audience": "botsharp", @@ -38,15 +43,15 @@ { "Name": "gpt-35-turbo", "ApiKey": "", - "Endpoint": "https://ai4c-demo.openai.azure.com/", + "Endpoint": "https://gpt-35-turbo.openai.azure.com/", "Type": "chat", "PromptCost": 0.0015, "CompletionCost": 0.002 }, { - "Name": "gpt-35-turbo", + "Name": "gpt-35-turbo-instruct", "ApiKey": "", - "Endpoint": "https://ai4c-demo.openai.azure.com/", + "Endpoint": "https://gpt-35-turbo-instruct.openai.azure.com/", "Type": "text", "PromptCost": 0.0015, "CompletionCost": 0.002 @@ -100,7 +105,7 @@ "EnableLlmCompletionLog": false, "EnableExecutionLog": true, "EnableContentLog": true, - "EnableStateLog": true + "EnableStateLog": true }, "Statistics": { @@ -156,9 +161,9 @@ }, "Database": { - "Default": "FileRepository", + "Default": "MongoRepository", "TablePrefix": "BotSharp", - "BotSharpMongoDb": "", + "BotSharpMongoDb": "mongodb://root:admin@localhost:27017/botsharp?authSource=admin", "FileRepository": "data", "Assemblies": [ "BotSharp.Core" ] },