Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
7e48b748
Unverified
提交
7e48b748
authored
5月 06, 2025
作者:
Will Chen
提交者:
GitHub
5月 06, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Put file editing behind an experiment (#98)
上级
45b1738f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
32 行增加
和
2 行删除
+32
-2
FileEditor.tsx
src/components/preview_panel/FileEditor.tsx
+3
-0
useSettings.ts
src/hooks/useSettings.ts
+1
-0
schemas.ts
src/lib/schemas.ts
+1
-0
settings.tsx
src/pages/settings.tsx
+27
-2
没有找到文件。
src/components/preview_panel/FileEditor.tsx
浏览文件 @
7e48b748
...
...
@@ -5,6 +5,7 @@ import { useTheme } from "@/contexts/ThemeContext";
import
{
ChevronRight
,
Circle
}
from
"lucide-react"
;
import
"@/components/chat/monaco"
;
import
{
IpcClient
}
from
"@/ipc/ipc_client"
;
import
{
useSettings
}
from
"@/hooks/useSettings"
;
interface
FileEditorProps
{
appId
:
number
|
null
;
...
...
@@ -54,6 +55,7 @@ const Breadcrumb: React.FC<BreadcrumbProps> = ({ path, hasUnsavedChanges }) => {
export
const
FileEditor
=
({
appId
,
filePath
}:
FileEditorProps
)
=>
{
const
{
content
,
loading
,
error
}
=
useLoadAppFile
(
appId
,
filePath
);
const
{
theme
}
=
useTheme
();
const
{
settings
}
=
useSettings
();
const
[
value
,
setValue
]
=
useState
<
string
|
undefined
>
(
undefined
);
const
[
displayUnsavedChanges
,
setDisplayUnsavedChanges
]
=
useState
(
false
);
...
...
@@ -197,6 +199,7 @@ export const FileEditor = ({ appId, filePath }: FileEditorProps) => {
fontFamily
:
"monospace"
,
fontSize
:
13
,
lineNumbers
:
"on"
,
readOnly
:
!
settings
?.
experiments
?.
enableFileEditing
,
}
}
/>
</
div
>
...
...
src/hooks/useSettings.ts
浏览文件 @
7e48b748
...
...
@@ -101,6 +101,7 @@ export function useSettings() {
loading
,
error
,
updateSettings
,
isProviderSetup
,
isAnyProviderSetup
:
()
=>
{
// Technically we should check for ollama and lmstudio being setup, but
...
...
src/lib/schemas.ts
浏览文件 @
7e48b748
...
...
@@ -98,6 +98,7 @@ export type Supabase = z.infer<typeof SupabaseSchema>;
export
const
ExperimentsSchema
=
z
.
object
({
// Deprecated
enableSupabaseIntegration
:
z
.
boolean
().
describe
(
"DEPRECATED"
).
optional
(),
enableFileEditing
:
z
.
boolean
().
optional
(),
});
export
type
Experiments
=
z
.
infer
<
typeof
ExperimentsSchema
>
;
...
...
src/pages/settings.tsx
浏览文件 @
7e48b748
...
...
@@ -13,13 +13,14 @@ import { ArrowLeft } from "lucide-react";
import
{
useRouter
}
from
"@tanstack/react-router"
;
import
{
GitHubIntegration
}
from
"@/components/GitHubIntegration"
;
import
{
SupabaseIntegration
}
from
"@/components/SupabaseIntegration"
;
import
{
Switch
}
from
"@/components/ui/switch"
;
export
default
function
SettingsPage
()
{
const
{
theme
,
setTheme
}
=
useTheme
();
const
[
isResetDialogOpen
,
setIsResetDialogOpen
]
=
useState
(
false
);
const
[
isResetting
,
setIsResetting
]
=
useState
(
false
);
const
appVersion
=
useAppVersion
();
const
{
settings
}
=
useSettings
();
const
{
settings
,
updateSettings
}
=
useSettings
();
const
router
=
useRouter
();
const
handleResetEverything
=
async
()
=>
{
...
...
@@ -153,7 +154,31 @@ export default function SettingsPage() {
Experiments
</
h2
>
<
div
className=
"space-y-4"
>
There are no experiments currently available.
{
/* Enable File Editing Experiment */
}
<
div
className=
"flex items-center justify-between"
>
<
label
htmlFor=
"enable-file-editing"
className=
"text-sm font-medium text-gray-700 dark:text-gray-300"
>
Enable File Editing
</
label
>
<
Switch
id=
"enable-file-editing"
checked=
{
!!
settings
?.
experiments
?.
enableFileEditing
}
onCheckedChange=
{
(
checked
)
=>
{
updateSettings
({
experiments
:
{
...
settings
?.
experiments
,
enableFileEditing
:
checked
,
},
});
}
}
/>
</
div
>
<
p
className=
"text-xs text-gray-500 dark:text-gray-400 mt-1"
>
File editing is not reliable and requires you to manually commit
changes and update Supabase edge functions.
</
p
>
</
div
>
</
div
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论