Skip to content

Commit

Permalink
add documents
Browse files Browse the repository at this point in the history
  • Loading branch information
MarchLiu committed Aug 22, 2024
1 parent 16726cd commit e6810a2
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 4 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ litchi is a ai client for jupyter lab
## Requirements

- JupyterLab >= 4.0.0
- Ollama at http://localhost:11434

## Install

Expand All @@ -26,6 +27,24 @@ To remove the extension, execute:
pip uninstall litchi
```

## How to use it

After install success. Just start `jupyter lab` in your computer and create a notebook.

You can see the toolbar in jupyterlab notebook:

![Loaded](./doc/images/loaded.png)

Now, we can write content and choice a model from model list in toolbar.

![Loaded](./doc/images/chat.png)

And then use command palette or click the "send activate cell" button

Wait a moment. The replay will place into a new cell below current.

![Loaded](./doc/images/replay.png)

## Contributing

### Development install
Expand Down
57 changes: 57 additions & 0 deletions demo.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "6fe97655-002f-48a3-8732-1f05f7a50b05",
"metadata": {},
"source": [
"# A Magic Furit \n",
"\n",
"Tell me somthing about lichi."
]
},
{
"cell_type": "markdown",
"id": "2b015bf0-a303-4aaa-a8da-848f62970e3e",
"metadata": {},
"source": [
"Lychee (Litchi chinensis), also spelled as lichi, is a tropical fruit native to southern China and is one of the oldest cultivated tree species in the world. Here are some interesting facts and information about lychees:\n",
"\n",
"1. **Appearance**: Lychees have a unique appearance with their red or pinkish-red rind that's rough-textured but thin and easily removable, revealing a translucent white fruit inside.\n",
"\n",
"2. **Taste**: The flesh of a lychee is sweet and juicy with a floral aroma similar to grapes combined with rosewater. It can be enjoyed fresh, canned in syrup, or used in various dishes like salads, cocktails, desserts, and even savory dishes.\n",
"\n",
"3. **Nutritional Value**: Lychees are rich in vitamin C, B vitamins, potassium, copper, zinc, and other minerals. They also contain antioxidants that may have health benefits.\n",
"\n",
"4. **Cultivation**: The tree can grow up to 10 meters tall and requires a tropical climate with high humidity. It is grown in various parts of Asia including China, India, Thailand, and Vietnam, as well as in Hawaii and some parts of the United States like Florida.\n",
"\n",
"5. **Health Benefits**: Some studies suggest that lychees may have anti-inflammatory properties due to their flavonoid content. However, they are also associated with a rare condition known as \"lychee disease\" where unripe or overconsumption can lead to hypoglycemia in children.\n",
"\n",
"6. **Cultural Significance**: In Chinese culture, lychees symbolize luck and prosperity due to the pronunciation of their name which sounds similar to words meaning “having enough.”\n",
"\n",
"Lychees are a delightful tropical fruit enjoyed for their unique taste and health benefits around the world."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Binary file added doc/images/chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/command.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/loaded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/replay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[aliases]
release = register sdist bdist_egg upload

34 changes: 33 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
__import__("setuptools").setup()
# __import__("setuptools").setup()
from setuptools import setup
from pathlib import Path

this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()

setup(name="pyparsec",
version="0.1.0",
description="Litchi is a Jupyterlab extension for AI Client",
long_description=long_description,
long_description_content_type='text/markdown',
author="marsliu",
author_email="[email protected]",
url="https://github.com/MarchLiu/litchi",
license="MIT",
packages=["litchi"],
package_dir={
"ui": "src",
"litchi": "litchi"
},
keywords= ["jupyter", "jupyterlab", "jupyterlab-extension", "ai", "ollama"],
classifiers=[
"Topic :: Utilities",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3 :: Only",
"License :: OSI Approved :: MIT License"
]
)
7 changes: 4 additions & 3 deletions src/toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ function ModelsComponent(props: { app: JupyterFrontEnd; state: IStateDB }) {

return (
<span>
Litchi Toolbar
<label htmlFor="model-select">选择模型:</label>
{'(*☻-☻*)'}{' '}
<label htmlFor="model-select"> Select Model:</label>
<select id="model-select" value={selectedModel} onChange={handleChange}>
{models.map(model => (
<option key={model} value={model}>
Expand All @@ -63,7 +63,8 @@ function ModelsComponent(props: { app: JupyterFrontEnd; state: IStateDB }) {
*/
export class WidgetExtension
extends ReactWidget
implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel> {
implements DocumentRegistry.IWidgetExtension<NotebookPanel, INotebookModel>
{
private readonly state: IStateDB;
private readonly app: JupyterFrontEnd;

Expand Down

0 comments on commit e6810a2

Please sign in to comment.