|
|
@@ -21,14 +21,18 @@ import { ScrollToBottomButton } from "./scroll-to-bottom-button";
|
|
|
import { Suggestions } from "./suggestions";
|
|
|
import { SUGGESTIONS } from "#/utils/suggestions";
|
|
|
import BuildIt from "#/icons/build-it.svg?react";
|
|
|
-import { useWsClient } from "#/context/ws-client-provider";
|
|
|
+import {
|
|
|
+ useWsClient,
|
|
|
+ WsClientProviderStatus,
|
|
|
+} from "#/context/ws-client-provider";
|
|
|
+import OpenHands from "#/api/open-hands";
|
|
|
|
|
|
const isErrorMessage = (
|
|
|
message: Message | ErrorMessage,
|
|
|
): message is ErrorMessage => "error" in message;
|
|
|
|
|
|
export function ChatInterface() {
|
|
|
- const { send, isLoadingMessages } = useWsClient();
|
|
|
+ const { send, status, isLoadingMessages } = useWsClient();
|
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
const scrollRef = React.useRef<HTMLDivElement>(null);
|
|
|
@@ -44,6 +48,23 @@ export function ChatInterface() {
|
|
|
const [feedbackModalIsOpen, setFeedbackModalIsOpen] = React.useState(false);
|
|
|
const [messageToSend, setMessageToSend] = React.useState<string | null>(null);
|
|
|
|
|
|
+ React.useEffect(() => {
|
|
|
+ if (status === WsClientProviderStatus.ACTIVE) {
|
|
|
+ try {
|
|
|
+ OpenHands.getRuntimeId().then(({ runtime_id }) => {
|
|
|
+ // eslint-disable-next-line no-console
|
|
|
+ console.log(
|
|
|
+ "Runtime ID: %c%s",
|
|
|
+ "background: #444; color: #ffeb3b; font-weight: bold; padding: 2px 4px; border-radius: 4px;",
|
|
|
+ runtime_id,
|
|
|
+ );
|
|
|
+ });
|
|
|
+ } catch (e) {
|
|
|
+ console.warn("Runtime ID not available in this environment");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, [status]);
|
|
|
+
|
|
|
const handleSendMessage = async (content: string, files: File[]) => {
|
|
|
posthog.capture("user_message_sent", {
|
|
|
current_message_count: messages.length,
|