Spaces:
Runtime error
Runtime error
MarcoAland
commited on
Commit
•
683a4fb
1
Parent(s):
105873a
add chainlit
Browse files- .chainlit/config.toml +120 -0
- .chainlit/translations/en-US.json +229 -0
- .chainlit/translations/zh-CN.json +229 -0
- Dockerfile +16 -0
- __pycache__/app.cpython-310.pyc +0 -0
- app.py +114 -0
- chainlit.md +14 -0
- requirements.txt +13 -0
.chainlit/config.toml
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
# Whether to enable telemetry (default: true). No personal data is collected.
|
3 |
+
enable_telemetry = true
|
4 |
+
|
5 |
+
|
6 |
+
# List of environment variables to be provided by each user to use the app.
|
7 |
+
user_env = []
|
8 |
+
|
9 |
+
# Duration (in seconds) during which the session is saved when the connection is lost
|
10 |
+
session_timeout = 3600
|
11 |
+
|
12 |
+
# Enable third parties caching (e.g LangChain cache)
|
13 |
+
cache = false
|
14 |
+
|
15 |
+
# Authorized origins
|
16 |
+
allow_origins = ["*"]
|
17 |
+
|
18 |
+
# Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317)
|
19 |
+
# follow_symlink = false
|
20 |
+
|
21 |
+
[features]
|
22 |
+
# Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript)
|
23 |
+
unsafe_allow_html = false
|
24 |
+
|
25 |
+
# Process and display mathematical expressions. This can clash with "$" characters in messages.
|
26 |
+
latex = false
|
27 |
+
|
28 |
+
# Automatically tag threads with the current chat profile (if a chat profile is used)
|
29 |
+
auto_tag_thread = true
|
30 |
+
|
31 |
+
# Authorize users to spontaneously upload files with messages
|
32 |
+
[features.spontaneous_file_upload]
|
33 |
+
enabled = true
|
34 |
+
accept = ["*/*"]
|
35 |
+
max_files = 20
|
36 |
+
max_size_mb = 500
|
37 |
+
|
38 |
+
[features.audio]
|
39 |
+
# Threshold for audio recording
|
40 |
+
min_decibels = -45
|
41 |
+
# Delay for the user to start speaking in MS
|
42 |
+
initial_silence_timeout = 3000
|
43 |
+
# Delay for the user to continue speaking in MS. If the user stops speaking for this duration, the recording will stop.
|
44 |
+
silence_timeout = 1500
|
45 |
+
# Above this duration (MS), the recording will forcefully stop.
|
46 |
+
max_duration = 15000
|
47 |
+
# Duration of the audio chunks in MS
|
48 |
+
chunk_duration = 1000
|
49 |
+
# Sample rate of the audio
|
50 |
+
sample_rate = 44100
|
51 |
+
|
52 |
+
edit_message = true
|
53 |
+
|
54 |
+
[UI]
|
55 |
+
# Name of the assistant.
|
56 |
+
name = "Assistant"
|
57 |
+
|
58 |
+
# Description of the assistant. This is used for HTML tags.
|
59 |
+
# description = ""
|
60 |
+
|
61 |
+
# Large size content are by default collapsed for a cleaner ui
|
62 |
+
default_collapse_content = true
|
63 |
+
|
64 |
+
# Chain of Thought (CoT) display mode. Can be "hidden", "tool_call" or "full".
|
65 |
+
cot = "full"
|
66 |
+
|
67 |
+
# Link to your github repo. This will add a github button in the UI's header.
|
68 |
+
# github = ""
|
69 |
+
|
70 |
+
# Specify a CSS file that can be used to customize the user interface.
|
71 |
+
# The CSS file can be served from the public directory or via an external link.
|
72 |
+
# custom_css = "/public/test.css"
|
73 |
+
|
74 |
+
# Specify a Javascript file that can be used to customize the user interface.
|
75 |
+
# The Javascript file can be served from the public directory.
|
76 |
+
# custom_js = "/public/test.js"
|
77 |
+
|
78 |
+
# Specify a custom font url.
|
79 |
+
# custom_font = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
|
80 |
+
|
81 |
+
# Specify a custom meta image url.
|
82 |
+
# custom_meta_image_url = "https://chainlit-cloud.s3.eu-west-3.amazonaws.com/logo/chainlit_banner.png"
|
83 |
+
|
84 |
+
# Specify a custom build directory for the frontend.
|
85 |
+
# This can be used to customize the frontend code.
|
86 |
+
# Be careful: If this is a relative path, it should not start with a slash.
|
87 |
+
# custom_build = "./public/build"
|
88 |
+
|
89 |
+
[UI.theme]
|
90 |
+
default = "dark"
|
91 |
+
#layout = "wide"
|
92 |
+
#font_family = "Inter, sans-serif"
|
93 |
+
# Override default MUI light theme. (Check theme.ts)
|
94 |
+
[UI.theme.light]
|
95 |
+
#background = "#FAFAFA"
|
96 |
+
#paper = "#FFFFFF"
|
97 |
+
|
98 |
+
[UI.theme.light.primary]
|
99 |
+
#main = "#F80061"
|
100 |
+
#dark = "#980039"
|
101 |
+
#light = "#FFE7EB"
|
102 |
+
[UI.theme.light.text]
|
103 |
+
#primary = "#212121"
|
104 |
+
#secondary = "#616161"
|
105 |
+
|
106 |
+
# Override default MUI dark theme. (Check theme.ts)
|
107 |
+
[UI.theme.dark]
|
108 |
+
#background = "#FAFAFA"
|
109 |
+
#paper = "#FFFFFF"
|
110 |
+
|
111 |
+
[UI.theme.dark.primary]
|
112 |
+
#main = "#F80061"
|
113 |
+
#dark = "#980039"
|
114 |
+
#light = "#FFE7EB"
|
115 |
+
[UI.theme.dark.text]
|
116 |
+
#primary = "#EEEEEE"
|
117 |
+
#secondary = "#BDBDBD"
|
118 |
+
|
119 |
+
[meta]
|
120 |
+
generated_by = "1.1.402"
|
.chainlit/translations/en-US.json
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"components": {
|
3 |
+
"atoms": {
|
4 |
+
"buttons": {
|
5 |
+
"userButton": {
|
6 |
+
"menu": {
|
7 |
+
"settings": "Settings",
|
8 |
+
"settingsKey": "S",
|
9 |
+
"APIKeys": "API Keys",
|
10 |
+
"logout": "Logout"
|
11 |
+
}
|
12 |
+
}
|
13 |
+
}
|
14 |
+
},
|
15 |
+
"molecules": {
|
16 |
+
"newChatButton": {
|
17 |
+
"newChat": "New Chat"
|
18 |
+
},
|
19 |
+
"tasklist": {
|
20 |
+
"TaskList": {
|
21 |
+
"title": "\ud83d\uddd2\ufe0f Task List",
|
22 |
+
"loading": "Loading...",
|
23 |
+
"error": "An error occurred"
|
24 |
+
}
|
25 |
+
},
|
26 |
+
"attachments": {
|
27 |
+
"cancelUpload": "Cancel upload",
|
28 |
+
"removeAttachment": "Remove attachment"
|
29 |
+
},
|
30 |
+
"newChatDialog": {
|
31 |
+
"createNewChat": "Create new chat?",
|
32 |
+
"clearChat": "This will clear the current messages and start a new chat.",
|
33 |
+
"cancel": "Cancel",
|
34 |
+
"confirm": "Confirm"
|
35 |
+
},
|
36 |
+
"settingsModal": {
|
37 |
+
"settings": "Settings",
|
38 |
+
"expandMessages": "Expand Messages",
|
39 |
+
"hideChainOfThought": "Hide Chain of Thought",
|
40 |
+
"darkMode": "Dark Mode"
|
41 |
+
},
|
42 |
+
"detailsButton": {
|
43 |
+
"using": "Using",
|
44 |
+
"used": "Used"
|
45 |
+
},
|
46 |
+
"auth": {
|
47 |
+
"authLogin": {
|
48 |
+
"title": "Login to access the app.",
|
49 |
+
"form": {
|
50 |
+
"email": "Email address",
|
51 |
+
"password": "Password",
|
52 |
+
"noAccount": "Don't have an account?",
|
53 |
+
"alreadyHaveAccount": "Already have an account?",
|
54 |
+
"signup": "Sign Up",
|
55 |
+
"signin": "Sign In",
|
56 |
+
"or": "OR",
|
57 |
+
"continue": "Continue",
|
58 |
+
"forgotPassword": "Forgot password?",
|
59 |
+
"passwordMustContain": "Your password must contain:",
|
60 |
+
"emailRequired": "email is a required field",
|
61 |
+
"passwordRequired": "password is a required field"
|
62 |
+
},
|
63 |
+
"error": {
|
64 |
+
"default": "Unable to sign in.",
|
65 |
+
"signin": "Try signing in with a different account.",
|
66 |
+
"oauthsignin": "Try signing in with a different account.",
|
67 |
+
"redirect_uri_mismatch": "The redirect URI is not matching the oauth app configuration.",
|
68 |
+
"oauthcallbackerror": "Try signing in with a different account.",
|
69 |
+
"oauthcreateaccount": "Try signing in with a different account.",
|
70 |
+
"emailcreateaccount": "Try signing in with a different account.",
|
71 |
+
"callback": "Try signing in with a different account.",
|
72 |
+
"oauthaccountnotlinked": "To confirm your identity, sign in with the same account you used originally.",
|
73 |
+
"emailsignin": "The e-mail could not be sent.",
|
74 |
+
"emailverify": "Please verify your email, a new email has been sent.",
|
75 |
+
"credentialssignin": "Sign in failed. Check the details you provided are correct.",
|
76 |
+
"sessionrequired": "Please sign in to access this page."
|
77 |
+
}
|
78 |
+
},
|
79 |
+
"authVerifyEmail": {
|
80 |
+
"almostThere": "You're almost there! We've sent an email to ",
|
81 |
+
"verifyEmailLink": "Please click on the link in that email to complete your signup.",
|
82 |
+
"didNotReceive": "Can't find the email?",
|
83 |
+
"resendEmail": "Resend email",
|
84 |
+
"goBack": "Go Back",
|
85 |
+
"emailSent": "Email sent successfully.",
|
86 |
+
"verifyEmail": "Verify your email address"
|
87 |
+
},
|
88 |
+
"providerButton": {
|
89 |
+
"continue": "Continue with {{provider}}",
|
90 |
+
"signup": "Sign up with {{provider}}"
|
91 |
+
},
|
92 |
+
"authResetPassword": {
|
93 |
+
"newPasswordRequired": "New password is a required field",
|
94 |
+
"passwordsMustMatch": "Passwords must match",
|
95 |
+
"confirmPasswordRequired": "Confirm password is a required field",
|
96 |
+
"newPassword": "New password",
|
97 |
+
"confirmPassword": "Confirm password",
|
98 |
+
"resetPassword": "Reset Password"
|
99 |
+
},
|
100 |
+
"authForgotPassword": {
|
101 |
+
"email": "Email address",
|
102 |
+
"emailRequired": "email is a required field",
|
103 |
+
"emailSent": "Please check the email address {{email}} for instructions to reset your password.",
|
104 |
+
"enterEmail": "Enter your email address and we will send you instructions to reset your password.",
|
105 |
+
"resendEmail": "Resend email",
|
106 |
+
"continue": "Continue",
|
107 |
+
"goBack": "Go Back"
|
108 |
+
}
|
109 |
+
}
|
110 |
+
},
|
111 |
+
"organisms": {
|
112 |
+
"chat": {
|
113 |
+
"history": {
|
114 |
+
"index": {
|
115 |
+
"showHistory": "Show history",
|
116 |
+
"lastInputs": "Last Inputs",
|
117 |
+
"noInputs": "Such empty...",
|
118 |
+
"loading": "Loading..."
|
119 |
+
}
|
120 |
+
},
|
121 |
+
"inputBox": {
|
122 |
+
"input": {
|
123 |
+
"placeholder": "Type your message here..."
|
124 |
+
},
|
125 |
+
"speechButton": {
|
126 |
+
"start": "Start recording",
|
127 |
+
"stop": "Stop recording"
|
128 |
+
},
|
129 |
+
"SubmitButton": {
|
130 |
+
"sendMessage": "Send message",
|
131 |
+
"stopTask": "Stop Task"
|
132 |
+
},
|
133 |
+
"UploadButton": {
|
134 |
+
"attachFiles": "Attach files"
|
135 |
+
},
|
136 |
+
"waterMark": {
|
137 |
+
"text": "Built with"
|
138 |
+
}
|
139 |
+
},
|
140 |
+
"Messages": {
|
141 |
+
"index": {
|
142 |
+
"running": "Running",
|
143 |
+
"executedSuccessfully": "executed successfully",
|
144 |
+
"failed": "failed",
|
145 |
+
"feedbackUpdated": "Feedback updated",
|
146 |
+
"updating": "Updating"
|
147 |
+
}
|
148 |
+
},
|
149 |
+
"dropScreen": {
|
150 |
+
"dropYourFilesHere": "Drop your files here"
|
151 |
+
},
|
152 |
+
"index": {
|
153 |
+
"failedToUpload": "Failed to upload",
|
154 |
+
"cancelledUploadOf": "Cancelled upload of",
|
155 |
+
"couldNotReachServer": "Could not reach the server",
|
156 |
+
"continuingChat": "Continuing previous chat"
|
157 |
+
},
|
158 |
+
"settings": {
|
159 |
+
"settingsPanel": "Settings panel",
|
160 |
+
"reset": "Reset",
|
161 |
+
"cancel": "Cancel",
|
162 |
+
"confirm": "Confirm"
|
163 |
+
}
|
164 |
+
},
|
165 |
+
"threadHistory": {
|
166 |
+
"sidebar": {
|
167 |
+
"filters": {
|
168 |
+
"FeedbackSelect": {
|
169 |
+
"feedbackAll": "Feedback: All",
|
170 |
+
"feedbackPositive": "Feedback: Positive",
|
171 |
+
"feedbackNegative": "Feedback: Negative"
|
172 |
+
},
|
173 |
+
"SearchBar": {
|
174 |
+
"search": "Search"
|
175 |
+
}
|
176 |
+
},
|
177 |
+
"DeleteThreadButton": {
|
178 |
+
"confirmMessage": "This will delete the thread as well as it's messages and elements.",
|
179 |
+
"cancel": "Cancel",
|
180 |
+
"confirm": "Confirm",
|
181 |
+
"deletingChat": "Deleting chat",
|
182 |
+
"chatDeleted": "Chat deleted"
|
183 |
+
},
|
184 |
+
"index": {
|
185 |
+
"pastChats": "Past Chats"
|
186 |
+
},
|
187 |
+
"ThreadList": {
|
188 |
+
"empty": "Empty...",
|
189 |
+
"today": "Today",
|
190 |
+
"yesterday": "Yesterday",
|
191 |
+
"previous7days": "Previous 7 days",
|
192 |
+
"previous30days": "Previous 30 days"
|
193 |
+
},
|
194 |
+
"TriggerButton": {
|
195 |
+
"closeSidebar": "Close sidebar",
|
196 |
+
"openSidebar": "Open sidebar"
|
197 |
+
}
|
198 |
+
},
|
199 |
+
"Thread": {
|
200 |
+
"backToChat": "Go back to chat",
|
201 |
+
"chatCreatedOn": "This chat was created on"
|
202 |
+
}
|
203 |
+
},
|
204 |
+
"header": {
|
205 |
+
"chat": "Chat",
|
206 |
+
"readme": "Readme"
|
207 |
+
}
|
208 |
+
}
|
209 |
+
},
|
210 |
+
"hooks": {
|
211 |
+
"useLLMProviders": {
|
212 |
+
"failedToFetchProviders": "Failed to fetch providers:"
|
213 |
+
}
|
214 |
+
},
|
215 |
+
"pages": {
|
216 |
+
"Design": {},
|
217 |
+
"Env": {
|
218 |
+
"savedSuccessfully": "Saved successfully",
|
219 |
+
"requiredApiKeys": "Required API Keys",
|
220 |
+
"requiredApiKeysInfo": "To use this app, the following API keys are required. The keys are stored on your device's local storage."
|
221 |
+
},
|
222 |
+
"Page": {
|
223 |
+
"notPartOfProject": "You are not part of this project."
|
224 |
+
},
|
225 |
+
"ResumeButton": {
|
226 |
+
"resumeChat": "Resume Chat"
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
.chainlit/translations/zh-CN.json
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"components": {
|
3 |
+
"atoms": {
|
4 |
+
"buttons": {
|
5 |
+
"userButton": {
|
6 |
+
"menu": {
|
7 |
+
"settings": "\u8bbe\u7f6e",
|
8 |
+
"settingsKey": "S",
|
9 |
+
"APIKeys": "API \u5bc6\u94a5",
|
10 |
+
"logout": "\u767b\u51fa"
|
11 |
+
}
|
12 |
+
}
|
13 |
+
}
|
14 |
+
},
|
15 |
+
"molecules": {
|
16 |
+
"newChatButton": {
|
17 |
+
"newChat": "\u65b0\u5efa\u5bf9\u8bdd"
|
18 |
+
},
|
19 |
+
"tasklist": {
|
20 |
+
"TaskList": {
|
21 |
+
"title": "\ud83d\uddd2\ufe0f \u4efb\u52a1\u5217\u8868",
|
22 |
+
"loading": "\u52a0\u8f7d\u4e2d...",
|
23 |
+
"error": "\u53d1\u751f\u9519\u8bef"
|
24 |
+
}
|
25 |
+
},
|
26 |
+
"attachments": {
|
27 |
+
"cancelUpload": "\u53d6\u6d88\u4e0a\u4f20",
|
28 |
+
"removeAttachment": "\u79fb\u9664\u9644\u4ef6"
|
29 |
+
},
|
30 |
+
"newChatDialog": {
|
31 |
+
"createNewChat": "\u521b\u5efa\u65b0\u5bf9\u8bdd\uff1f",
|
32 |
+
"clearChat": "\u8fd9\u5c06\u6e05\u9664\u5f53\u524d\u6d88\u606f\u5e76\u5f00\u59cb\u65b0\u7684\u5bf9\u8bdd\u3002",
|
33 |
+
"cancel": "\u53d6\u6d88",
|
34 |
+
"confirm": "\u786e\u8ba4"
|
35 |
+
},
|
36 |
+
"settingsModal": {
|
37 |
+
"settings": "\u8bbe\u7f6e",
|
38 |
+
"expandMessages": "\u5c55\u5f00\u6d88\u606f",
|
39 |
+
"hideChainOfThought": "\u9690\u85cf\u601d\u8003\u94fe",
|
40 |
+
"darkMode": "\u6697\u8272\u6a21\u5f0f"
|
41 |
+
},
|
42 |
+
"detailsButton": {
|
43 |
+
"using": "\u4f7f\u7528",
|
44 |
+
"used": "\u5df2\u7528"
|
45 |
+
},
|
46 |
+
"auth": {
|
47 |
+
"authLogin": {
|
48 |
+
"title": "\u767b\u5f55\u4ee5\u8bbf\u95ee\u5e94\u7528\u3002",
|
49 |
+
"form": {
|
50 |
+
"email": "\u7535\u5b50\u90ae\u7bb1\u5730\u5740",
|
51 |
+
"password": "\u5bc6\u7801",
|
52 |
+
"noAccount": "\u6ca1\u6709\u8d26\u6237\uff1f",
|
53 |
+
"alreadyHaveAccount": "\u5df2\u6709\u8d26\u6237\uff1f",
|
54 |
+
"signup": "\u6ce8\u518c",
|
55 |
+
"signin": "\u767b\u5f55",
|
56 |
+
"or": "\u6216\u8005",
|
57 |
+
"continue": "\u7ee7\u7eed",
|
58 |
+
"forgotPassword": "\u5fd8\u8bb0\u5bc6\u7801\uff1f",
|
59 |
+
"passwordMustContain": "\u60a8\u7684\u5bc6\u7801\u5fc5\u987b\u5305\u542b\uff1a",
|
60 |
+
"emailRequired": "\u7535\u5b50\u90ae\u7bb1\u662f\u5fc5\u586b\u9879",
|
61 |
+
"passwordRequired": "\u5bc6\u7801\u662f\u5fc5\u586b\u9879"
|
62 |
+
},
|
63 |
+
"error": {
|
64 |
+
"default": "\u65e0\u6cd5\u767b\u5f55\u3002",
|
65 |
+
"signin": "\u5c1d\u8bd5\u4f7f\u7528\u4e0d\u540c\u7684\u8d26\u6237\u767b\u5f55\u3002",
|
66 |
+
"oauthsignin": "\u5c1d\u8bd5\u4f7f\u7528\u4e0d\u540c\u7684\u8d26\u6237\u767b\u5f55\u3002",
|
67 |
+
"redirect_uri_mismatch": "\u91cd\u5b9a\u5411URI\u4e0eOAuth\u5e94\u7528\u914d\u7f6e\u4e0d\u5339\u914d\u3002",
|
68 |
+
"oauthcallbackerror": "\u5c1d\u8bd5\u4f7f\u7528\u4e0d\u540c\u7684\u8d26\u6237\u767b\u5f55\u3002",
|
69 |
+
"oauthcreateaccount": "\u5c1d\u8bd5\u4f7f\u7528\u4e0d\u540c\u7684\u8d26\u6237\u767b\u5f55\u3002",
|
70 |
+
"emailcreateaccount": "\u5c1d\u8bd5\u4f7f\u7528\u4e0d\u540c\u7684\u8d26\u6237\u767b\u5f55\u3002",
|
71 |
+
"callback": "\u5c1d\u8bd5\u4f7f\u7528\u4e0d\u540c\u7684\u8d26\u6237\u767b\u5f55\u3002",
|
72 |
+
"oauthaccountnotlinked": "\u4e3a\u4e86\u9a8c\u8bc1\u60a8\u7684\u8eab\u4efd\uff0c\u8bf7\u4f7f\u7528\u6700\u521d\u4f7f\u7528\u7684\u540c\u4e00\u8d26\u6237\u767b\u5f55\u3002",
|
73 |
+
"emailsignin": "\u65e0\u6cd5\u53d1\u9001\u90ae\u4ef6\u3002",
|
74 |
+
"emailverify": "\u8bf7\u9a8c\u8bc1\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\uff0c\u5df2\u53d1\u9001\u4e00\u5c01\u65b0\u90ae\u4ef6\u3002",
|
75 |
+
"credentialssignin": "\u767b\u5f55\u5931\u8d25\u3002\u8bf7\u68c0\u67e5\u60a8\u63d0\u4f9b\u7684\u8be6\u7ec6\u4fe1\u606f\u662f\u5426\u6b63\u786e\u3002",
|
76 |
+
"sessionrequired": "\u8bf7\u767b\u5f55\u4ee5\u8bbf\u95ee\u6b64\u9875\u9762\u3002"
|
77 |
+
}
|
78 |
+
},
|
79 |
+
"authVerifyEmail": {
|
80 |
+
"almostThere": "\u60a8\u5feb\u6210\u529f\u4e86\uff01\u6211\u4eec\u5df2\u5411 ",
|
81 |
+
"verifyEmailLink": "\u8bf7\u5355\u51fb\u8be5\u90ae\u4ef6\u4e2d\u7684\u94fe\u63a5\u4ee5\u5b8c\u6210\u6ce8\u518c\u3002",
|
82 |
+
"didNotReceive": "\u6ca1\u627e\u5230\u90ae\u4ef6\uff1f",
|
83 |
+
"resendEmail": "\u91cd\u65b0\u53d1\u9001\u90ae\u4ef6",
|
84 |
+
"goBack": "\u8fd4\u56de",
|
85 |
+
"emailSent": "\u90ae\u4ef6\u5df2\u6210\u529f\u53d1\u9001\u3002",
|
86 |
+
"verifyEmail": "\u9a8c\u8bc1\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u5730\u5740"
|
87 |
+
},
|
88 |
+
"providerButton": {
|
89 |
+
"continue": "\u4f7f\u7528{{provider}}\u7ee7\u7eed",
|
90 |
+
"signup": "\u4f7f\u7528{{provider}}\u6ce8\u518c"
|
91 |
+
},
|
92 |
+
"authResetPassword": {
|
93 |
+
"newPasswordRequired": "\u65b0\u5bc6\u7801\u662f\u5fc5\u586b\u9879",
|
94 |
+
"passwordsMustMatch": "\u5bc6\u7801\u5fc5\u987b\u4e00\u81f4",
|
95 |
+
"confirmPasswordRequired": "\u786e\u8ba4\u5bc6\u7801\u662f\u5fc5\u586b\u9879",
|
96 |
+
"newPassword": "\u65b0\u5bc6\u7801",
|
97 |
+
"confirmPassword": "\u786e\u8ba4\u5bc6\u7801",
|
98 |
+
"resetPassword": "\u91cd\u7f6e\u5bc6\u7801"
|
99 |
+
},
|
100 |
+
"authForgotPassword": {
|
101 |
+
"email": "\u7535\u5b50\u90ae\u7bb1\u5730\u5740",
|
102 |
+
"emailRequired": "\u7535\u5b50\u90ae\u7bb1\u662f\u5fc5\u586b\u9879",
|
103 |
+
"emailSent": "\u8bf7\u68c0\u67e5\u7535\u5b50\u90ae\u7bb1{{email}}\u4ee5\u83b7\u53d6\u91cd\u7f6e\u5bc6\u7801\u7684\u6307\u793a\u3002",
|
104 |
+
"enterEmail": "\u8bf7\u8f93\u5165\u60a8\u7684\u7535\u5b50\u90ae\u7bb1\u5730\u5740\uff0c\u6211\u4eec\u5c06\u53d1\u9001\u91cd\u7f6e\u5bc6\u7801\u7684\u6307\u793a\u3002",
|
105 |
+
"resendEmail": "\u91cd\u65b0\u53d1\u9001\u90ae\u4ef6",
|
106 |
+
"continue": "\u7ee7\u7eed",
|
107 |
+
"goBack": "\u8fd4\u56de"
|
108 |
+
}
|
109 |
+
}
|
110 |
+
},
|
111 |
+
"organisms": {
|
112 |
+
"chat": {
|
113 |
+
"history": {
|
114 |
+
"index": {
|
115 |
+
"showHistory": "\u663e\u793a\u5386\u53f2",
|
116 |
+
"lastInputs": "\u6700\u540e\u8f93\u5165",
|
117 |
+
"noInputs": "\u5982\u6b64\u7a7a\u65f7...",
|
118 |
+
"loading": "\u52a0\u8f7d\u4e2d..."
|
119 |
+
}
|
120 |
+
},
|
121 |
+
"inputBox": {
|
122 |
+
"input": {
|
123 |
+
"placeholder": "\u5728\u8fd9\u91cc\u8f93\u5165\u60a8\u7684\u6d88\u606f..."
|
124 |
+
},
|
125 |
+
"speechButton": {
|
126 |
+
"start": "\u5f00\u59cb\u5f55\u97f3",
|
127 |
+
"stop": "\u505c\u6b62\u5f55\u97f3"
|
128 |
+
},
|
129 |
+
"SubmitButton": {
|
130 |
+
"sendMessage": "\u53d1\u9001\u6d88\u606f",
|
131 |
+
"stopTask": "\u505c\u6b62\u4efb\u52a1"
|
132 |
+
},
|
133 |
+
"UploadButton": {
|
134 |
+
"attachFiles": "\u9644\u52a0\u6587\u4ef6"
|
135 |
+
},
|
136 |
+
"waterMark": {
|
137 |
+
"text": "\u4f7f\u7528"
|
138 |
+
}
|
139 |
+
},
|
140 |
+
"Messages": {
|
141 |
+
"index": {
|
142 |
+
"running": "\u8fd0\u884c\u4e2d",
|
143 |
+
"executedSuccessfully": "\u6267\u884c\u6210\u529f",
|
144 |
+
"failed": "\u5931\u8d25",
|
145 |
+
"feedbackUpdated": "\u53cd\u9988\u66f4\u65b0",
|
146 |
+
"updating": "\u6b63\u5728\u66f4\u65b0"
|
147 |
+
}
|
148 |
+
},
|
149 |
+
"dropScreen": {
|
150 |
+
"dropYourFilesHere": "\u5728\u8fd9\u91cc\u62d6\u653e\u60a8\u7684\u6587\u4ef6"
|
151 |
+
},
|
152 |
+
"index": {
|
153 |
+
"failedToUpload": "\u4e0a\u4f20\u5931\u8d25",
|
154 |
+
"cancelledUploadOf": "\u53d6\u6d88\u4e0a\u4f20",
|
155 |
+
"couldNotReachServer": "\u65e0\u6cd5\u8fde\u63a5\u5230\u670d\u52a1\u5668",
|
156 |
+
"continuingChat": "\u7ee7\u7eed\u4e4b\u524d\u7684\u5bf9\u8bdd"
|
157 |
+
},
|
158 |
+
"settings": {
|
159 |
+
"settingsPanel": "\u8bbe\u7f6e\u9762\u677f",
|
160 |
+
"reset": "\u91cd\u7f6e",
|
161 |
+
"cancel": "\u53d6\u6d88",
|
162 |
+
"confirm": "\u786e\u8ba4"
|
163 |
+
}
|
164 |
+
},
|
165 |
+
"threadHistory": {
|
166 |
+
"sidebar": {
|
167 |
+
"filters": {
|
168 |
+
"FeedbackSelect": {
|
169 |
+
"feedbackAll": "\u53cd\u9988\uff1a\u5168\u90e8",
|
170 |
+
"feedbackPositive": "\u53cd\u9988\uff1a\u6b63\u9762",
|
171 |
+
"feedbackNegative": "\u53cd\u9988\uff1a\u8d1f\u9762"
|
172 |
+
},
|
173 |
+
"SearchBar": {
|
174 |
+
"search": "\u641c\u7d22"
|
175 |
+
}
|
176 |
+
},
|
177 |
+
"DeleteThreadButton": {
|
178 |
+
"confirmMessage": "\u8fd9\u5c06\u5220\u9664\u7ebf\u7a0b\u53ca\u5176\u6d88\u606f\u548c\u5143\u7d20\u3002",
|
179 |
+
"cancel": "\u53d6\u6d88",
|
180 |
+
"confirm": "\u786e\u8ba4",
|
181 |
+
"deletingChat": "\u5220\u9664\u5bf9\u8bdd",
|
182 |
+
"chatDeleted": "\u5bf9\u8bdd\u5df2\u5220\u9664"
|
183 |
+
},
|
184 |
+
"index": {
|
185 |
+
"pastChats": "\u8fc7\u5f80\u5bf9\u8bdd"
|
186 |
+
},
|
187 |
+
"ThreadList": {
|
188 |
+
"empty": "\u7a7a\u7684...",
|
189 |
+
"today": "\u4eca\u5929",
|
190 |
+
"yesterday": "\u6628\u5929",
|
191 |
+
"previous7days": "\u524d7\u5929",
|
192 |
+
"previous30days": "\u524d30\u5929"
|
193 |
+
},
|
194 |
+
"TriggerButton": {
|
195 |
+
"closeSidebar": "\u5173\u95ed\u4fa7\u8fb9\u680f",
|
196 |
+
"openSidebar": "\u6253\u5f00\u4fa7\u8fb9\u680f"
|
197 |
+
}
|
198 |
+
},
|
199 |
+
"Thread": {
|
200 |
+
"backToChat": "\u8fd4\u56de\u5bf9\u8bdd",
|
201 |
+
"chatCreatedOn": "\u6b64\u5bf9\u8bdd\u521b\u5efa\u4e8e"
|
202 |
+
}
|
203 |
+
},
|
204 |
+
"header": {
|
205 |
+
"chat": "\u5bf9\u8bdd",
|
206 |
+
"readme": "\u8bf4\u660e"
|
207 |
+
}
|
208 |
+
}
|
209 |
+
},
|
210 |
+
"hooks": {
|
211 |
+
"useLLMProviders": {
|
212 |
+
"failedToFetchProviders": "\u83b7\u53d6\u63d0\u4f9b\u8005\u5931\u8d25:"
|
213 |
+
}
|
214 |
+
},
|
215 |
+
"pages": {
|
216 |
+
"Design": {},
|
217 |
+
"Env": {
|
218 |
+
"savedSuccessfully": "\u4fdd\u5b58\u6210\u529f",
|
219 |
+
"requiredApiKeys": "\u5fc5\u9700\u7684API\u5bc6\u94a5",
|
220 |
+
"requiredApiKeysInfo": "\u8981\u4f7f\u7528\u6b64\u5e94\u7528\uff0c\u9700\u8981\u4ee5\u4e0bAPI\u5bc6\u94a5\u3002\u8fd9\u4e9b\u5bc6\u94a5\u5b58\u50a8\u5728\u60a8\u7684\u8bbe\u5907\u672c\u5730\u5b58\u50a8\u4e2d\u3002"
|
221 |
+
},
|
222 |
+
"Page": {
|
223 |
+
"notPartOfProject": "\u60a8\u4e0d\u662f\u6b64\u9879\u76ee\u7684\u4e00\u90e8\u5206\u3002"
|
224 |
+
},
|
225 |
+
"ResumeButton": {
|
226 |
+
"resumeChat": "\u6062\u590d\u5bf9\u8bdd"
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
Dockerfile
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
RUN useradd -m -u 1000 user
|
4 |
+
USER user
|
5 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
+
|
7 |
+
WORKDIR /app
|
8 |
+
|
9 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
11 |
+
|
12 |
+
RUN gdown https://drive.google.com/drive/folders/1XTzw74gtKAdSlvl-2LqYFmwUXCR6_FnQ?usp=sharing -O data --folder
|
13 |
+
|
14 |
+
|
15 |
+
COPY --chown=user . /app
|
16 |
+
CMD ["chainlit", "run", "app.py", "--port", "7860"]
|
__pycache__/app.cpython-310.pyc
ADDED
Binary file (3.75 kB). View file
|
|
app.py
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### RAG code
|
2 |
+
# Embedding model builder
|
3 |
+
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
4 |
+
from llama_index.core import Settings, SimpleDirectoryReader, VectorStoreIndex
|
5 |
+
from llama_index.core.retrievers import VectorIndexRetriever
|
6 |
+
from llama_index.core.query_engine import RetrieverQueryEngine
|
7 |
+
from llama_index.core.postprocessor import SimilarityPostprocessor
|
8 |
+
|
9 |
+
def set_embed_model(model_name: str,
|
10 |
+
chunk_size: int = 256,
|
11 |
+
chunk_overlap: int = 25) -> None:
|
12 |
+
Settings.llm = None
|
13 |
+
Settings.embed_model = HuggingFaceEmbedding(model_name=model_name)
|
14 |
+
Settings.chunk_size = chunk_size
|
15 |
+
Settings.chunk_overlap = chunk_overlap
|
16 |
+
|
17 |
+
class RAGModule:
|
18 |
+
def __init__(self,
|
19 |
+
llm_model: str = "MarcoAland/llama3.1-rag-indo",
|
20 |
+
embedding_model: str = "MarcoAland/Indo-bge-m3",
|
21 |
+
docs_path: str = "data",
|
22 |
+
top_k: int = 3,
|
23 |
+
similarity_cutoff: float = 0.4):
|
24 |
+
|
25 |
+
# Define embedding model
|
26 |
+
set_embed_model(model_name=embedding_model)
|
27 |
+
|
28 |
+
# Set vector DB
|
29 |
+
documents = SimpleDirectoryReader(docs_path).load_data()
|
30 |
+
index = VectorStoreIndex.from_documents(documents)
|
31 |
+
retriever = VectorIndexRetriever(
|
32 |
+
index=index,
|
33 |
+
similarity_top_k=top_k,
|
34 |
+
)
|
35 |
+
|
36 |
+
self.top_k = top_k
|
37 |
+
self.query_engine = RetrieverQueryEngine(
|
38 |
+
retriever=retriever,
|
39 |
+
node_postprocessors=[SimilarityPostprocessor(similarity_cutoff=similarity_cutoff)]
|
40 |
+
)
|
41 |
+
|
42 |
+
def format_context(self, response):
|
43 |
+
context = "Jawab dengan akurat\n\nContext:\n"
|
44 |
+
for i in range(self.top_k):
|
45 |
+
context += response.source_nodes[i].text + "\n\n"
|
46 |
+
return context
|
47 |
+
|
48 |
+
def query(self, query: str):
|
49 |
+
try:
|
50 |
+
response = self.query_engine.query(query)
|
51 |
+
context = self.format_context(response)
|
52 |
+
return context
|
53 |
+
except:
|
54 |
+
return ""
|
55 |
+
|
56 |
+
def prompt(self, context: str, instruction: str):
|
57 |
+
return f"{context}\n ### Instruksi:\n {instruction}"
|
58 |
+
|
59 |
+
def main(self, instruction: str):
|
60 |
+
context = self.query(query=instruction)
|
61 |
+
prompt = self.prompt(context=context, instruction=instruction)
|
62 |
+
return prompt
|
63 |
+
|
64 |
+
|
65 |
+
### Chainlit code
|
66 |
+
import chainlit as cl
|
67 |
+
from openai import AsyncOpenAI
|
68 |
+
|
69 |
+
RAG_Trwira = RAGModule()
|
70 |
+
|
71 |
+
# Configure the async OpenAI client
|
72 |
+
client = AsyncOpenAI(api_key="34.69.9.203", base_url="http://34.69.9.203:11434/v1")
|
73 |
+
|
74 |
+
settings = {
|
75 |
+
"model": "MarcoAland/llama3.1-rag-indo",
|
76 |
+
"temperature":0.3,
|
77 |
+
"max_tokens": 2048,
|
78 |
+
}
|
79 |
+
|
80 |
+
@cl.on_chat_start
|
81 |
+
async def start_chat():
|
82 |
+
# Display a title in the UI using Markdown
|
83 |
+
await cl.Message(content="# Hai, namaku Mitrakara👋\n\n ## Selamat datang!\n\nSiap menjadi partner dalam berkarya didunia profesional😊").send()
|
84 |
+
|
85 |
+
@cl.on_message
|
86 |
+
async def main(message: cl.Message):
|
87 |
+
if "document:" in message.content.lower() or "documents:" in message.content.lower():
|
88 |
+
# Prepare the message with documents context
|
89 |
+
prompt = RAG_Trwira.main(message.content[10:]) #slice the "documents" command
|
90 |
+
else:
|
91 |
+
# Without documents context
|
92 |
+
prompt = message.content
|
93 |
+
|
94 |
+
# Sanity check
|
95 |
+
# print(prompt)
|
96 |
+
|
97 |
+
# Format the messages as a list of message dictionaries
|
98 |
+
message_formated = [
|
99 |
+
{"role": "user", "content": prompt}
|
100 |
+
]
|
101 |
+
|
102 |
+
# Create an initial empty message to send back to the user
|
103 |
+
msg = cl.Message(content="")
|
104 |
+
await msg.send()
|
105 |
+
|
106 |
+
# Use streaming to handle partial responses
|
107 |
+
stream = await client.chat.completions.create(messages=message_formated, stream=True, **settings)
|
108 |
+
|
109 |
+
async for part in stream:
|
110 |
+
if token := part.choices[0].delta.content or "":
|
111 |
+
await msg.stream_token(token)
|
112 |
+
|
113 |
+
# Update the message after streaming completion
|
114 |
+
await msg.update()
|
chainlit.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Welcome to Chainlit! 🚀🤖
|
2 |
+
|
3 |
+
Hi there, Developer! 👋 We're excited to have you on board. Chainlit is a powerful tool designed to help you prototype, debug and share applications built on top of LLMs.
|
4 |
+
|
5 |
+
## Useful Links 🔗
|
6 |
+
|
7 |
+
- **Documentation:** Get started with our comprehensive [Chainlit Documentation](https://docs.chainlit.io) 📚
|
8 |
+
- **Discord Community:** Join our friendly [Chainlit Discord](https://discord.gg/k73SQ3FyUh) to ask questions, share your projects, and connect with other developers! 💬
|
9 |
+
|
10 |
+
We can't wait to see what you create with Chainlit! Happy coding! 💻😊
|
11 |
+
|
12 |
+
## Welcome screen
|
13 |
+
|
14 |
+
To modify the welcome screen, edit the `chainlit.md` file at the root of your project. If you do not want a welcome screen, just leave this file empty.
|
requirements.txt
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
chainlit
|
2 |
+
gdown
|
3 |
+
llama-cloud==0.0.13
|
4 |
+
llama-index==0.10.64
|
5 |
+
llama-index-embeddings-huggingface==0.2.3
|
6 |
+
llama-index-cli==0.1.13
|
7 |
+
llama-index-core==0.10.64
|
8 |
+
llama-index-legacy==0.9.48
|
9 |
+
llama-index-llms-openai==0.1.29
|
10 |
+
llama-index-readers-file==0.1.33
|
11 |
+
llama-index-readers-llama-parse==0.1.6
|
12 |
+
llama-parse==0.4.9
|
13 |
+
openai
|