rafaaa2105 commited on
Commit
01c5d61
Β·
verified Β·
1 Parent(s): c217e75

Upload 4 files

Browse files
Files changed (4) hide show
  1. README.md +13 -10
  2. app.py +9 -0
  3. chainlit.md +14 -0
  4. index.html +20 -0
README.md CHANGED
@@ -1,10 +1,13 @@
1
- ---
2
- title: Chainlit
3
- emoji: πŸ’»
4
- colorFrom: green
5
- colorTo: yellow
6
- sdk: docker
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
1
+ # Software Copilot with Chainlit
2
+
3
+ Run the chainlit application:
4
+
5
+ ```shell
6
+ chainlit run app.py -h
7
+ ```
8
+
9
+ Serve the `index.html` file:
10
+
11
+ ```shell
12
+ npx http-server
13
+ ```
app.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import chainlit as cl
2
+
3
+
4
+ @cl.on_message
5
+ async def on_message(msg: cl.Message):
6
+ if cl.context.session.client_type == "copilot":
7
+ fn = cl.CopilotFunction(name="test", args={"msg": msg.content})
8
+ res = await fn.acall()
9
+ await cl.Message(content=res).send()
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.
index.html ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <meta charset="UTF-8" />
4
+ </head>
5
+ <body>
6
+ <h1>Chainlit Copilot Test</h1>
7
+ <script src="http://localhost:8000/copilot/index.js"></script>
8
+ <script>
9
+ window.mountChainlitWidget({
10
+ chainlitServer: "http://localhost:8000",
11
+ });
12
+ window.addEventListener("chainlit-call-fn", (e) => {
13
+ const { name, args, callback } = e.detail;
14
+ if (name === "test") {
15
+ callback("You sent: " + args.msg);
16
+ }
17
+ });
18
+ </script>
19
+ </body>
20
+ </html>