Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
6a4f5388
提交
6a4f5388
authored
4月 13, 2025
作者:
Will Chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update setup/settings flow for runtime
上级
3074634c
全部展开
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
75 行增加
和
9 行删除
+75
-9
TitleBar.tsx
src/app/TitleBar.tsx
+3
-3
SetupRuntimeFlow.tsx
src/components/SetupRuntimeFlow.tsx
+0
-0
app_handlers.ts
src/ipc/handlers/app_handlers.ts
+52
-0
ipc_client.ts
src/ipc/ipc_client.ts
+17
-0
home.tsx
src/pages/home.tsx
+2
-6
settings.tsx
src/pages/settings.tsx
+0
-0
preload.ts
src/preload.ts
+1
-0
没有找到文件。
src/app/TitleBar.tsx
浏览文件 @
6a4f5388
...
...
@@ -8,9 +8,9 @@ import { RuntimeMode } from "@/lib/schemas";
function
formatRuntimeMode
(
runtimeMode
:
RuntimeMode
|
undefined
)
{
switch
(
runtimeMode
)
{
case
"web-sandbox"
:
return
"Sandbox"
;
return
"Sandbox
ed
"
;
case
"local-node"
:
return
"
Local
"
;
return
"
Full Access
"
;
default
:
return
runtimeMode
;
}
...
...
@@ -33,7 +33,7 @@ export const TitleBar = () => {
<
div
className=
"pl-24"
></
div
>
<
div
className=
"hidden @md:block text-sm font-medium"
>
{
displayText
}
</
div
>
<
div
className=
"text-sm font-medium pl-4"
>
{
formatRuntimeMode
(
settings
?.
runtimeMode
)
}
runtim
e
{
formatRuntimeMode
(
settings
?.
runtimeMode
)
}
mod
e
</
div
>
<
div
className=
"flex-1 text-center text-sm font-medium"
>
Dyad
</
div
>
</
div
>
...
...
src/components/SetupRuntimeFlow.tsx
浏览文件 @
6a4f5388
差异被折叠。
点击展开。
src/ipc/handlers/app_handlers.ts
浏览文件 @
6a4f5388
...
...
@@ -209,7 +209,59 @@ async function executeAppLocalNode({
});
}
function
checkCommandExists
(
command
:
string
):
Promise
<
string
|
null
>
{
return
new
Promise
((
resolve
)
=>
{
let
output
=
""
;
const
process
=
spawn
(
command
,
[
"--version"
],
{
shell
:
true
,
stdio
:
[
"ignore"
,
"pipe"
,
"pipe"
],
// ignore stdin, pipe stdout/stderr
});
process
.
stdout
?.
on
(
"data"
,
(
data
)
=>
{
output
+=
data
.
toString
();
});
process
.
stderr
?.
on
(
"data"
,
(
data
)
=>
{
// Log stderr but don't treat it as a failure unless the exit code is non-zero
console
.
warn
(
`Stderr from "
${
command
}
--version":
${
data
.
toString
().
trim
()}
`
);
});
process
.
on
(
"error"
,
(
error
)
=>
{
console
.
error
(
`Error executing command "
${
command
}
":`
,
error
.
message
);
resolve
(
null
);
// Command execution failed
});
process
.
on
(
"close"
,
(
code
)
=>
{
if
(
code
===
0
)
{
resolve
(
output
.
trim
());
// Command succeeded, return trimmed output
}
else
{
console
.
error
(
`Command "
${
command
}
--version" failed with code
${
code
}
`
);
resolve
(
null
);
// Command failed
}
});
});
}
export
function
registerAppHandlers
()
{
ipcMain
.
handle
(
"nodejs-status"
,
async
():
Promise
<
{
nodeVersion
:
string
|
null
;
npmVersion
:
string
|
null
;
}
>
=>
{
// Run checks in parallel
const
[
nodeVersion
,
npmVersion
]
=
await
Promise
.
all
([
checkCommandExists
(
"node"
),
checkCommandExists
(
"npm"
),
]);
return
{
nodeVersion
,
npmVersion
};
}
);
ipcMain
.
handle
(
"get-app-sandbox-config"
,
async
(
_
,
{
appId
}:
{
appId
:
number
}):
Promise
<
SandboxConfig
>
=>
{
...
...
src/ipc/ipc_client.ts
浏览文件 @
6a4f5388
...
...
@@ -488,4 +488,21 @@ export class IpcClient {
throw
error
;
}
}
// Check Node.js and npm status
public
async
getNodejsStatus
():
Promise
<
{
nodeVersion
:
string
|
null
;
npmVersion
:
string
|
null
;
}
>
{
try
{
const
result
=
await
this
.
ipcRenderer
.
invoke
(
"nodejs-status"
);
return
result
as
{
nodeVersion
:
string
|
null
;
npmVersion
:
string
|
null
;
};
}
catch
(
error
)
{
showError
(
error
);
throw
error
;
}
}
}
src/pages/home.tsx
浏览文件 @
6a4f5388
...
...
@@ -20,7 +20,7 @@ export default function HomePage() {
const
search
=
useSearch
({
from
:
"/"
});
const
setSelectedAppId
=
useSetAtom
(
selectedAppIdAtom
);
const
{
refreshApps
}
=
useLoadApps
();
const
{
settings
,
isAnyProviderSetup
,
updateSettings
}
=
useSettings
();
const
{
settings
,
isAnyProviderSetup
}
=
useSettings
();
const
setIsPreviewOpen
=
useSetAtom
(
isPreviewOpenAtom
);
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
);
const
{
streamMessage
}
=
useStreamChat
();
...
...
@@ -35,10 +35,6 @@ export default function HomePage() {
}
},
[
appId
,
navigate
]);
const
handleSetRuntimeMode
=
async
(
mode
:
RuntimeMode
)
=>
{
await
updateSettings
({
runtimeMode
:
mode
});
};
const
handleSubmit
=
async
()
=>
{
if
(
!
inputValue
.
trim
())
return
;
...
...
@@ -90,7 +86,7 @@ export default function HomePage() {
// Runtime Setup Flow
// Render this only if runtimeMode is not set in settings
if
(
settings
?.
runtimeMode
===
"unset"
)
{
return
<
SetupRuntimeFlow
onRuntimeSelected=
{
handleSetRuntimeMode
}
/>;
return
<
SetupRuntimeFlow
/>;
}
// Main Home Page Content (Rendered only if runtimeMode is set)
...
...
src/pages/settings.tsx
浏览文件 @
6a4f5388
差异被折叠。
点击展开。
src/preload.ts
浏览文件 @
6a4f5388
...
...
@@ -31,6 +31,7 @@ const validInvokeChannels = [
"get-env-vars"
,
"open-external-url"
,
"reset-all"
,
"nodejs-status"
,
]
as
const
;
// Add valid receive channels
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论