Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
feat: enhance UI with font setting
Louis7f22b21a957d
diff --git a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Regular.otf b/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Regular.otfdeleted file mode 100644index 778c9025d..000000000Binary files a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Regular.otf and /dev/null differdiff --git a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-RegularItalic.otf b/web-app/public/fonts/PPEditorialNew/PPEditorialNew-RegularItalic.otfdeleted file mode 100644index d20c33a63..000000000Binary files a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-RegularItalic.otf and /dev/null differdiff --git a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Ultrabold.otf b/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Ultrabold.otfdeleted file mode 100644index 507b09150..000000000Binary files a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Ultrabold.otf and /dev/null differdiff --git a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-UltraboldItalic.otf b/web-app/public/fonts/PPEditorialNew/PPEditorialNew-UltraboldItalic.otfdeleted file mode 100644index 58282cceb..000000000Binary files a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-UltraboldItalic.otf and /dev/null differdiff --git a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Ultralight.otf b/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Ultralight.otfdeleted file mode 100644index 59addeb80..000000000Binary files a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-Ultralight.otf and /dev/null differdiff --git a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-UltralightItalic.otf b/web-app/public/fonts/PPEditorialNew/PPEditorialNew-UltralightItalic.otfdeleted file mode 100644index d3e636b53..000000000Binary files a/web-app/public/fonts/PPEditorialNew/PPEditorialNew-UltralightItalic.otf and /dev/null differdiff --git a/web-app/public/fonts/StudioFeixenSans-Bold.otf b/web-app/public/fonts/StudioFeixenSans-Bold.otfnew file mode 100644index 000000000..481b7b413Binary files /dev/null and b/web-app/public/fonts/StudioFeixenSans-Bold.otf differdiff --git a/web-app/public/fonts/StudioFeixenSans-Book.otf b/web-app/public/fonts/StudioFeixenSans-Book.otfnew file mode 100644index 000000000..80f60011fBinary files /dev/null and b/web-app/public/fonts/StudioFeixenSans-Book.otf differdiff --git a/web-app/public/fonts/StudioFeixenSans-Light.otf b/web-app/public/fonts/StudioFeixenSans-Light.otfnew file mode 100644index 000000000..c84da6092Binary files /dev/null and b/web-app/public/fonts/StudioFeixenSans-Light.otf differdiff --git a/web-app/public/fonts/StudioFeixenSans-Medium.otf b/web-app/public/fonts/StudioFeixenSans-Medium.otfnew file mode 100644index 000000000..5a7ca7912Binary files /dev/null and b/web-app/public/fonts/StudioFeixenSans-Medium.otf differdiff --git a/web-app/public/fonts/StudioFeixenSans-Regular.otf b/web-app/public/fonts/StudioFeixenSans-Regular.otfnew file mode 100644index 000000000..7b864f7ddBinary files /dev/null and b/web-app/public/fonts/StudioFeixenSans-Regular.otf differdiff --git a/web-app/public/fonts/StudioFeixenSans-Semibold.otf b/web-app/public/fonts/StudioFeixenSans-Semibold.otfnew file mode 100644index 000000000..7eca0c0fcBinary files /dev/null and b/web-app/public/fonts/StudioFeixenSans-Semibold.otf differdiff --git a/web-app/public/fonts/StudioFeixenSans-Ultralight.otf b/web-app/public/fonts/StudioFeixenSans-Ultralight.otfnew file mode 100644index 000000000..ffb5495d3Binary files /dev/null and b/web-app/public/fonts/StudioFeixenSans-Ultralight.otf differdiff --git a/web-app/src/ai-elements/reasoning.tsx b/web-app/src/ai-elements/reasoning.tsxindex b21214d2f..ac3cfb61f 100644--- a/web-app/src/ai-elements/reasoning.tsx+++ b/web-app/src/ai-elements/reasoning.tsx@@ -179,7 +179,7 @@ export const ReasoningContent = memo()}{...props}>- <div className="ml-2 pl-4 border-l-2 border-dashed border-main-view-fg/10">+ <div className="ml-2 pl-4 border-l-2 border-dotted border-main-view-fg/10"><Streamdown animate={true} animationDuration={500} {...props}>{children}</Streamdown>diff --git a/web-app/src/ai-elements/tool.tsx b/web-app/src/ai-elements/tool.tsxindex f3be90934..38ac2dce1 100644--- a/web-app/src/ai-elements/tool.tsx+++ b/web-app/src/ai-elements/tool.tsx@@ -137,7 +137,7 @@ export const ToolContent = memo()}{...props}>- <div className="ml-2 pl-4 border-l-2 border-dashed border-main-view-fg/10">+ <div className="ml-2 pl-4 border-l-2 border-dotted border-main-view-fg/10">{children}</div></CollapsibleContent>diff --git a/web-app/src/containers/RenderMarkdown.tsx b/web-app/src/containers/RenderMarkdown.tsxindex c7d2a4663..754a705b6 100644--- a/web-app/src/containers/RenderMarkdown.tsx+++ b/web-app/src/containers/RenderMarkdown.tsx@@ -5,7 +5,7 @@ import { cn } from '@/lib/utils'import { defaultRehypePlugins, Streamdown } from 'streamdown'import remarkGfm from 'remark-gfm'import remarkMath from 'remark-math'-import { useCodeblock } from '@/hooks/useCodeblock'+import { AnimatedRunningCat } from '@/components/AnimatedRunningCat'interface MarkdownProps {content: string@@ -13,6 +13,7 @@ interface MarkdownProps {components?: ComponentsisUser?: booleanisStreaming?: boolean+ messageId?: string}// Cache for normalized LaTeX content@@ -76,6 +77,7 @@ function RenderMarkdownComponent({className,isUser,components,+ messageId,}: MarkdownProps) {// const { codeBlockStyle, showLineNumbers } = useCodeblock()diff --git a/web-app/src/containers/ThinkingBlock.tsx b/web-app/src/containers/ThinkingBlock.tsxindex 211fda9ff..55c78f5e6 100644--- a/web-app/src/containers/ThinkingBlock.tsx+++ b/web-app/src/containers/ThinkingBlock.tsx@@ -52,7 +52,7 @@ const ThinkingBlock = ({ id, text }: Props) => {className="mx-auto w-full cursor-pointer break-words"onClick={handleClick}>- <div className="mb-4 rounded-lg bg-main-view-fg/4 border border-dashed border-main-view-fg/10 p-2">+ <div className="mb-4 rounded-lg bg-main-view-fg/4 border border-dotted border-main-view-fg/10 p-2"><div className="flex items-center gap-3">{loading && (<Loader className="size-4 animate-spin text-main-view-fg/60" />diff --git a/web-app/src/containers/ThreadContent.tsx b/web-app/src/containers/ThreadContent.tsxindex 3d94e7407..753eab135 100644--- a/web-app/src/containers/ThreadContent.tsx+++ b/web-app/src/containers/ThreadContent.tsx@@ -460,7 +460,7 @@ export const ThreadContent = memo(<span className="text-main-view-fg font-medium">{assistant?.name || 'Jan'}</span>- {item?.created_at && item?.created_at !== 0 && (+ {!!item?.created_at && item?.created_at !== 0 && (<span className="text-xs mt-0.5">{formatDate(item?.created_at)}</span>@@ -501,6 +501,7 @@ export const ThreadContent = memo(content={textSegment.replace('</think>', '')}components={linkComponents}isStreaming={item.isLastMessage && isStreamingThisThread}+ messageId={item.id}/>{isToolCalls && item.metadata?.tool_calls ? (diff --git a/web-app/src/containers/ToolCallBlock.tsx b/web-app/src/containers/ToolCallBlock.tsxdeleted file mode 100644index 5631aecf7..000000000--- a/web-app/src/containers/ToolCallBlock.tsx+++ /dev/null@@ -1,237 +0,0 @@-import { ChevronDown, ChevronUp, Loader } from 'lucide-react'-import { cn } from '@/lib/utils'-import { create } from 'zustand'-import { RenderMarkdown } from '@/containers/RenderMarkdown'-import { useMemo, useState } from 'react'-import { twMerge } from 'tailwind-merge'-import { useTranslation } from '@/i18n/react-i18next-compat'-import ImageModal from '@/containers/dialogs/ImageModal'--interface Props {- result: string- name: string- args: object- id: number- loading: boolean-}--type ToolCallBlockState = {- collapseState: { [id: number]: boolean }- setCollapseState: (id: number, expanded: boolean) => void-}--const useToolCallBlockStore = create<ToolCallBlockState>((set) => ({- collapseState: {},- setCollapseState: (id, expanded) =>- set((state) => ({- collapseState: {- ...state.collapseState,- [id]: expanded,- },- })),-}))--// Types for MCP response content-interface MCPContentItem {- type: string- data?: string- text?: string- mimeType?: string-}--interface MCPResponse {- content?: MCPContentItem[]-}--// Utility function to create data URL from base64 and mimeType-const createDataUrl = (base64Data: string, mimeType: string): string => {- // Handle case where base64 data might already include data URL prefix- if (base64Data.startsWith('data:')) {- return base64Data- }- return `data:${mimeType};base64,${base64Data}`-}--// Parse MCP response and extract content items-const parseMCPResponse = (result: string) => {- try {- const parsed: MCPResponse = JSON.parse(result)- const content = parsed.content || []-- return {- parsedResult: parsed,- contentItems: content,- hasStructuredContent: content.length > 0,- parseError: false,- }- } catch {- // Fallback: JSON parsing failed, treat as plain text- return {- parsedResult: result,- contentItems: [],- hasStructuredContent: false,- parseError: true,- }- }-}--// Component to render individual content items based on type-const ContentItemRenderer = ({- item,- index,- onImageClick,-}: {- item: MCPContentItem- index: number- onImageClick?: (imageUrl: string, alt: string) => void-}) => {- if (item.type === 'image' && item.data && item.mimeType) {- const imageUrl = createDataUrl(item.data, item.mimeType)- return (- <div key={index} className="my-3">- <img- src={imageUrl}- alt={`Result image ${index + 1}`}- className="max-w-full max-h-64 object-contain rounded-md border border-main-view-fg/10 cursor-pointer hover:opacity-80 transition-opacity"- onError={(e) => {- // Hide broken images- e.currentTarget.style.display = 'none'- }}- onClick={() => onImageClick?.(imageUrl, `Result image ${index + 1}`)}- />- </div>- )- }-- // For any other types, render as JSON- return (- <div key={index} className="mt-3">- <RenderMarkdown- content={'```json\n' + JSON.stringify(item, null, 2) + '\n```'}- />- </div>- )-}--const ToolCallBlock = ({ id, name, result, loading, args }: Props) => {- const { collapseState, setCollapseState } = useToolCallBlockStore()- const { t } = useTranslation()- const isExpanded = collapseState[id] ?? (loading ? true : false)- const [modalImage, setModalImage] = useState<{- url: string- alt: string- } | null>(null)-- const handleClick = () => {- const newExpandedState = !isExpanded- setCollapseState(id, newExpandedState)- }-- const handleImageClick = (imageUrl: string, alt: string) => {- setModalImage({ url: imageUrl, alt })- }-- const closeModal = () => {- setModalImage(null)- }-- // Parse the MCP response and extract content items- const { parsedResult, contentItems, hasStructuredContent } = useMemo(() => {- return parseMCPResponse(result)- }, [result])-- return (- <div- className="mx-auto w-full cursor-pointer break-words"- data-tool-call-block={id}- >- <div className="rounded-lg bg-main-view-fg/4 border border-dashed border-main-view-fg/10">- <div className="flex items-center gap-3 p-2" onClick={handleClick}>- {loading && (- <div className="w-4 h-4">- <Loader className="size-4 animate-spin text-main-view-fg/60" />- </div>- )}- <button className="flex items-center gap-2 focus:outline-none">- {!loading && (- <>- {isExpanded ? (- <>- <div className="ml-1 w-4 h-4">- <ChevronUp className="h-4 w-4" />- </div>- </>- ) : (- <div className="ml-1 w-4 h-4">- <ChevronDown className="h-4 w-4" />- </div>- )}- </>- )}- <span className="font-medium text-main-view-fg/80">- <span className="font-medium text-main-view-fg mr-2">{name}</span>- <span- className={twMerge(- 'text-xs bg-main-view-fg/4 rounded-sm p-1',- loading ? 'text-main-view-fg/40' : 'text-accent'- )}- >- {loading ? t('common:callingTool') : t('common:completed')}{' '}- </span>- </span>- </button>- </div>-- <div- className={cn(- 'h-fit w-full overflow-auto transition-all duration-300 px-2',- isExpanded ? '' : 'max-h-0 overflow-hidden'- )}- >- <div className="mt-2 text-main-view-fg/60 overflow-hidden">- {args && Object.keys(args).length > 3 && (- <>- <p className="mb-3">Arguments:</p>- <RenderMarkdown- content={'```json\n' + args + '\n```'}- />- </>- )}-- {result && (- <>- <p>Output:</p>- {hasStructuredContent ? (- /* Render each content item individually based on its type */- <div className="space-y-2">- {contentItems.map((item, index) => (- <ContentItemRenderer- key={index}- item={item}- index={index}- onImageClick={handleImageClick}- />- ))}- </div>- ) : (- /* Fallback: render as JSON for valid JSON but unstructured responses */- <RenderMarkdown- content={- '```json\n' +- JSON.stringify(parsedResult, null, 2) +- '\n```'- }- />- )}- </>- )}- </div>- </div>- </div>-- <ImageModal image={modalImage} onClose={closeModal} />- </div>- )-}--export default ToolCallBlockdiff --git a/web-app/src/hooks/useInterfaceSettings.ts b/web-app/src/hooks/useInterfaceSettings.tsindex 7b68ae535..5c6d61d3d 100644--- a/web-app/src/hooks/useInterfaceSettings.ts+++ b/web-app/src/hooks/useInterfaceSettings.ts@@ -13,7 +13,7 @@ import {isThreadScrollBehavior,} from '@/constants/threadScroll'-export type FontSize = '14px' | '15px' | '16px' | '18px'+export type FontSize = '14px' | '16px' | '18px' | '20px'export type ChatWidth = 'full' | 'compact'interface InterfaceSettingsState {@@ -59,9 +59,9 @@ const getBrightness = ({ r, g, b }: RgbaColor) =>export const fontSizeOptions = [{ label: 'Small', value: '14px' as FontSize },- { label: 'Medium', value: '15px' as FontSize },- { label: 'Large', value: '16px' as FontSize },- { label: 'Extra Large', value: '18px' as FontSize },+ { label: 'Medium', value: '16px' as FontSize },+ { label: 'Large', value: '18px' as FontSize },+ { label: 'Extra Large', value: '20px' as FontSize },]// Helper to determine if blur effects are supported@@ -83,7 +83,7 @@ const getAlphaValue = () => {}// Default interface settings-const defaultFontSize: FontSize = '15px'+const defaultFontSize: FontSize = '16px'const defaultAppBgColor: RgbaColor = {r: 25,g: 25,@@ -704,6 +704,11 @@ export const useInterfaceSettings = create<InterfaceSettingsState>()(state.threadScrollBehavior = DEFAULT_THREAD_SCROLL_BEHAVIOR}+ // Migrate old font size value '15px' to '16px'+ if (state.fontSize === '15px' as FontSize) {+ state.fontSize = '16px'+ }+// Apply font size from storagedocument.documentElement.style.setProperty('--font-size-base',diff --git a/web-app/src/index.css b/web-app/src/index.cssindex a85d1fd91..490ce530d 100644--- a/web-app/src/index.css+++ b/web-app/src/index.css@@ -11,7 +11,7 @@--radius-md: calc(var(--radius) - 2px);--radius-lg: var(--radius);--radius-xl: calc(var(--radius) + 4px);- --font-editorialnew: 'PPEditorialNew', serif;+ --font-editorialnew: 'StudioFeixenSans', sans-serif;--color-app: var(--app-bg);--color-left-panel-fg: var(--app-left-panel-fg);--color-main-view: var(--app-main-view);@@ -62,7 +62,7 @@:root {/* Button */--radius: 0.625rem;- --font-size-base: 15px;+ --font-size-base: 16px;--app-bg: '';--app-left-panel-fg: '';--app-main-view: '';diff --git a/web-app/src/routes/hub/$modelId.tsx b/web-app/src/routes/hub/$modelId.tsxindex 6a4f04049..37004b3b2 100644--- a/web-app/src/routes/hub/$modelId.tsx+++ b/web-app/src/routes/hub/$modelId.tsx@@ -315,7 +315,6 @@ function HubModelDetailContent() {{modelData.description && (<div className="text-main-view-fg/80 mb-4"><RenderMarkdown- enableRawHtml={true}className="select-none reset-heading"components={{a: ({ ...props }) => (@@ -528,7 +527,6 @@ function HubModelDetailContent() {) : readmeContent ? (<div className="prose prose-invert max-w-none"><RenderMarkdown- enableRawHtml={true}className="text-main-view-fg/80"components={{a: ({ ...props }) => (diff --git a/web-app/src/styles/font.css b/web-app/src/styles/font.cssindex f22d2c8ea..0effec445 100644--- a/web-app/src/styles/font.css+++ b/web-app/src/styles/font.css@@ -1,51 +1,49 @@-/* PP Editorial New */+/* Studio Feixen Sans */@font-face {- font-family: 'PPEditorialNew';+ font-family: 'StudioFeixenSans';font-display: swap;- src: url('/fonts/PPEditorialNew/PPEditorialNew-Regular.otf')- format('opentype');- font-weight: 400;+ src: url('/fonts/StudioFeixenSans-Ultralight.otf') format('opentype');+ font-weight: 200;}@font-face {- font-family: 'PPEditorialNew';+ font-family: 'StudioFeixenSans';font-display: swap;- src: url('/fonts/PPEditorialNew/PPEditorialNew-RegularItalic.otf')- format('opentype');- font-weight: 400;- font-style: italic;+ src: url('/fonts/StudioFeixenSans-Light.otf') format('opentype');+ font-weight: 300;}@font-face {- font-family: 'PPEditorialNew';+ font-family: 'StudioFeixenSans';font-display: swap;- src: url('/fonts/PPEditorialNew/PPEditorialNew-Ultrabold.otf')- format('opentype');- font-weight: 700;+ src: url('/fonts/StudioFeixenSans-Book.otf') format('opentype');+ font-weight: 350;}@font-face {- font-family: 'PPEditorialNew';+ font-family: 'StudioFeixenSans';font-display: swap;- src: url('/fonts/PPEditorialNew/PPEditorialNew-UltraboldItalic.otf')- format('opentype');- font-weight: 700;- font-style: italic;+ src: url('/fonts/StudioFeixenSans-Regular.otf') format('opentype');+ font-weight: 400;}@font-face {- font-family: 'PPEditorialNew';+ font-family: 'StudioFeixenSans';font-display: swap;- src: url('/fonts/PPEditorialNew/PPEditorialNew-Ultralight.otf')- format('opentype');- font-weight: 300;+ src: url('/fonts/StudioFeixenSans-Medium.otf') format('opentype');+ font-weight: 500;}@font-face {- font-family: 'PPEditorialNew';+ font-family: 'StudioFeixenSans';font-display: swap;- src: url('/fonts/PPEditorialNew/PPEditorialNew-UltralightItalic.otf')- format('opentype');- font-weight: 300;- font-style: italic;+ src: url('/fonts/StudioFeixenSans-Semibold.otf') format('opentype');+ font-weight: 600;+}++@font-face {+ font-family: 'StudioFeixenSans';+ font-display: swap;+ src: url('/fonts/StudioFeixenSans-Bold.otf') format('opentype');+ font-weight: 700;}diff --git a/web-app/src/styles/markdown.css b/web-app/src/styles/markdown.cssindex f6fc59b82..b7b3d119d 100644--- a/web-app/src/styles/markdown.css+++ b/web-app/src/styles/markdown.css@@ -260,7 +260,8 @@}[data-streamdown="mermaid-block"] {- border-color: var(--border)+ border-color: var(--border);+ margin-bottom: 1em;}/* Streamdown caret styling */