Skip to content
Merged

Dev #1605

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1716272
feat:支持msg_id获取消息能力
SengokuCola Apr 22, 2026
c0be64f
Refactor API response models and improve documentation
DrSmoothl Apr 22, 2026
066c8ba
feat:修复部分模型请求问题(v4l)
SengokuCola Apr 22, 2026
465c5bd
feat: 更新 EmojiResponse 模型,添加 format 和 usage_count 字段
DrSmoothl Apr 22, 2026
2255592
Merge branch 'dev' of https://github.com/Mai-with-u/MaiBot into dev
SengokuCola Apr 22, 2026
35ff91d
feat:可开启原生at功能
SengokuCola Apr 23, 2026
03750cd
remove:无用代码
SengokuCola Apr 23, 2026
3b6d30c
fix:修部分显示问题和模型问题
SengokuCola Apr 23, 2026
7719353
feat:精简表达选择,优化replyer表现,优化缓存命中率
SengokuCola Apr 24, 2026
201efe6
feat: 更新 CodeEditor 组件,重构为懒加载并添加 CodeEditorImpl,优化导入路径
DrSmoothl Apr 24, 2026
5dfd6a6
Refactor personality and emoji configuration forms; add chat components
DrSmoothl Apr 24, 2026
11f423b
Merge branch 'dev' of https://github.com/Mai-with-u/MaiBot into dev
SengokuCola Apr 24, 2026
7054527
feat:进一步优化缓存
SengokuCola Apr 24, 2026
4b1bc2a
fix:回复格式问题
SengokuCola Apr 24, 2026
e8c2751
feat: 优化长期记忆控制台体验
A-Dawn Apr 25, 2026
88ba5c1
Merge branch 'Mai-with-u:dev' into dev
A-Dawn Apr 25, 2026
5931954
Merge pull request #1603 from A-Dawn/dev
A-Dawn Apr 25, 2026
9759018
feat:支持模型缓存和相关配置
SengokuCola Apr 25, 2026
dcc6748
Merge branch 'dev' of https://github.com/Mai-with-u/MaiBot into dev
SengokuCola Apr 25, 2026
8168fe0
better:优化部分导入以更快的启动
SengokuCola Apr 25, 2026
be2248b
feat:为日志添加上限和配置防止膨胀
SengokuCola Apr 25, 2026
45cd00e
fix(llm): support reasoning field for OpenRouter and Groq
Soulter Apr 26, 2026
859bbb9
Merge pull request #1604 from Soulter/dev
SengokuCola Apr 27, 2026
d32be47
feat:新增按顺序选择 fix:修复timing gate意外tool问题
SengokuCola Apr 27, 2026
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
9 changes: 0 additions & 9 deletions Plan.md

This file was deleted.

5 changes: 2 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def run_runner_process():

require_legacy_upgrade_confirmation(Path(script_dir))

logger.info(t("startup.worker_dir_set", script_dir=script_dir))

from src.main import MainSystem # noqa
from src.manager.async_task_manager import async_task_manager # noqa

Expand All @@ -117,9 +119,6 @@ def run_runner_process():
# 设置工作目录为脚本所在目录
# script_dir = os.path.dirname(os.path.abspath(__file__))
# os.chdir(script_dir)
logger.info(t("startup.worker_dir_set", script_dir=script_dir))


