Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
59de308e
提交
59de308e
authored
4月 18, 2025
作者:
Will Chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Automatically refresh app iframe
上级
86b97201
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
18 行增加
和
3 行删除
+18
-3
ChatInput.tsx
src/components/chat/ChatInput.tsx
+7
-0
PreviewIframe.tsx
src/components/preview_panel/PreviewIframe.tsx
+2
-2
useRunApp.ts
src/hooks/useRunApp.ts
+6
-1
useStreamChat.ts
src/hooks/useStreamChat.ts
+3
-0
没有找到文件。
src/components/chat/ChatInput.tsx
浏览文件 @
59de308e
...
@@ -50,6 +50,8 @@ export function ChatInput({ chatId }: { chatId?: number }) {
...
@@ -50,6 +50,8 @@ export function ChatInput({ chatId }: { chatId?: number }) {
const
[
messages
,
setMessages
]
=
useAtom
<
Message
[]
>
(
chatMessagesAtom
);
const
[
messages
,
setMessages
]
=
useAtom
<
Message
[]
>
(
chatMessagesAtom
);
const
setIsPreviewOpen
=
useSetAtom
(
isPreviewOpenAtom
);
const
setIsPreviewOpen
=
useSetAtom
(
isPreviewOpenAtom
);
const
{
refreshAppIframe
}
=
useRunApp
();
// Use the hook to fetch the proposal
// Use the hook to fetch the proposal
const
{
const
{
proposalResult
,
proposalResult
,
...
@@ -140,6 +142,9 @@ export function ChatInput({ chatId }: { chatId?: number }) {
...
@@ -140,6 +142,9 @@ export function ChatInput({ chatId }: { chatId?: number }) {
}
finally
{
}
finally
{
setIsApproving
(
false
);
setIsApproving
(
false
);
setIsPreviewOpen
(
true
);
setIsPreviewOpen
(
true
);
refreshAppIframe
();
// Keep same as handleReject
refreshProposal
();
refreshProposal
();
fetchChatMessages
();
fetchChatMessages
();
}
}
...
@@ -169,6 +174,8 @@ export function ChatInput({ chatId }: { chatId?: number }) {
...
@@ -169,6 +174,8 @@ export function ChatInput({ chatId }: { chatId?: number }) {
setError
((
err
as
Error
)?.
message
||
"An error occurred while rejecting"
);
setError
((
err
as
Error
)?.
message
||
"An error occurred while rejecting"
);
}
finally
{
}
finally
{
setIsRejecting
(
false
);
setIsRejecting
(
false
);
// Keep same as handleApprove
refreshProposal
();
refreshProposal
();
fetchChatMessages
();
fetchChatMessages
();
}
}
...
...
src/components/preview_panel/PreviewIframe.tsx
浏览文件 @
59de308e
...
@@ -55,8 +55,8 @@ const ErrorBanner = ({ error, onDismiss, onAIFix }: ErrorBannerProps) => {
...
@@ -55,8 +55,8 @@ const ErrorBanner = ({ error, onDismiss, onAIFix }: ErrorBannerProps) => {
<
Lightbulb
size=
{
16
}
className=
" text-red-800 dark:text-red-300"
/>
<
Lightbulb
size=
{
16
}
className=
" text-red-800 dark:text-red-300"
/>
</
div
>
</
div
>
<
span
className=
"text-sm text-red-700 dark:text-red-200"
>
<
span
className=
"text-sm text-red-700 dark:text-red-200"
>
<
span
className=
"font-medium"
>
Tip:
</
span
>
Check if re
fresh
ing the
<
span
className=
"font-medium"
>
Tip:
</
span
>
Check if re
start
ing the
page or restarting the
app fixes the error.
app fixes the error.
</
span
>
</
span
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
src/hooks/useRunApp.ts
浏览文件 @
59de308e
...
@@ -106,5 +106,10 @@ export function useRunApp() {
...
@@ -106,5 +106,10 @@ export function useRunApp() {
}
}
},
[]);
},
[]);
return
{
loading
,
error
,
runApp
,
stopApp
,
restartApp
,
app
};
const
refreshAppIframe
=
useCallback
(
async
()
=>
{
setPreviewPanelKey
((
prevKey
)
=>
prevKey
+
1
);
setError
(
null
);
},
[
setPreviewPanelKey
,
setError
]);
return
{
loading
,
error
,
runApp
,
stopApp
,
restartApp
,
app
,
refreshAppIframe
};
}
}
src/hooks/useStreamChat.ts
浏览文件 @
59de308e
...
@@ -17,6 +17,7 @@ import { useLoadVersions } from "./useLoadVersions";
...
@@ -17,6 +17,7 @@ import { useLoadVersions } from "./useLoadVersions";
import
{
showError
}
from
"@/lib/toast"
;
import
{
showError
}
from
"@/lib/toast"
;
import
{
useProposal
}
from
"./useProposal"
;
import
{
useProposal
}
from
"./useProposal"
;
import
{
useSearch
}
from
"@tanstack/react-router"
;
import
{
useSearch
}
from
"@tanstack/react-router"
;
import
{
useRunApp
}
from
"./useRunApp"
;
export
function
getRandomString
()
{
export
function
getRandomString
()
{
return
Math
.
random
().
toString
(
36
).
substring
(
2
,
15
);
return
Math
.
random
().
toString
(
36
).
substring
(
2
,
15
);
...
@@ -34,6 +35,7 @@ export function useStreamChat({
...
@@ -34,6 +35,7 @@ export function useStreamChat({
const
{
refreshApp
}
=
useLoadApp
(
selectedAppId
);
const
{
refreshApp
}
=
useLoadApp
(
selectedAppId
);
const
setStreamCount
=
useSetAtom
(
chatStreamCountAtom
);
const
setStreamCount
=
useSetAtom
(
chatStreamCountAtom
);
const
{
refreshVersions
}
=
useLoadVersions
(
selectedAppId
);
const
{
refreshVersions
}
=
useLoadVersions
(
selectedAppId
);
const
{
refreshAppIframe
}
=
useRunApp
();
let
chatId
:
number
|
undefined
;
let
chatId
:
number
|
undefined
;
if
(
hasChatId
)
{
if
(
hasChatId
)
{
...
@@ -100,6 +102,7 @@ export function useStreamChat({
...
@@ -100,6 +102,7 @@ export function useStreamChat({
onEnd
:
(
response
:
ChatResponseEnd
)
=>
{
onEnd
:
(
response
:
ChatResponseEnd
)
=>
{
if
(
response
.
updatedFiles
)
{
if
(
response
.
updatedFiles
)
{
setIsPreviewOpen
(
true
);
setIsPreviewOpen
(
true
);
refreshAppIframe
();
}
}
refreshProposal
(
chatId
);
refreshProposal
(
chatId
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论