Skip to content

Commit fd0999c

Browse files
committed
Add a link to the run
1 parent 0c44c9a commit fd0999c

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

references/d3-chat/src/components/chat-container.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,20 @@ export function useTodoChat({ accessToken }: { accessToken: string }) {
110110
triggerInstance.handle === null) ||
111111
triggerInstance.isLoading;
112112

113+
const dashboardUrl = triggerInstance.run
114+
? `${process.env.NEXT_PUBLIC_DASHBOARD_RUNS_URL}/${triggerInstance.run.id}`
115+
: null;
116+
113117
return {
114118
...triggerInstance,
115119
messages,
116120
isSubmitting,
121+
dashboardUrl,
117122
};
118123
}
119124

120125
export function ChatContainer({ triggerToken }: { triggerToken: string }) {
121-
const { messages, submit, isSubmitting } = useTodoChat({
126+
const { messages, submit, isSubmitting, dashboardUrl } = useTodoChat({
122127
accessToken: triggerToken,
123128
});
124129

@@ -130,6 +135,25 @@ export function ChatContainer({ triggerToken }: { triggerToken: string }) {
130135
<span className="ml-2 bg-green-100 text-green-800 text-xs px-2 py-0.5 rounded-full">
131136
Active
132137
</span>
138+
{dashboardUrl && (
139+
<a
140+
href={dashboardUrl}
141+
target="_blank"
142+
rel="noopener noreferrer"
143+
className="ml-2 text-xs text-blue-500 hover:text-blue-700 flex items-center gap-1"
144+
>
145+
<svg
146+
xmlns="http://www.w3.org/2000/svg"
147+
className="h-3 w-3"
148+
viewBox="0 0 20 20"
149+
fill="currentColor"
150+
>
151+
<path d="M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z" />
152+
<path d="M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z" />
153+
</svg>
154+
View Run
155+
</a>
156+
)}
133157
<div className="ml-auto flex space-x-2">
134158
<button className="text-xs text-gray-500 hover:text-gray-700 px-2 py-1 border border-gray-200 rounded">
135159
Clear

0 commit comments

Comments
 (0)