build:lint
This commit is contained in:
parent
1c4a4525b3
commit
0ad91e1bab
|
|
@ -8,6 +8,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
|
|
||||||
import { ConversationEmptyState } from "@/components/ai-elements/conversation";
|
import { ConversationEmptyState } from "@/components/ai-elements/conversation";
|
||||||
import { usePromptInputController } from "@/components/ai-elements/prompt-input";
|
import { usePromptInputController } from "@/components/ai-elements/prompt-input";
|
||||||
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
DevDialog,
|
DevDialog,
|
||||||
|
|
@ -27,18 +28,16 @@ import {
|
||||||
ArtifactFileList,
|
ArtifactFileList,
|
||||||
useArtifacts,
|
useArtifacts,
|
||||||
} from "@/components/workspace/artifacts";
|
} from "@/components/workspace/artifacts";
|
||||||
import { Badge } from "@/components/ui/badge";
|
|
||||||
import { DevTodoList } from "@/components/workspace/dev-todo-list";
|
import { DevTodoList } from "@/components/workspace/dev-todo-list";
|
||||||
|
import { IframeTestPanel } from "@/components/workspace/iframe-test-panel";
|
||||||
import { InputBox } from "@/components/workspace/input-box";
|
import { InputBox } from "@/components/workspace/input-box";
|
||||||
import { MessageList } from "@/components/workspace/messages";
|
import { MessageList } from "@/components/workspace/messages";
|
||||||
import { ThreadContext } from "@/components/workspace/messages/context";
|
import { ThreadContext } from "@/components/workspace/messages/context";
|
||||||
import { ThreadTitle } from "@/components/workspace/thread-title";
|
import { ThreadTitle } from "@/components/workspace/thread-title";
|
||||||
import { TodoList } from "@/components/workspace/todo-list";
|
import { TodoList } from "@/components/workspace/todo-list";
|
||||||
import { Tooltip } from "@/components/workspace/tooltip";
|
import { Tooltip } from "@/components/workspace/tooltip";
|
||||||
import { Welcome } from "@/components/workspace/welcome";
|
|
||||||
import { useSpecificChatMode } from "@/components/workspace/use-chat-mode";
|
import { useSpecificChatMode } from "@/components/workspace/use-chat-mode";
|
||||||
import { IframeTestPanel } from "@/components/workspace/iframe-test-panel";
|
import { Welcome } from "@/components/workspace/welcome";
|
||||||
import { useSelectedSkillListener } from "@/hooks/use-selected-skill-listener";
|
|
||||||
import { useI18n } from "@/core/i18n/hooks";
|
import { useI18n } from "@/core/i18n/hooks";
|
||||||
import { useNotification } from "@/core/notification/hooks";
|
import { useNotification } from "@/core/notification/hooks";
|
||||||
import { useLocalSettings } from "@/core/settings";
|
import { useLocalSettings } from "@/core/settings";
|
||||||
|
|
@ -52,6 +51,7 @@ import {
|
||||||
} from "@/core/threads/utils";
|
} from "@/core/threads/utils";
|
||||||
import { uuid } from "@/core/utils/uuid";
|
import { uuid } from "@/core/utils/uuid";
|
||||||
import { env } from "@/env";
|
import { env } from "@/env";
|
||||||
|
import { useSelectedSkillListener } from "@/hooks/use-selected-skill-listener";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
export default function ChatPage() {
|
export default function ChatPage() {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import { useCallback, useEffect, useLayoutEffect, useState } from "react";
|
|
||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
import { Toaster } from "@/components/ui/sonner";
|
import { useCallback, useEffect, useLayoutEffect, useState } from "react";
|
||||||
|
|
||||||
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
|
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
|
||||||
|
import { Toaster } from "@/components/ui/sonner";
|
||||||
import { WorkspaceSidebar } from "@/components/workspace/workspace-sidebar";
|
import { WorkspaceSidebar } from "@/components/workspace/workspace-sidebar";
|
||||||
import { getLocalSettings, useLocalSettings } from "@/core/settings";
|
import { getLocalSettings, useLocalSettings } from "@/core/settings";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import {
|
||||||
} from "react";
|
} from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { Streamdown } from "streamdown";
|
import { Streamdown } from "streamdown";
|
||||||
import { DropdownSelector } from "@/components/ui/dropdown-selector";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Artifact,
|
Artifact,
|
||||||
|
|
@ -31,6 +30,7 @@ import {
|
||||||
ArtifactHeader,
|
ArtifactHeader,
|
||||||
ArtifactTitle,
|
ArtifactTitle,
|
||||||
} from "@/components/ai-elements/artifact";
|
} from "@/components/ai-elements/artifact";
|
||||||
|
import { DropdownSelector } from "@/components/ui/dropdown-selector";
|
||||||
import { Select, SelectItem } from "@/components/ui/select";
|
import { Select, SelectItem } from "@/components/ui/select";
|
||||||
import {
|
import {
|
||||||
SelectContent,
|
SelectContent,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useState } from "react";
|
|
||||||
import { useSearchParams, useRouter } from "next/navigation";
|
import { useSearchParams, useRouter } from "next/navigation";
|
||||||
import { useIframeSkill } from "@/hooks/use-iframe-skill";
|
import { useState } from "react";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { useIframeSkill } from "@/hooks/use-iframe-skill";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ export function InputBox({
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const iframeSkill = useIframeSkill();
|
const iframeSkill = useIframeSkill();
|
||||||
|
|
||||||
const params = useParams() as Record<string, string>;
|
const params = useParams();
|
||||||
const threadId = params?.thread_id;
|
const threadId = params?.thread_id;
|
||||||
const { textInput } = usePromptInputController();
|
const { textInput } = usePromptInputController();
|
||||||
const attachments = usePromptInputAttachments();
|
const attachments = usePromptInputAttachments();
|
||||||
|
|
@ -140,7 +140,7 @@ export function InputBox({
|
||||||
const [isFocused, setIsFocused] = useState(false);
|
const [isFocused, setIsFocused] = useState(false);
|
||||||
|
|
||||||
// isNewThread 时禁用收缩,始终保持展开
|
// isNewThread 时禁用收缩,始终保持展开
|
||||||
const effectiveIsFocused = isNewThread || isFocused;
|
const effectiveIsFocused = (isNewThread ?? false) || isFocused;
|
||||||
|
|
||||||
// 点击外部区域时收起输入框
|
// 点击外部区域时收起输入框
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -257,7 +257,7 @@ export function InputBox({
|
||||||
setFollowupsLoading(true);
|
setFollowupsLoading(true);
|
||||||
setFollowups([]);
|
setFollowups([]);
|
||||||
|
|
||||||
fetch(`/api/threads/${threadId}/suggestions`, {
|
fetch(`/api/threads/${String(threadId)}/suggestions`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ messages: [], n: 3 }),
|
body: JSON.stringify({ messages: [], n: 3 }),
|
||||||
|
|
@ -268,7 +268,7 @@ export function InputBox({
|
||||||
return await res.json();
|
return await res.json();
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
const suggestions = (data.suggestions || [])
|
const suggestions = (data.suggestions ?? [])
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.slice(0, 5);
|
.slice(0, 5);
|
||||||
setFollowups(suggestions);
|
setFollowups(suggestions);
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,8 @@ export const enUS: Translations = {
|
||||||
placeholder: "How can I assist you today?",
|
placeholder: "How can I assist you today?",
|
||||||
createSkillPrompt:
|
createSkillPrompt:
|
||||||
"We're going to build a new skill step by step with `skill-creator`. To start, what do you want this skill to do?",
|
"We're going to build a new skill step by step with `skill-creator`. To start, what do you want this skill to do?",
|
||||||
|
sendMessagePrice:
|
||||||
|
"Please note, this feature will consume tokens. Ensure your account balance is greater than 200 credits.",
|
||||||
addAttachments: "Add attachments",
|
addAttachments: "Add attachments",
|
||||||
selectSkill: "Select Skill",
|
selectSkill: "Select Skill",
|
||||||
mode: "Mode",
|
mode: "Mode",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { useSearchParams } from "next/navigation";
|
import { useSearchParams } from "next/navigation";
|
||||||
import { useEffect, useCallback, useState, useRef } from "react";
|
import { useEffect, useCallback, useState, useRef } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
|
||||||
import { bootstrapRemoteSkill } from "@/core/skills/api";
|
import { bootstrapRemoteSkill } from "@/core/skills/api";
|
||||||
|
|
||||||
/** 宿主页发过来的 selectedSkill 消息结构 */
|
/** 宿主页发过来的 selectedSkill 消息结构 */
|
||||||
|
|
@ -121,9 +122,9 @@ export function useSelectedSkillListener({
|
||||||
}, [threadId, searchParams, performBootstrap]);
|
}, [threadId, searchParams, performBootstrap]);
|
||||||
|
|
||||||
const handleMessage = useCallback(
|
const handleMessage = useCallback(
|
||||||
async (event: MessageEvent) => {
|
(event: MessageEvent) => {
|
||||||
const data = event.data as SelectedSkillMessage;
|
const data = event.data as SelectedSkillMessage;
|
||||||
if (!data || data.type !== "selectedSkill") return;
|
if (data?.type !== "selectedSkill") return;
|
||||||
|
|
||||||
const { id, title } = data;
|
const { id, title } = data;
|
||||||
console.log("[useSelectedSkillListener] 收到 postMessage selectedSkill:", data);
|
console.log("[useSelectedSkillListener] 收到 postMessage selectedSkill:", data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue