Skip to content

Commit c2a81fe

Browse files
committed
feat: add docker compose file
1、docker file 2、docker compose with MongoRepository and keycloak sso
1 parent f342498 commit c2a81fe

File tree

64 files changed

+1054
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1054
-25
lines changed

dockerfiles/.env

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
1+
# MongoDB Configuration
2+
ENV_MONGO_DB_HOST=botsharp_mongo
3+
ENV_MONGO_DB_PORT=27017
4+
ENV_MONGO_DB_DATABASE=botsharp
5+
ENV_MONGO_INITDB_ROOT_USERNAME=root
6+
ENV_MONGO_INITDB_ROOT_PASSWORD=admin
7+
ASPNETCORE_HTTP_PORTS=5500
28

39

410

dockerfiles/Readme.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Run Container
2+
3+
# Prerequisites:
4+
1. Install Powershell
5+
2. Install Docker Environment
6+
7+
# start container
8+
9+
```
10+
run-docker-compose.ps1
11+
```
12+
13+
# stop container
14+
```
15+
stop-docker-compose.ps1
16+
```

dockerfiles/WebStarter.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
44
USER app
55
WORKDIR /app
6-
EXPOSE 8080
6+
EXPOSE 5500
77

88
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
99
ARG BUILD_CONFIGURATION=Release

dockerfiles/appsettings.json

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,32 @@
66
}
77
},
88
"AllowedHosts": "*",
9+
"AllowedOrigins": [
10+
"http://localhost:5015"
11+
],
912

1013
"Jwt": {
1114
"Issuer": "botsharp",
1215
"Audience": "botsharp",
13-
"Key": "31ba6052aa6f4569901facc3a41fcb4a"
16+
"Key": "31ba6052aa6f4569901facc3a41fcb4adfd9b46dd00c40af8a753fbdc2b89869"
17+
},
18+
19+
"OAuth": {
20+
"GitHub": {
21+
"ClientId": "",
22+
"ClientSecret": ""
23+
},
24+
"Google": {
25+
"ClientId": "",
26+
"ClientSecret": ""
27+
},
28+
"Keycloak": {
29+
"BaseAddress": "http://keycloak.localhost:8080",
30+
"Realm": "master",
31+
"ClientId": "botsharp",
32+
"ClientSecret": "36FeOoyZzkOWrRZLmhwxplC2kGbFGn68",
33+
"Version": 22
34+
}
1435
},
1536

1637
"LlmProviders": [
@@ -26,14 +47,36 @@
2647
"CompletionCost": 0.002
2748
},
2849
{
29-
"Name": "gpt-35-turbo",
50+
"Name": "gpt-35-turbo-instruct",
3051
"ApiKey": "",
31-
"Endpoint": "https://ai4c-demo.openai.azure.com/",
52+
"Endpoint": "https://gpt-35-turbo-instruct.openai.azure.com/",
3253
"Type": "text",
3354
"PromptCost": 0.0015,
3455
"CompletionCost": 0.002
3556
}
3657
]
58+
},
59+
{
60+
"Provider": "llama-sharp",
61+
"Models": [
62+
{
63+
"Name": "llama-2-7b-guanaco-qlora.Q2_K.gguf",
64+
"Type": "chat"
65+
}
66+
]
67+
},
68+
{
69+
"Provider": "huggingface",
70+
"Models": [
71+
{
72+
"Name": "mistralai/Mistral-7B-v0.1",
73+
"Type": "text"
74+
},
75+
{
76+
"Name": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
77+
"Type": "text"
78+
}
79+
]
3780
}
3881
],
3982

@@ -58,7 +101,13 @@
58101
"DataDir": "conversations",
59102
"ShowVerboseLog": false,
60103
"EnableLlmCompletionLog": false,
61-
"EnableExecutionLog": true
104+
"EnableExecutionLog": true,
105+
"EnableContentLog": true,
106+
"EnableStateLog": true
107+
},
108+
109+
"Statistics": {
110+
"DataDir": "stats"
62111
},
63112

64113
"LlamaSharp": {
@@ -110,9 +159,9 @@
110159
},
111160

112161
"Database": {
113-
"Default": "FileRepository",
162+
"Default": "MongoRepository",
114163
"TablePrefix": "BotSharp",
115-
"BotSharpMongoDb": "",
164+
"BotSharpMongoDb": "mongodb://root:admin@botsharp_mongo:27017/botsharp?authSource=admin&authMechanism=SCRAM-SHA-256",
116165
"FileRepository": "data",
117166
"Assemblies": [ "BotSharp.Core" ]
118167
},
@@ -139,8 +188,10 @@
139188

140189
"PluginLoader": {
141190
"Assemblies": [
142-
"BotSharp.Plugin.MongoStorage",
143191
"BotSharp.Core",
192+
"BotSharp.Logger",
193+
"BotSharp.Plugin.MongoStorage",
194+
"BotSharp.Plugin.Dashboard",
144195
"BotSharp.Plugin.AzureOpenAI",
145196
"BotSharp.Plugin.GoogleAI",
146197
"BotSharp.Plugin.MetaAI",
@@ -155,4 +206,4 @@
155206
"BotSharp.Plugin.LLamaSharp"
156207
]
157208
}
158-
}
209+
}

dockerfiles/botsharp.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"clientId": "botsharp",
3+
"name": "botsharp 登陆",
4+
"description": "",
5+
"rootUrl": "http://localhost:5500",
6+
"adminUrl": "http://localhost:5500",
7+
"baseUrl": "http://localhost:5500",
8+
"surrogateAuthRequired": false,
9+
"enabled": true,
10+
"alwaysDisplayInConsole": true,
11+
"clientAuthenticatorType": "client-secret",
12+
"secret": "36FeOoyZzkOWrRZLmhwxplC2kGbFGn68",
13+
"redirectUris": [
14+
"http://localhost:5500/*"
15+
],
16+
"webOrigins": [
17+
"http://localhost:5500"
18+
],
19+
"notBefore": 0,
20+
"bearerOnly": false,
21+
"consentRequired": false,
22+
"standardFlowEnabled": true,
23+
"implicitFlowEnabled": false,
24+
"directAccessGrantsEnabled": true,
25+
"serviceAccountsEnabled": false,
26+
"publicClient": false,
27+
"frontchannelLogout": true,
28+
"protocol": "openid-connect",
29+
"attributes": {
30+
"client.secret.creation.time": "1708154349",
31+
"oauth2.device.authorization.grant.enabled": "false",
32+
"backchannel.logout.revoke.offline.tokens": "false",
33+
"use.refresh.tokens": "true",
34+
"oidc.ciba.grant.enabled": "false",
35+
"backchannel.logout.session.required": "true",
36+
"client_credentials.use_refresh_token": "false",
37+
"tls.client.certificate.bound.access.tokens": "false",
38+
"require.pushed.authorization.requests": "false",
39+
"acr.loa.map": "{}",
40+
"display.on.consent.screen": "false",
41+
"token.response.type.bearer.lower-case": "false"
42+
},
43+
"authenticationFlowBindingOverrides": {},
44+
"fullScopeAllowed": true,
45+
"nodeReRegistrationTimeout": -1,
46+
"defaultClientScopes": [
47+
"web-origins",
48+
"acr",
49+
"profile",
50+
"roles",
51+
"email"
52+
],
53+
"optionalClientScopes": [
54+
"address",
55+
"phone",
56+
"offline_access",
57+
"microprofile-jwt"
58+
],
59+
"access": {
60+
"view": true,
61+
"configure": true,
62+
"manage": true
63+
}
64+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"id": "01e2fc5c-2c89-4ec7-8470-7688608b496c",
3+
"name": "Chatbot",
4+
"description": "Chatbot is used to test the performance of different large models and does not interact with external APIs.",
5+
"type": "task",
6+
"createdDateTime": "2024-01-15T10:39:32Z",
7+
"updatedDateTime": "2024-01-15T14:39:32Z",
8+
"iconUrl": "/images/logo.png",
9+
"disabled": false,
10+
"isPublic": true
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
You are a AI Assistant. You can answer user's question.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"id": "01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a",
3+
"name": "AI Assistant",
4+
"description": "AI assistant that can complete many different tasks",
5+
"type": "routing",
6+
"createdDateTime": "2023-08-18T10:39:32.2349685Z",
7+
"updatedDateTime": "2023-08-18T14:39:32.2349686Z",
8+
"iconUrl": "https://cdn.iconscout.com/icon/premium/png-256-thumb/route-1613278-1368497.png",
9+
"disabled": false,
10+
"isPublic": true,
11+
"profiles": [ "tool" ],
12+
"routingRules": [
13+
{
14+
"type": "planner",
15+
"field": "HFPlanner"
16+
}
17+
]
18+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
You're {{router.name}} ({{router.description}}). Follow these steps to handle user request:
2+
1. Read the [CONVERSATION] content.
3+
2. Select a appropriate function from [FUNCTIONS].
4+
3. Determine which agent is suitable to handle this conversation.
5+
4. Re-think on whether the function you chose matches the reason.
6+
5. For agent required arguments, leave it as blank object if user doesn't provide it.
7+
6. Response must be in JSON format.
8+
9+
[FUNCTIONS]
10+
{% for handler in routing_handlers %}
11+
# {{ handler.description}}
12+
{% if handler.parameters and handler.parameters != empty -%}
13+
Parameters:
14+
- function: {{ handler.name }}
15+
{% for p in handler.parameters -%}
16+
- {{ p.name }}: {{ p.description }}{{ "\r\n " }}
17+
{%- endfor %}
18+
{%- endif %}
19+
{% endfor %}
20+
21+
[AGENTS]
22+
{% for agent in routing_agents %}
23+
* Agent: {{ agent.name }}
24+
{{ agent.description}}
25+
{% if agent.required_fields and agent.required_fields != empty -%}
26+
Required args:
27+
{% for f in agent.required_fields -%}
28+
- {{ f.name }} (type: {{ f.type }}): {{ f.description }}{{ "\r\n " }}
29+
{%- endfor %}
30+
{%- endif %}
31+
{% if agent.optional_fields and agent.optional_fields != empty -%}
32+
Optional args:
33+
{% for f in agent.optional_fields -%}
34+
- {{ f.name }} (type: {{ f.type }}): {{ f.description }}{{ "\r\n " }}
35+
{%- endfor %}
36+
{%- endif %}
37+
{% endfor %}
38+
39+
[CONVERSATION]
40+
{{ conversation }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[
2+
{
3+
"text": "Hello, I'm an AI assistant that help you do variety of tasks."
4+
},
5+
{
6+
"rich_type": "quick_reply",
7+
"text": "How can I help you today?",
8+
"quick_replies": [
9+
{
10+
"title":"Access website",
11+
"payload":"Launch Browser"
12+
},
13+
{
14+
"title":"Who are you?",
15+
"payload":"who are you?"
16+
}
17+
]
18+
}
19+
]

0 commit comments

Comments
 (0)