feat(chatbot): remove agentId from request and resolve it via team settings, toggle chatbot icon with tooltip guard

This commit is contained in:
yiling
2026-07-11 11:49:38 +08:00
parent 87d811dad6
commit 3d266a5606
24 changed files with 476 additions and 51 deletions
+7 -15
View File
@@ -14,7 +14,7 @@ describe('ChatService', () => {
const team = await prisma.team.create({
data: {
name: 'Test Team',
settings: { transcode: { videoStrategy: 'best_match' } },
settings: { transcode: { videoStrategy: 'best_match' }, chatbotAgentId: 'test-agent-id' },
sandbox: { create: {} },
},
})
@@ -73,10 +73,9 @@ describe('ChatService', () => {
}
it('should start a new chat session and trigger workflow', async () => {
const { user, project, rootFolder, agent } = await setupBasicData()
const { user, project, rootFolder } = await setupBasicData()
const { sessionId, taskId } = await chatService.startOrContinueChat(user, {
agentId: agent.id,
textPrompt: 'hello world',
projectId: project.id,
})
@@ -117,11 +116,10 @@ describe('ChatService', () => {
})
it('should continue an existing chat session', async () => {
const { user, project, agent } = await setupBasicData()
const { user, project } = await setupBasicData()
// Start
const { sessionId } = await chatService.startOrContinueChat(user, {
agentId: agent.id,
textPrompt: 'first message',
projectId: project.id,
})
@@ -130,7 +128,6 @@ describe('ChatService', () => {
const { sessionId: nextSessionId, taskId: nextTaskId } = await chatService.startOrContinueChat(
user,
{
agentId: agent.id,
textPrompt: 'second message',
sessionId,
},
@@ -156,7 +153,7 @@ describe('ChatService', () => {
})
it('should inject context of referenced assets and attached files', async () => {
const { user, project, rootFolder, agent } = await setupBasicData()
const { user, project, rootFolder } = await setupBasicData()
const childFolder = await prisma.asset.create({
data: {
@@ -187,7 +184,6 @@ describe('ChatService', () => {
})
const { taskId } = await chatService.startOrContinueChat(user, {
agentId: agent.id,
textPrompt: 'process file',
projectId: project.id,
assetIds: [childFolder.id],
@@ -207,16 +203,14 @@ describe('ChatService', () => {
})
it('should list sessions of a user', async () => {
const { user, project, agent } = await setupBasicData()
const { user, project } = await setupBasicData()
await chatService.startOrContinueChat(user, {
agentId: agent.id,
textPrompt: 'chat 1',
projectId: project.id,
})
await chatService.startOrContinueChat(user, {
agentId: agent.id,
textPrompt: 'chat 2',
projectId: project.id,
})
@@ -226,10 +220,9 @@ describe('ChatService', () => {
})
it('should list messages mapped correctly', async () => {
const { user, project, agent } = await setupBasicData()
const { user, project } = await setupBasicData()
const { sessionId } = await chatService.startOrContinueChat(user, {
agentId: agent.id,
textPrompt: 'hello',
projectId: project.id,
})
@@ -263,10 +256,9 @@ describe('ChatService', () => {
})
it('should delete session and cascade', async () => {
const { user, project, agent } = await setupBasicData()
const { user, project } = await setupBasicData()
const { sessionId } = await chatService.startOrContinueChat(user, {
agentId: agent.id,
textPrompt: 'to delete',
projectId: project.id,
})
+20 -10
View File
@@ -129,7 +129,6 @@ export class ChatService {
req: ChatRequest,
): Promise<{ sessionId: string; taskId: string }> {
const {
agentId,
textPrompt,
attachedFiles = [],
assetIds = [],
@@ -232,21 +231,32 @@ export class ChatService {
const teamId = asset.project.teamId
const projectId = asset.project.id
let agentId: string
let activeSessionId = passedSessionId
if (activeSessionId) {
const sessionExists = await tx.agentSession.findUnique({
where: { id: activeSessionId },
select: { id: true, agentId: true },
})
if (!sessionExists) throw new Error('Session not found')
agentId = sessionExists.agentId
} else {
const teamSettings = (asset.project.team.settings || {}) as Record<string, unknown>
const settingsAgentId = teamSettings.chatbotAgentId as string | undefined
if (!settingsAgentId) {
throw new Error('No chatbot agent configured for the team')
}
agentId = settingsAgentId
}
// Ensure AI agent configuration exists
const agent = await tx.agent.findUnique({ where: { id: agentId } })
if (!agent) {
throw new Error(`Agent with ID "${agentId}" not found`)
}
let activeSessionId = passedSessionId
if (activeSessionId) {
const sessionExists = await tx.agentSession.findUnique({
where: { id: activeSessionId },
select: { id: true },
})
if (!sessionExists) throw new Error('Session not found')
} else {
if (!activeSessionId) {
const newSession = await tx.agentSession.create({
data: {
agentId,
+1
View File
@@ -59,6 +59,7 @@ declare global {
export interface Settings {
transcode: TranscodeSettings
chatbotAgentId?: string | null
}
// ----------------------------------------------------------------------
-1
View File
@@ -3,7 +3,6 @@ import type { AgentMessage } from '@earendil-works/pi-agent-core'
export const chatRequestSchema = z
.object({
agentId: z.string(),
textPrompt: z.string().optional(),
attachedFiles: z.array(z.string()).optional(), // Uploaded file asset IDs
assetIds: z.array(z.string()).optional(), // Workspace file/folder IDs referenced
+4
View File
@@ -76,6 +76,10 @@ export const updateTeamSettingsRequestSchema = z.discriminatedUnion('key', [
key: z.literal('transcode.videoStrategy'),
value: z.nativeEnum(VideoTranscodeStrategy),
}),
z.object({
key: z.literal('chatbotAgentId'),
value: z.string().nullable(),
}),
])
export type UpdateTeamSettingsRequest = z.infer<typeof updateTeamSettingsRequestSchema>
+61 -20
View File
@@ -18,10 +18,13 @@ import {
DockToRight,
DockToRightFilled,
} from '@/ui/components/ui/icons'
import { usePermissions } from '@/ui/hooks/use-permissions'
import { cn } from '@/ui/lib/utils'
import { m } from '@/ui/paraglide/messages.js'
import type { AncestorFolder } from '@shumai/dtos'
import { useQuery } from '@tanstack/react-query'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '@/ui/components/ui/tooltip'
import { Link, useNavigate } from '@tanstack/react-router'
import {
Check,
@@ -33,6 +36,10 @@ import {
List,
Bot,
} from 'lucide-react'
import { usePermissions } from '@/ui/hooks/use-permissions'
import { cn } from '@/ui/lib/utils'
import { m } from '@/ui/paraglide/messages.js'
import type { AncestorFolder } from '@shumai/dtos'
interface BreadcrumbNavProps {
teamId: string
@@ -107,6 +114,21 @@ export function BreadcrumbNav({
const navigate = useNavigate()
const { canEdit } = usePermissions(projectId)
const { data: teamSettings } = useQuery({
queryKey: ['teams', teamId, 'settings'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].settings.$get({
param: { teamId },
})
if (!res.ok) throw new Error('failed to fetch settings')
return res.json()
},
enabled: !!teamId && !isPublic,
})
const isChatbotDisabled =
!isPublic && !(teamSettings as { chatbotAgentId?: string | null })?.chatbotAgentId
const handleVersionClick = (versionId: string) => {
if (!fileId) return
if (isPublic && shareId) {
@@ -444,22 +466,41 @@ export function BreadcrumbNav({
{/* Chatbot Toggle Button */}
{!isPublic && onChatbotToggle && (
<button
onClick={onChatbotToggle}
className={`h-9 w-9 flex items-center justify-center rounded-md border border-border bg-background transition-colors ${
isChatbotOpen
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground hover:bg-accent hover:text-foreground'
}`}
title={isChatbotOpen ? m.hide_chatbot() : m.show_chatbot()}
>
<Bot
className={cn(
'h-4 w-4 transition-colors',
isChatbotOpen ? 'text-primary fill-primary/10' : 'text-muted-foreground',
)}
/>
</button>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<span>
<button
disabled={isChatbotDisabled}
onClick={onChatbotToggle}
className={cn(
'h-9 w-9 flex items-center justify-center rounded-md border border-border bg-background transition-colors',
isChatbotOpen
? 'bg-accent text-accent-foreground'
: 'text-muted-foreground hover:bg-accent hover:text-foreground',
isChatbotDisabled && 'opacity-50 cursor-not-allowed',
)}
>
<Bot
className={cn(
'h-4 w-4 transition-colors',
isChatbotOpen ? 'text-primary fill-primary/10' : 'text-muted-foreground',
)}
/>
</button>
</span>
</TooltipTrigger>
<TooltipContent>
<p>
{isChatbotDisabled
? m.configure_chatbot_agent_first()
: isChatbotOpen
? m.hide_chatbot()
: m.show_chatbot()}
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
)}
</div>
</div>
@@ -2,6 +2,13 @@ import { client } from '@/ui/api/client'
import { Card, CardContent } from '@/ui/components/ui/card'
import { Button } from '@/ui/components/ui/button'
import { Badge } from '@/ui/components/ui/badge'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/ui/components/ui/select'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import {
Loader2,
@@ -16,7 +23,7 @@ import {
} from 'lucide-react'
import { useState } from 'react'
import { toast } from 'sonner'
import { AgentInfo, AgentType, ThinkingLevel } from '@shumai/dtos'
import { AgentInfo, AgentType, ThinkingLevel, UpdateTeamSettingsRequest } from '@shumai/dtos'
import { AgentFormDialog } from './AgentFormDialog'
import {
DropdownMenu,
@@ -143,6 +150,35 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
},
})
const { data: teamSettings } = useQuery({
queryKey: ['teams', teamId, 'settings'],
queryFn: async () => {
const res = await client.api.teams[':teamId'].settings.$get({
param: { teamId },
})
if (!res.ok) throw new Error('failed to fetch team settings')
return res.json()
},
})
const updateSettingsMutation = useMutation({
mutationFn: async (params: UpdateTeamSettingsRequest) => {
const res = await client.api.teams[':teamId'].settings.$patch({
param: { teamId },
json: params,
})
if (!res.ok) throw new Error('failed to update settings')
return res.json()
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['teams', teamId, 'settings'] })
toast.success(m.settings_saved())
},
onError: (err) => {
toast.error(err.message)
},
})
const toggleSection = (type: string) => {
setExpandedSections((prev) => ({
...prev,
@@ -213,6 +249,55 @@ export function AgentsSettings({ teamId }: AgentsSettingsProps) {
<Loader2 className="w-4 h-4 animate-spin text-muted-foreground" />
</div>
)}
{/* Global Chatbot Agent Configuration Card */}
<Card className="border-border shadow-xs">
<CardContent className="p-6">
<div className="flex flex-col md:flex-row md:items-center justify-between gap-4">
<div className="space-y-1">
<h4 className="font-semibold text-foreground flex items-center gap-2 text-sm md:text-base">
<Bot className="w-5 h-5 text-primary" />
{m.global_chatbot()}
</h4>
<p className="text-xs md:text-sm text-muted-foreground">
{m.global_chatbot_description()}
</p>
</div>
<div className="w-full md:w-72 shrink-0">
{agents.filter((a) => a.type === 'chat' && a.enabled).length === 0 ? (
<div className="text-xs text-amber-600 bg-amber-50 dark:bg-amber-950/20 dark:text-amber-400 p-2.5 rounded-lg border border-amber-200 dark:border-amber-900/30">
{m.no_chat_agents_warning()}
</div>
) : (
<Select
value={
(teamSettings as { chatbotAgentId?: string | null })?.chatbotAgentId || ''
}
onValueChange={(val) => {
updateSettingsMutation.mutate({
key: 'chatbotAgentId',
value: val || null,
})
}}
>
<SelectTrigger className="w-full">
<SelectValue placeholder={m.select_chatbot_agent()} />
</SelectTrigger>
<SelectContent>
{agents
.filter((a) => a.type === 'chat' && a.enabled)
.map((agent) => (
<SelectItem key={agent.id} value={agent.id}>
{agent.name}
</SelectItem>
))}
</SelectContent>
</Select>
)}
</div>
</div>
</CardContent>
</Card>
{AGENT_TYPES.map((section) => {
const typeAgents = agents.filter((a) => a.type === section.type)
const Icon = section.icon
+7 -1
View File
@@ -833,5 +833,11 @@
"history": "History",
"send": "Send",
"no_history_sessions": "No chat history found.",
"delete_session_confirm": "Are you sure you want to delete this chat session?"
"delete_session_confirm": "Are you sure you want to delete this chat session?",
"configure_chatbot_agent_first": "Please configure a chatbot agent in team settings first.",
"global_chatbot": "Global Chatbot",
"global_chatbot_description": "Select the agent that handles conversation inside the global chatbot sidebar.",
"select_chatbot_agent": "Select chatbot agent",
"no_chat_agents_warning": "No chat agents found. Please create a Chat Agent below first.",
"settings_saved": "Settings saved successfully"
}
+7 -1
View File
@@ -833,5 +833,11 @@
"history": "历史记录",
"send": "发送",
"no_history_sessions": "暂无历史会话记录",
"delete_session_confirm": "您确定要删除此会话记录吗?"
"delete_session_confirm": "您确定要删除此会话记录吗?",
"configure_chatbot_agent_first": "请先在团队设置中配置聊天机器人智能体。",
"global_chatbot": "全局聊天机器人",
"global_chatbot_description": "选择在全局聊天机器人边栏中进行对话的智能体。",
"select_chatbot_agent": "选择聊天机器人智能体",
"no_chat_agents_warning": "未找到聊天智能体。请先在下方创建聊天智能体。",
"settings_saved": "设置保存成功"
}
+6
View File
@@ -780,4 +780,10 @@ export * from "./history.js";
export * from "./send.js";
export * from "./no_history_sessions.js";
export * from "./delete_session_confirm.js";
export * from "./configure_chatbot_agent_first.js";
export * from "./global_chatbot.js";
export * from "./global_chatbot_description.js";
export * from "./select_chatbot_agent.js";
export * from "./no_chat_agents_warning.js";
export * from "./settings_saved.js";
export type LocalizedString = import("../runtime.js").LocalizedString;
+7 -1
View File
@@ -781,4 +781,10 @@ export * from './shumai_agent.js'
export * from './history.js'
export * from './send.js'
export * from './no_history_sessions.js'
export * from './delete_session_confirm.js'
export * from './delete_session_confirm.js'
export * from './configure_chatbot_agent_first.js'
export * from './global_chatbot.js'
export * from './global_chatbot_description.js'
export * from './select_chatbot_agent.js'
export * from './no_chat_agents_warning.js'
export * from './settings_saved.js'
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Please configure a chatbot agent in team settings first." |
*
* @param {Configure_Chatbot_Agent_FirstInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const configure_chatbot_agent_first: ((inputs?: Configure_Chatbot_Agent_FirstInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Configure_Chatbot_Agent_FirstInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Configure_Chatbot_Agent_FirstInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Configure_Chatbot_Agent_FirstInputs */
const en_configure_chatbot_agent_first = /** @type {(inputs: Configure_Chatbot_Agent_FirstInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Please configure a chatbot agent in team settings first.`)
};
const zh_configure_chatbot_agent_first = /** @type {(inputs: Configure_Chatbot_Agent_FirstInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`请先在团队设置中配置聊天机器人智能体。`)
};
/**
* | output |
* | --- |
* | "Please configure a chatbot agent in team settings first." |
*
* @param {Configure_Chatbot_Agent_FirstInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const configure_chatbot_agent_first = /** @type {((inputs?: Configure_Chatbot_Agent_FirstInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Configure_Chatbot_Agent_FirstInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_configure_chatbot_agent_first(inputs)
return zh_configure_chatbot_agent_first(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Global Chatbot" |
*
* @param {Global_ChatbotInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const global_chatbot: ((inputs?: Global_ChatbotInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Global_ChatbotInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Global_ChatbotInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Global_ChatbotInputs */
const en_global_chatbot = /** @type {(inputs: Global_ChatbotInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Global Chatbot`)
};
const zh_global_chatbot = /** @type {(inputs: Global_ChatbotInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`全局聊天机器人`)
};
/**
* | output |
* | --- |
* | "Global Chatbot" |
*
* @param {Global_ChatbotInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const global_chatbot = /** @type {((inputs?: Global_ChatbotInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Global_ChatbotInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_global_chatbot(inputs)
return zh_global_chatbot(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Select the agent that handles conversation inside the global chatbot sidebar." |
*
* @param {Global_Chatbot_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const global_chatbot_description: ((inputs?: Global_Chatbot_DescriptionInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Global_Chatbot_DescriptionInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Global_Chatbot_DescriptionInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Global_Chatbot_DescriptionInputs */
const en_global_chatbot_description = /** @type {(inputs: Global_Chatbot_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Select the agent that handles conversation inside the global chatbot sidebar.`)
};
const zh_global_chatbot_description = /** @type {(inputs: Global_Chatbot_DescriptionInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`选择在全局聊天机器人边栏中进行对话的智能体。`)
};
/**
* | output |
* | --- |
* | "Select the agent that handles conversation inside the global chatbot sidebar." |
*
* @param {Global_Chatbot_DescriptionInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const global_chatbot_description = /** @type {((inputs?: Global_Chatbot_DescriptionInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Global_Chatbot_DescriptionInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_global_chatbot_description(inputs)
return zh_global_chatbot_description(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "No chat agents found. Please create a Chat Agent below first." |
*
* @param {No_Chat_Agents_WarningInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const no_chat_agents_warning: ((inputs?: No_Chat_Agents_WarningInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<No_Chat_Agents_WarningInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type No_Chat_Agents_WarningInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} No_Chat_Agents_WarningInputs */
const en_no_chat_agents_warning = /** @type {(inputs: No_Chat_Agents_WarningInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`No chat agents found. Please create a Chat Agent below first.`)
};
const zh_no_chat_agents_warning = /** @type {(inputs: No_Chat_Agents_WarningInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`未找到聊天智能体。请先在下方创建聊天智能体。`)
};
/**
* | output |
* | --- |
* | "No chat agents found. Please create a Chat Agent below first." |
*
* @param {No_Chat_Agents_WarningInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const no_chat_agents_warning = /** @type {((inputs?: No_Chat_Agents_WarningInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<No_Chat_Agents_WarningInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_no_chat_agents_warning(inputs)
return zh_no_chat_agents_warning(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Select chatbot agent" |
*
* @param {Select_Chatbot_AgentInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const select_chatbot_agent: ((inputs?: Select_Chatbot_AgentInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Select_Chatbot_AgentInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Select_Chatbot_AgentInputs = {};
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Select_Chatbot_AgentInputs */
const en_select_chatbot_agent = /** @type {(inputs: Select_Chatbot_AgentInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Select chatbot agent`)
};
const zh_select_chatbot_agent = /** @type {(inputs: Select_Chatbot_AgentInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`选择聊天机器人智能体`)
};
/**
* | output |
* | --- |
* | "Select chatbot agent" |
*
* @param {Select_Chatbot_AgentInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const select_chatbot_agent = /** @type {((inputs?: Select_Chatbot_AgentInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_Chatbot_AgentInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_select_chatbot_agent(inputs)
return zh_select_chatbot_agent(inputs)
});
+16
View File
@@ -0,0 +1,16 @@
/**
* | output |
* | --- |
* | "Settings saved successfully" |
*
* @param {Settings_SavedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const settings_saved: ((inputs?: Settings_SavedInputs, options?: {
locale?: "en" | "zh";
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Settings_SavedInputs, {
locale?: "en" | "zh";
}, {}>;
export type LocalizedString = import("../runtime.js").LocalizedString;
export type Settings_SavedInputs = {};
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js';
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Settings_SavedInputs */
const en_settings_saved = /** @type {(inputs: Settings_SavedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Settings saved successfully`)
};
const zh_settings_saved = /** @type {(inputs: Settings_SavedInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`设置保存成功`)
};
/**
* | output |
* | --- |
* | "Settings saved successfully" |
*
* @param {Settings_SavedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString}
*/
export const settings_saved = /** @type {((inputs?: Settings_SavedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Settings_SavedInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => {
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
if (locale === "en") return en_settings_saved(inputs)
return zh_settings_saved(inputs)
});
-1
View File
@@ -146,7 +146,6 @@ export const useChatbotStore = create<ChatbotState>((set) => ({
try {
const res = await client.api.chat.$post({
json: {
agentId: 'default',
textPrompt: text,
assetIds,
sessionId: state.currentSessionId || undefined,