Skip to content

Commit

Permalink
fix: fix katex formula width overflow issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Mar 18, 2024
1 parent 256c10c commit fb0e6d5
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 37 deletions.
2 changes: 2 additions & 0 deletions app/src/assets/fonts/katex.less
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@
}
.katex .katex-html {
/* \newline is an empty block at top level, between .base elements */

white-space: pre-wrap;
}
.katex .katex-html > .newline {
display: block;
Expand Down
3 changes: 1 addition & 2 deletions app/src/assets/pages/sharing.less
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@
flex-direction: column;
flex-grow: 1;
width: 100%;
overflow-x: hidden;
overflow-y: auto;
overflow: hidden;
touch-action: pan-y;
padding: 1rem;
scrollbar-width: thin;
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/admin/assemblies/BillingChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ function BillingChart({ labels, datasets }: BillingChartProps) {

return (
<div className={`chart`}>
<p className={`chart-title mb-2`}>
<div className={`chart-title mb-2`}>
<p>{t("admin.billing-chart")}</p>
{labels.length === 0 && (
<Loader2 className={`h-4 w-4 inline-block animate-spin`} />
)}
</p>
</div>
<AreaChart
className={`common-chart`}
data={data}
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/admin/assemblies/ErrorChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ function ErrorChart({ labels, datasets }: ErrorChartProps) {

return (
<div className={`chart`}>
<p className={`chart-title mb-2`}>
<div className={`chart-title mb-2`}>
<p>{t("admin.error-chart")}</p>
{labels.length === 0 && (
<Loader2 className={`h-4 w-4 inline-block animate-spin`} />
)}
</p>
</div>
<AreaChart
className={`common-chart`}
data={data}
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/admin/assemblies/ModelChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ function ModelChart({ labels, datasets }: ModelChartProps) {

return (
<div className={`chart`}>
<p className={`chart-title mb-2`}>
<p className={`flex flex-row items-center`}>
<div className={`chart-title mb-2`}>
<div className={`flex flex-row items-center`}>
{t("admin.model-chart")}
<Tips content={t("admin.model-chart-tip")} />
</p>
</div>
{labels.length === 0 && (
<Loader2 className={`h-4 w-4 inline-block animate-spin`} />
)}
Expand All @@ -62,7 +62,7 @@ function ModelChart({ labels, datasets }: ModelChartProps) {
<LineChartIcon className={`h-4 w-4`} />
)}
</Button>
</p>
</div>
{!area ? (
<BarChart
className={`common-chart`}
Expand Down
8 changes: 4 additions & 4 deletions app/src/components/admin/assemblies/ModelUsageChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ function ModelUsageChart({ labels, datasets }: ModelChartProps) {

return (
<div className={`chart`}>
<p className={`chart-title mb-2`}>
<p className={`flex flex-row items-center`}>
<div className={`chart-title mb-2`}>
<div className={`flex flex-row items-center`}>
{t("admin.model-usage-chart")}
<Tips content={t("admin.model-chart-tip")} />
</p>
</div>
{labels.length === 0 && (
<Loader2 className={`h-4 w-4 inline-block animate-spin`} />
)}
</p>
</div>
<div className={`flex flex-row`}>
<DonutChart
className={`common-chart p-4 w-[50%]`}
Expand Down
4 changes: 2 additions & 2 deletions app/src/components/admin/assemblies/RequestChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ function RequestChart({ labels, datasets }: RequestChartProps) {

return (
<div className={`chart`}>
<p className={`chart-title mb-2`}>
<div className={`chart-title mb-2`}>
<p>{t("admin.request-chart")}</p>
{labels.length === 0 && (
<Loader2 className={`h-4 w-4 inline-block animate-spin`} />
)}
</p>
</div>
<AreaChart
className={`common-chart`}
data={data}
Expand Down
12 changes: 6 additions & 6 deletions app/src/components/admin/assemblies/UserTypeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ function UserTypeChart({ data }: UserTypeChartProps) {

return (
<div className={`chart`}>
<p className={`chart-title mb-2`}>
<p className={`flex flex-row items-center w-full`}>
<p>
<div className={`chart-title mb-2`}>
<div className={`flex flex-row items-center w-full`}>
<div>
{t("admin.user-type-chart")}
<Tips
className={`translate-y-[2px]`}
content={t("admin.user-type-chart-tip")}
/>
</p>
</div>
{data.total === 0 && (
<Loader2 className={`h-4 w-4 ml-1 animate-spin`} />
)}
Expand All @@ -92,8 +92,8 @@ function UserTypeChart({ data }: UserTypeChartProps) {
<Filter className={`h-4 w-4`} />
</Button>
</MultiCombobox>
</p>
</p>
</div>
</div>
<div className={`flex flex-row`}>
<DonutChart
className={`common-chart p-4 w-[50%]`}
Expand Down
7 changes: 6 additions & 1 deletion app/src/routes/Sharing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ function SharingForm({ data }: SharingFormProps) {
<ScrollArea className={`body`}>
<div className={`chat-messages-wrapper`}>
{data.messages.map((message, i) => (
<MessageSegment message={message} key={i} index={i} />
<MessageSegment
message={message}
key={i}
index={i}
username={data.username}
/>
))}
</div>
</ScrollArea>
Expand Down
2 changes: 1 addition & 1 deletion app/src/routes/admin/Market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ function Market() {
const [stepSupport, setStepSupport] = useState<boolean>(false);
const [stepAll, setStepAll] = useState<boolean>(false);

const [stacked, setStacked] = useState<boolean>(false);
const [stacked, setStacked] = useState<boolean>(true);

const [form, dispatch] = useReducer(reducer, []);
const [open, setOpen] = useState<boolean>(false);
Expand Down
42 changes: 29 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module chat

go 1.20
go 1.22

toolchain go1.22.1

require (
github.com/bincooo/claude-api v1.0.2
Expand All @@ -12,65 +14,79 @@ require (
github.com/go-sql-driver/mysql v1.7.1
github.com/goccy/go-json v0.10.2
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.1
github.com/gorilla/websocket v1.5.0
github.com/google/uuid v1.4.0
github.com/gorilla/websocket v1.5.1
github.com/lukasjarosch/go-docx v0.4.7
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/pkoukk/tiktoken-go v0.1.6
github.com/russross/blackfriday/v2 v2.1.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/viper v1.16.0
github.com/volcengine/volc-sdk-golang v1.0.127
golang.org/x/net v0.15.0
golang.org/x/net v0.21.0
gopkg.in/mail.v2 v2.3.1
)

require (
dario.cat/mergo v1.0.0 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/bep/godartsass v1.2.0 // indirect
github.com/bep/godartsass/v2 v2.0.0 // indirect
github.com/bep/golibsass v1.1.1 // indirect
github.com/bincooo/requests v0.0.0-20230720064210-7eae5d6c9d1e // indirect
github.com/bitly/go-simplejson v0.5.0 // indirect
github.com/bytedance/sonic v1.10.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.0 // indirect
github.com/cli/safeexec v1.0.1 // indirect
github.com/cloudwego/hertz/cmd/hz v0.7.0 // indirect
github.com/cosmtrek/air v1.51.0 // indirect
github.com/creack/pty v1.1.21 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gaukas/godicttls v0.0.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.4 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gohugoio/hugo v0.123.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/refraction-networking/utls v1.3.2 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tdewolff/parse/v2 v2.7.12 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/wangluozhe/fhttp v0.0.0-20230512135433-5c2ebfb4868a // indirect
golang.org/x/arch v0.5.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
Loading

0 comments on commit fb0e6d5

Please sign in to comment.