Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
0123e68d
Unverified
提交
0123e68d
authored
6月 05, 2025
作者:
Will Chen
提交者:
GitHub
6月 05, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Instrument extra files warning (#345)
https://github.com/dyad-sh/dyad/issues/244
上级
16bf0828
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
14 行增加
和
1 行删除
+14
-1
ChatInput.tsx
src/components/chat/ChatInput.tsx
+1
-0
useStreamChat.ts
src/hooks/useStreamChat.ts
+3
-1
toast.ts
src/lib/toast.ts
+10
-0
没有找到文件。
src/components/chat/ChatInput.tsx
浏览文件 @
0123e68d
...
@@ -188,6 +188,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
...
@@ -188,6 +188,7 @@ export function ChatInput({ chatId }: { chatId?: number }) {
showExtraFilesToast
({
showExtraFilesToast
({
files
:
result
.
extraFiles
,
files
:
result
.
extraFiles
,
error
:
result
.
extraFilesError
,
error
:
result
.
extraFilesError
,
posthog
,
});
});
}
}
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
src/hooks/useStreamChat.ts
浏览文件 @
0123e68d
...
@@ -20,6 +20,7 @@ import { useSearch } from "@tanstack/react-router";
...
@@ -20,6 +20,7 @@ import { useSearch } from "@tanstack/react-router";
import
{
useRunApp
}
from
"./useRunApp"
;
import
{
useRunApp
}
from
"./useRunApp"
;
import
{
useCountTokens
}
from
"./useCountTokens"
;
import
{
useCountTokens
}
from
"./useCountTokens"
;
import
{
useUserBudgetInfo
}
from
"./useUserBudgetInfo"
;
import
{
useUserBudgetInfo
}
from
"./useUserBudgetInfo"
;
import
{
usePostHog
}
from
"posthog-js/react"
;
export
function
getRandomNumberId
()
{
export
function
getRandomNumberId
()
{
return
Math
.
floor
(
Math
.
random
()
*
1
_000_000_000_000_000
);
return
Math
.
floor
(
Math
.
random
()
*
1
_000_000_000_000_000
);
...
@@ -40,7 +41,7 @@ export function useStreamChat({
...
@@ -40,7 +41,7 @@ export function useStreamChat({
const
{
refreshAppIframe
}
=
useRunApp
();
const
{
refreshAppIframe
}
=
useRunApp
();
const
{
countTokens
}
=
useCountTokens
();
const
{
countTokens
}
=
useCountTokens
();
const
{
refetchUserBudget
}
=
useUserBudgetInfo
();
const
{
refetchUserBudget
}
=
useUserBudgetInfo
();
const
posthog
=
usePostHog
();
let
chatId
:
number
|
undefined
;
let
chatId
:
number
|
undefined
;
if
(
hasChatId
)
{
if
(
hasChatId
)
{
...
@@ -93,6 +94,7 @@ export function useStreamChat({
...
@@ -93,6 +94,7 @@ export function useStreamChat({
showExtraFilesToast
({
showExtraFilesToast
({
files
:
response
.
extraFiles
,
files
:
response
.
extraFiles
,
error
:
response
.
extraFilesError
,
error
:
response
.
extraFilesError
,
posthog
,
});
});
}
}
refreshProposal
(
chatId
);
refreshProposal
(
chatId
);
...
...
src/lib/toast.ts
浏览文件 @
0123e68d
import
{
toast
}
from
"sonner"
;
import
{
toast
}
from
"sonner"
;
import
{
PostHog
}
from
"posthog-js"
;
/**
/**
* Toast utility functions for consistent notifications across the app
* Toast utility functions for consistent notifications across the app
...
@@ -61,19 +62,28 @@ export const showLoading = <T>(
...
@@ -61,19 +62,28 @@ export const showLoading = <T>(
export
const
showExtraFilesToast
=
({
export
const
showExtraFilesToast
=
({
files
,
files
,
error
,
error
,
posthog
,
}:
{
}:
{
files
:
string
[];
files
:
string
[];
error
?:
string
;
error
?:
string
;
posthog
:
PostHog
;
})
=>
{
})
=>
{
if
(
error
)
{
if
(
error
)
{
showError
(
showError
(
`Error committing files
${
files
.
join
(
", "
)}
changed outside of Dyad:
${
error
}
`
,
`Error committing files
${
files
.
join
(
", "
)}
changed outside of Dyad:
${
error
}
`
,
);
);
posthog
.
capture
(
"extra-files:error"
,
{
files
:
files
,
error
,
});
}
else
{
}
else
{
showWarning
(
showWarning
(
`Files changed outside of Dyad have automatically been committed:
`Files changed outside of Dyad have automatically been committed:
\n\n
${
files
.
join
(
"
\
n"
)}
`
,
\n\n
${
files
.
join
(
"
\
n"
)}
`
,
);
);
posthog
.
capture
(
"extra-files:warning"
,
{
files
:
files
,
});
}
}
};
};
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论