confirm_logger = get_logger("confirm")
# 获取没有加载env时的环境变量
env_mask = {key: os.getenv(key) for key in os.environ}
Expand Down
14 changes: 9 additions & 5 deletions dashboard/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{ ignores: ['dist', 'out'] },
jsxA11y.flatConfigs.recommended,
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
Expand All @@ -25,10 +25,7 @@ export default tseslint.config(
acc[key] = 'warn'
return acc
}, {}),
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
// 关闭或降级其他规则
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
Expand All @@ -37,4 +34,11 @@ export default tseslint.config(
'jsx-a11y/no-autofocus': 'warn',
},
},
{
files: ['**/*.d.ts'],
rules: {
// Ambient global declarations use `var` in TypeScript declaration files.
'no-var': 'off',
},
}
)
7 changes: 4 additions & 3 deletions dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"@radix-ui/react-tabs": "^1.1.13",
"@radix-ui/react-toast": "^1.2.15",
"@radix-ui/react-tooltip": "^1.2.8",
"@react-spring/web": "10.0.3",
"@tanstack/react-router": "^1.140.0",
"@tanstack/react-virtual": "^3.13.13",
"@tanstack/router-devtools": "^1.140.0",
Expand All @@ -130,6 +131,7 @@
"@uppy/dashboard": "^5.1.0",
"@uppy/react": "^5.1.1",
"@uppy/xhr-upload": "^5.1.1",
"@use-gesture/react": "^10.3.1",
"axios": "^1.13.2",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
Expand All @@ -142,6 +144,7 @@
"idb": "^8.0.3",
"katex": "^0.16.27",
"lucide-react": "^0.556.0",
"motion": "^12.38.0",
"react": "^19.2.1",
"react-day-picker": "^9.12.0",
"react-dom": "^19.2.1",
Expand All @@ -154,9 +157,7 @@
"remark-gfm": "^4.0.1",
"remark-math": "^6.0.0",
"smol-toml": "^1.5.2",
"tailwind-merge": "^3.4.0",
"@react-spring/web": "10.0.3",
"@use-gesture/react": "^10.3.1"
"tailwind-merge": "^3.4.0"
},
"devDependencies": {
"@tailwindcss/vite": "^4.2.1",
Expand Down
136 changes: 27 additions & 109 deletions dashboard/src/components/CodeEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import { useEffect, useState } from 'react'
import CodeMirror from '@uiw/react-codemirror'
import { css } from '@codemirror/lang-css'
import { json, jsonParseLinter } from '@codemirror/lang-json'
import { linter } from '@codemirror/lint'
import { python } from '@codemirror/lang-python'
import { oneDark } from '@codemirror/theme-one-dark'
import { EditorView } from '@codemirror/view'
import { StreamLanguage } from '@codemirror/language'
import { toml as tomlMode } from '@codemirror/legacy-modes/mode/toml'

import { useTheme } from '@/components/use-theme'
import { lazy, Suspense } from 'react'

export type Language = 'python' | 'json' | 'toml' | 'css' | 'text'

interface CodeEditorProps {
export interface CodeEditorProps {
value: string

onChange?: (value: string) => void
Expand All @@ -27,109 +16,38 @@ interface CodeEditorProps {
className?: string
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const languageExtensions: Record<Language, any[]> = {
python: [python()],
json: [json(), linter(jsonParseLinter())],
toml: [StreamLanguage.define(tomlMode)],
css: [css()],
text: [],
}
const CodeEditorImpl = lazy(() => import('./CodeEditorImpl'))

export function CodeEditor({
value,
onChange,
language = 'text',
readOnly = false,
height = '400px',
function CodeEditorFallback({
height,
minHeight,
maxHeight,
placeholder,
theme,
className = '',
}: CodeEditorProps) {
const [mounted, setMounted] = useState(false)
const { resolvedTheme } = useTheme()

useEffect(() => {
setMounted(true)
}, [])

if (!mounted) {
return (
<div
className={`rounded-md border bg-muted animate-pulse ${className}`}
style={{ height, minHeight, maxHeight }}
/>
)
}

const extensions = [
...(languageExtensions[language] || []),
EditorView.lineWrapping,
// 应用 JetBrains Mono 字体
EditorView.theme({
'&': {
fontFamily: '"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace',
},
'.cm-content': {
fontFamily: '"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace',
},
'.cm-gutters': {
fontFamily: '"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace',
},
'.cm-scroller': {
fontFamily: '"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace',
},
}),
]

if (readOnly) {
extensions.push(EditorView.editable.of(false))
}
}: Pick<CodeEditorProps, 'height' | 'minHeight' | 'maxHeight' | 'className'>) {
return (
<div
className={`bg-muted animate-pulse rounded-md border ${className}`}
style={{ height, minHeight, maxHeight }}
/>
)
}

// 如果外部传了 theme prop 则使用,否则从 context 自动获取
const effectiveTheme = theme ?? resolvedTheme
export function CodeEditor(props: CodeEditorProps) {
const { height = '400px', minHeight, maxHeight, className = '' } = props

return (
<div className={`rounded-md overflow-hidden border custom-scrollbar ${className}`}>
<CodeMirror
value={value}
height={height}
minHeight={minHeight}
maxHeight={maxHeight}
theme={effectiveTheme === 'dark' ? oneDark : undefined}
extensions={extensions}
onChange={onChange}
placeholder={placeholder}
basicSetup={{
lineNumbers: true,
highlightActiveLineGutter: true,
highlightSpecialChars: true,
history: true,
foldGutter: true,
drawSelection: true,
dropCursor: true,
allowMultipleSelections: true,
indentOnInput: true,
syntaxHighlighting: true,
bracketMatching: true,
closeBrackets: true,
autocompletion: true,
rectangularSelection: true,
crosshairCursor: true,
highlightActiveLine: true,
highlightSelectionMatches: true,
closeBracketsKeymap: true,
defaultKeymap: true,
searchKeymap: true,
historyKeymap: true,
foldKeymap: true,
completionKeymap: true,
lintKeymap: true,
}}
/>
</div>
<Suspense
fallback={
<CodeEditorFallback
height={height}
minHeight={minHeight}
maxHeight={maxHeight}
className={className}
/>
}
>
<CodeEditorImpl {...props} />
</Suspense>
)
}

Expand Down
105 changes: 105 additions & 0 deletions dashboard/src/components/CodeEditorImpl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import { css } from '@codemirror/lang-css'
import { json, jsonParseLinter } from '@codemirror/lang-json'
import { python } from '@codemirror/lang-python'
import { StreamLanguage } from '@codemirror/language'
import { toml as tomlMode } from '@codemirror/legacy-modes/mode/toml'
import { linter } from '@codemirror/lint'
import { oneDark } from '@codemirror/theme-one-dark'
import { EditorView } from '@codemirror/view'
import CodeMirror from '@uiw/react-codemirror'

import { useTheme } from '@/components/use-theme'

import type { CodeEditorProps, Language } from './CodeEditor'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const languageExtensions: Record<Language, any[]> = {
python: [python()],
json: [json(), linter(jsonParseLinter())],
toml: [StreamLanguage.define(tomlMode)],
css: [css()],
text: [],
}

export default function CodeEditorImpl({
value,
onChange,
language = 'text',
readOnly = false,
height = '400px',
minHeight,
maxHeight,
placeholder,
theme,
className = '',
}: CodeEditorProps) {
const { resolvedTheme } = useTheme()

const extensions = [
...(languageExtensions[language] || []),
EditorView.lineWrapping,
// 应用 JetBrains Mono 字体
EditorView.theme({
'&': {
fontFamily: '"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace',
},
'.cm-content': {
fontFamily: '"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace',
},
'.cm-gutters': {
fontFamily: '"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace',
},
'.cm-scroller': {
fontFamily: '"JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace',
},
}),
]

if (readOnly) {
extensions.push(EditorView.editable.of(false))
}

// 如果外部传了 theme prop 则使用,否则从 context 自动获取
const effectiveTheme = theme ?? resolvedTheme

return (
<div className={`custom-scrollbar overflow-hidden rounded-md border ${className}`}>
<CodeMirror
value={value}
height={height}
minHeight={minHeight}
maxHeight={maxHeight}
theme={effectiveTheme === 'dark' ? oneDark : undefined}
extensions={extensions}
onChange={onChange}
placeholder={placeholder}
basicSetup={{
lineNumbers: true,
highlightActiveLineGutter: true,
highlightSpecialChars: true,
history: true,
foldGutter: true,
drawSelection: true,
dropCursor: true,
allowMultipleSelections: true,
indentOnInput: true,
syntaxHighlighting: true,
bracketMatching: true,
closeBrackets: true,
autocompletion: true,
rectangularSelection: true,
crosshairCursor: true,
highlightActiveLine: true,
highlightSelectionMatches: true,
closeBracketsKeymap: true,
defaultKeymap: true,
searchKeymap: true,
historyKeymap: true,
foldKeymap: true,
completionKeymap: true,
lintKeymap: true,
}}
/>
</div>
)
}
Loading
Loading