Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
1e866c8f
Unverified
提交
1e866c8f
authored
4月 28, 2025
作者:
Will Chen
提交者:
GitHub
4月 28, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Graduate Supabase integration from experiments (#29)
上级
ea07459b
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
16 行增加
和
91 行删除
+16
-91
SupabaseIntegrationSwitch.tsx
src/components/SupabaseIntegrationSwitch.tsx
+0
-64
chat_stream_handlers.ts
src/ipc/handlers/chat_stream_handlers.ts
+11
-12
schemas.ts
src/lib/schemas.ts
+2
-1
settings.ts
src/main/settings.ts
+1
-3
app-details.tsx
src/pages/app-details.tsx
+1
-3
settings.tsx
src/pages/settings.tsx
+1
-8
没有找到文件。
src/components/SupabaseIntegrationSwitch.tsx
deleted
100644 → 0
浏览文件 @
ea07459b
import
{
useState
,
useEffect
}
from
"react"
;
import
{
Switch
}
from
"@/components/ui/switch"
;
import
{
useSettings
}
from
"@/hooks/useSettings"
;
import
{
showSuccess
,
showError
}
from
"@/lib/toast"
;
interface
SupabaseIntegrationSwitchProps
{
showToast
?:
boolean
;
}
export
function
SupabaseIntegrationSwitch
({
showToast
=
true
,
}:
SupabaseIntegrationSwitchProps
)
{
const
{
settings
,
updateSettings
,
refreshSettings
}
=
useSettings
();
const
[
isEnabled
,
setIsEnabled
]
=
useState
(
false
);
const
[
isUpdating
,
setIsUpdating
]
=
useState
(
false
);
useEffect
(()
=>
{
if
(
settings
)
{
setIsEnabled
(
settings
.
experiments
?.
enableSupabaseIntegration
||
false
);
}
},
[
settings
]);
const
handleToggle
=
async
()
=>
{
try
{
setIsUpdating
(
true
);
const
newValue
=
!
isEnabled
;
await
updateSettings
({
experiments
:
{
enableSupabaseIntegration
:
newValue
,
},
});
setIsEnabled
(
newValue
);
if
(
showToast
)
{
showSuccess
(
`Supabase integration
${
newValue
?
"enabled"
:
"disabled"
}
`
);
}
refreshSettings
();
}
catch
(
error
)
{
console
.
error
(
"Error toggling Supabase integration:"
,
error
);
if
(
showToast
)
{
showError
(
"Failed to update Supabase integration setting"
);
}
}
finally
{
setIsUpdating
(
false
);
}
};
return
(
<
div
className=
"flex items-center justify-between"
>
<
label
className=
"text-sm font-medium text-gray-700 dark:text-gray-300"
>
Enable Supabase Integration
</
label
>
<
Switch
checked=
{
isEnabled
}
onCheckedChange=
{
handleToggle
}
disabled=
{
isUpdating
}
className=
"data-[state=checked]:bg-blue-600"
/>
</
div
>
);
}
src/ipc/handlers/chat_stream_handlers.ts
浏览文件 @
1e866c8f
...
...
@@ -154,19 +154,18 @@ export function registerChatStreamHandlers() {
content
:
message
.
content
,
}));
let
systemPrompt
=
SYSTEM_PROMPT
;
if
(
readSettings
().
experiments
?.
enableSupabaseIntegration
)
{
if
(
updatedChat
.
app
?.
supabaseProjectId
)
{
systemPrompt
+=
"
\
n
\
n"
+
SUPABASE_AVAILABLE_SYSTEM_PROMPT
+
"
\
n
\
n"
+
(
await
getSupabaseContext
({
supabaseProjectId
:
updatedChat
.
app
.
supabaseProjectId
,
}));
}
else
{
systemPrompt
+=
"
\
n
\
n"
+
SUPABASE_NOT_AVAILABLE_SYSTEM_PROMPT
;
}
if
(
updatedChat
.
app
?.
supabaseProjectId
)
{
systemPrompt
+=
"
\
n
\
n"
+
SUPABASE_AVAILABLE_SYSTEM_PROMPT
+
"
\
n
\
n"
+
(
await
getSupabaseContext
({
supabaseProjectId
:
updatedChat
.
app
.
supabaseProjectId
,
}));
}
else
{
systemPrompt
+=
"
\
n
\
n"
+
SUPABASE_NOT_AVAILABLE_SYSTEM_PROMPT
;
}
const
{
textStream
}
=
streamText
({
maxTokens
:
8
_000
,
temperature
:
0
,
...
...
src/lib/schemas.ts
浏览文件 @
1e866c8f
...
...
@@ -90,7 +90,8 @@ export const SupabaseSchema = z.object({
export
type
Supabase
=
z
.
infer
<
typeof
SupabaseSchema
>
;
export
const
ExperimentsSchema
=
z
.
object
({
enableSupabaseIntegration
:
z
.
boolean
().
optional
(),
// Deprecated
enableSupabaseIntegration
:
z
.
boolean
().
describe
(
"DEPRECATED"
).
optional
(),
});
export
type
Experiments
=
z
.
infer
<
typeof
ExperimentsSchema
>
;
...
...
src/main/settings.ts
浏览文件 @
1e866c8f
...
...
@@ -16,9 +16,7 @@ const DEFAULT_SETTINGS: UserSettings = {
telemetryConsent
:
"unset"
,
telemetryUserId
:
uuidv4
(),
hasRunBefore
:
false
,
experiments
:
{
enableSupabaseIntegration
:
false
,
},
experiments
:
{},
};
const
SETTINGS_FILE
=
"user-settings.json"
;
...
...
src/pages/app-details.tsx
浏览文件 @
1e866c8f
...
...
@@ -249,9 +249,7 @@ export default function AppDetailsPage() {
<
MessageCircle
className=
"h-4 w-4"
/>
</
Button
>
<
GitHubConnector
appId=
{
appId
}
folderName=
{
selectedApp
.
path
}
/>
{
appId
&&
settings
?.
experiments
?.
enableSupabaseIntegration
&&
(
<
SupabaseConnector
appId=
{
appId
}
/>
)
}
{
appId
&&
<
SupabaseConnector
appId=
{
appId
}
/>
}
</
div
>
{
/* Rename Dialog */
}
...
...
src/pages/settings.tsx
浏览文件 @
1e866c8f
...
...
@@ -6,7 +6,6 @@ import { IpcClient } from "@/ipc/ipc_client";
import
{
showSuccess
,
showError
}
from
"@/lib/toast"
;
import
{
AutoApproveSwitch
}
from
"@/components/AutoApproveSwitch"
;
import
{
TelemetrySwitch
}
from
"@/components/TelemetrySwitch"
;
import
{
SupabaseIntegrationSwitch
}
from
"@/components/SupabaseIntegrationSwitch"
;
import
{
useSettings
}
from
"@/hooks/useSettings"
;
import
{
Button
}
from
"@/components/ui/button"
;
import
{
ArrowLeft
}
from
"lucide-react"
;
...
...
@@ -152,13 +151,7 @@ export default function SettingsPage() {
Experiments
</
h2
>
<
div
className=
"space-y-4"
>
<
div
className=
"space-y-2"
>
<
SupabaseIntegrationSwitch
/>
<
div
className=
"text-sm text-gray-500 dark:text-gray-400"
>
Enable integration with Supabase for auth, database and server
function support.
</
div
>
</
div
>
There are no experiments currently available.
</
div
>
</
div
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论