Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Markdown supports #4

Merged
merged 10 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,25 @@ target/
.DS_Store
._.DS_Store

config.json
# Docker Files
mnt
data
docker-compose.dev.yml

# TeleGPT Default Config Files
*.config.json
config.json

# Visual Studio Code Configurations
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix
23 changes: 23 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "TeleGPT Nightly",
"cargo": {
"args": ["build", "--bin=telegpt", "--package=telegpt"],
"filter": {
"name": "telegpt",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "full",
"RUST_LOG": "DEBUG"
}
}
]
}
32 changes: 30 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ strip = true

[dependencies]
teloxide = { version = "0.12", features = ["macros"] }
async-openai = "0.8"
async-openai = "0.9"
tokio = { version = "1", features = ["full"] }
futures = "0.3"
pin-project-lite = "0.2"
Expand All @@ -34,4 +34,5 @@ env_logger = "0.10"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
paste = "1.0"
clap = { version = "4.0", features = ["derive"] }
clap = { version = "4.0", features = ["derive"] }
pulldown-cmark = "0.9"
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ TeleGPT is a Telegram bot based on [**teloxide**](https://github.com/teloxide/te

## Features

🦀 **Lightning fast** with pure Rust codebase.<br>
📢 **All types of chat** (private and group) supports.<br>
🚀 **Live streaming tokens** to your message bubble.<br>
💸 **Token usage** statistic recording and queryable via commands.<br>
⚙️ **Fully customizable** with file-based configuration.<br>
🦀 **Lightning fast** with pure Rust codebase.
📢 **All types of chat** (private and group) supports.
🚀 **Live streaming tokens** to your message bubble.
⌨️ **Telegram-flavoured Markdown** rendering supports.
💸 **Token usage** statistic recording and queryable via commands.
⚙️ **Fully customizable** with file-based configuration.
✋ **Admin features** (Beta) and user access control supports.

## Getting TeleGPT
Expand Down
8 changes: 8 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ pub struct Config {
#[serde(default = "default_conversation_limit", rename = "conversationLimit")]
pub conversation_limit: u64,

/// A boolean value that indicates whether to parse and render the
/// markdown contents. When set to `false`, the raw contents returned
/// from OpenAI will be displayed. This is default to `false`.
/// JSON key: `rendersMarkdown`
#[serde(default = "default_renders_markdown", rename = "rendersMarkdown")]
pub renders_markdown: bool,

/// A path for storing the database, [`None`] for in-memory database.
/// JSON key: `databasePath`
#[serde(rename = "databasePath")]
Expand Down Expand Up @@ -142,6 +149,7 @@ define_defaults! {
openai_api_timeout: u64 = 10,
stream_throttle_interval: u64 = 500,
conversation_limit: u64 = 20,
renders_markdown: bool = false,
}

define_defaults!(I18nStrings {
Expand Down
Loading