forked from GaiZhenbiao/ChuanhuChatGPT
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…iZhenbiao#193 (GaiZhenbiao#135) * 增加代码高亮功能 * 引入了Pygments库用以高亮,但我不确定是不是真的必要; * 可以从此处挑选喜欢的样式告诉我: https://pygments.org/styles/ ,目前选用了monokai. * 是否可以完全剔除parse_text有待商榷. * 增加表格markdown渲染 * 增加基本表格CSS * 调整parse_text函数 * refractor: 重写了parse_text 但是我真的好久没写代码了,不清楚这样有没有问题。 update utils * 根据新的对话框样式调整了代码框样式 * 重写parse_text 现在是挤压连续多个`\n`为单个`\n` * 将css代码从`presets.py`中分离出来,方便修改 * 再重写 parse_text 现在是真的只替换代码块中的多余空行了。。。 这下总可以了吧QAQ * 修复实时代码块 --------- Co-authored-by: Chuan Hu <[email protected]> Co-authored-by: mzlegion <[email protected]>
- Loading branch information
1 parent
76e70d9
commit 9c7114f
Showing
5 changed files
with
155 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
#status_display { | ||
display: flex; | ||
min-height: 2.5em; | ||
align-items: flex-end; | ||
justify-content: flex-end; | ||
} | ||
#status_display p { | ||
font-size: .85em; | ||
font-family: monospace; | ||
color: var(--text-color-subdued) !important; | ||
} | ||
[class *= "message"] { | ||
border-radius: var(--radius-xl) !important; | ||
border: none; | ||
padding: var(--spacing-xl) !important; | ||
font-size: var(--text-md) !important; | ||
line-height: var(--line-md) !important; | ||
} | ||
[data-testid = "bot"] { | ||
max-width: 85%; | ||
border-bottom-left-radius: 0 !important; | ||
} | ||
[data-testid = "user"] { | ||
max-width: 85%; | ||
width: auto !important; | ||
border-bottom-right-radius: 0 !important; | ||
} | ||
table { | ||
margin: 1em 0; | ||
border-collapse: collapse; | ||
empty-cells: show; | ||
} | ||
td,th { | ||
border: 1.2px solid var(--color-border-primary) !important; | ||
padding: 0.2em; | ||
} | ||
thead { | ||
background-color: rgba(175,184,193,0.2); | ||
} | ||
thead th { | ||
padding: .5em .2em; | ||
} | ||
code { | ||
display: inline; | ||
white-space: break-spaces; | ||
border-radius: 6px; | ||
margin: 0 2px 0 2px; | ||
padding: .2em .4em .1em .4em; | ||
background-color: rgba(175,184,193,0.2); | ||
} | ||
pre code { | ||
display: block; | ||
white-space: pre; | ||
background-color: hsla(0, 0%, 0%, 80%)!important; | ||
border-radius: 10px; | ||
padding: 1rem 1.2rem 1rem; | ||
margin: 1.2em 2em 1.2em 0.5em; | ||
color: #FFF; | ||
box-shadow: 6px 6px 16px hsla(0, 0%, 0%, 0.2); | ||
} | ||
.codehilite .hll { background-color: #49483e } | ||
.codehilite .c { color: #75715e } /* Comment */ | ||
.codehilite .err { color: #960050; background-color: #1e0010 } /* Error */ | ||
.codehilite .k { color: #66d9ef } /* Keyword */ | ||
.codehilite .l { color: #ae81ff } /* Literal */ | ||
.codehilite .n { color: #f8f8f2 } /* Name */ | ||
.codehilite .o { color: #f92672 } /* Operator */ | ||
.codehilite .p { color: #f8f8f2 } /* Punctuation */ | ||
.codehilite .ch { color: #75715e } /* Comment.Hashbang */ | ||
.codehilite .cm { color: #75715e } /* Comment.Multiline */ | ||
.codehilite .cp { color: #75715e } /* Comment.Preproc */ | ||
.codehilite .cpf { color: #75715e } /* Comment.PreprocFile */ | ||
.codehilite .c1 { color: #75715e } /* Comment.Single */ | ||
.codehilite .cs { color: #75715e } /* Comment.Special */ | ||
.codehilite .gd { color: #f92672 } /* Generic.Deleted */ | ||
.codehilite .ge { font-style: italic } /* Generic.Emph */ | ||
.codehilite .gi { color: #a6e22e } /* Generic.Inserted */ | ||
.codehilite .gs { font-weight: bold } /* Generic.Strong */ | ||
.codehilite .gu { color: #75715e } /* Generic.Subheading */ | ||
.codehilite .kc { color: #66d9ef } /* Keyword.Constant */ | ||
.codehilite .kd { color: #66d9ef } /* Keyword.Declaration */ | ||
.codehilite .kn { color: #f92672 } /* Keyword.Namespace */ | ||
.codehilite .kp { color: #66d9ef } /* Keyword.Pseudo */ | ||
.codehilite .kr { color: #66d9ef } /* Keyword.Reserved */ | ||
.codehilite .kt { color: #66d9ef } /* Keyword.Type */ | ||
.codehilite .ld { color: #e6db74 } /* Literal.Date */ | ||
.codehilite .m { color: #ae81ff } /* Literal.Number */ | ||
.codehilite .s { color: #e6db74 } /* Literal.String */ | ||
.codehilite .na { color: #a6e22e } /* Name.Attribute */ | ||
.codehilite .nb { color: #f8f8f2 } /* Name.Builtin */ | ||
.codehilite .nc { color: #a6e22e } /* Name.Class */ | ||
.codehilite .no { color: #66d9ef } /* Name.Constant */ | ||
.codehilite .nd { color: #a6e22e } /* Name.Decorator */ | ||
.codehilite .ni { color: #f8f8f2 } /* Name.Entity */ | ||
.codehilite .ne { color: #a6e22e } /* Name.Exception */ | ||
.codehilite .nf { color: #a6e22e } /* Name.Function */ | ||
.codehilite .nl { color: #f8f8f2 } /* Name.Label */ | ||
.codehilite .nn { color: #f8f8f2 } /* Name.Namespace */ | ||
.codehilite .nx { color: #a6e22e } /* Name.Other */ | ||
.codehilite .py { color: #f8f8f2 } /* Name.Property */ | ||
.codehilite .nt { color: #f92672 } /* Name.Tag */ | ||
.codehilite .nv { color: #f8f8f2 } /* Name.Variable */ | ||
.codehilite .ow { color: #f92672 } /* Operator.Word */ | ||
.codehilite .w { color: #f8f8f2 } /* Text.Whitespace */ | ||
.codehilite .mb { color: #ae81ff } /* Literal.Number.Bin */ | ||
.codehilite .mf { color: #ae81ff } /* Literal.Number.Float */ | ||
.codehilite .mh { color: #ae81ff } /* Literal.Number.Hex */ | ||
.codehilite .mi { color: #ae81ff } /* Literal.Number.Integer */ | ||
.codehilite .mo { color: #ae81ff } /* Literal.Number.Oct */ | ||
.codehilite .sa { color: #e6db74 } /* Literal.String.Affix */ | ||
.codehilite .sb { color: #e6db74 } /* Literal.String.Backtick */ | ||
.codehilite .sc { color: #e6db74 } /* Literal.String.Char */ | ||
.codehilite .dl { color: #e6db74 } /* Literal.String.Delimiter */ | ||
.codehilite .sd { color: #e6db74 } /* Literal.String.Doc */ | ||
.codehilite .s2 { color: #e6db74 } /* Literal.String.Double */ | ||
.codehilite .se { color: #ae81ff } /* Literal.String.Escape */ | ||
.codehilite .sh { color: #e6db74 } /* Literal.String.Heredoc */ | ||
.codehilite .si { color: #e6db74 } /* Literal.String.Interpol */ | ||
.codehilite .sx { color: #e6db74 } /* Literal.String.Other */ | ||
.codehilite .sr { color: #e6db74 } /* Literal.String.Regex */ | ||
.codehilite .s1 { color: #e6db74 } /* Literal.String.Single */ | ||
.codehilite .ss { color: #e6db74 } /* Literal.String.Symbol */ | ||
.codehilite .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */ | ||
.codehilite .fm { color: #a6e22e } /* Name.Function.Magic */ | ||
.codehilite .vc { color: #f8f8f2 } /* Name.Variable.Class */ | ||
.codehilite .vg { color: #f8f8f2 } /* Name.Variable.Global */ | ||
.codehilite .vi { color: #f8f8f2 } /* Name.Variable.Instance */ | ||
.codehilite .vm { color: #f8f8f2 } /* Name.Variable.Magic */ | ||
.codehilite .il { color: #ae81ff } /* Literal.Number.Integer.Long */ | ||
|
||
* { | ||
transition: all 0.6s; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ socksio | |
tqdm | ||
colorama | ||
duckduckgo_search | ||
Pygments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters