feat(api): add chat configuration and conversation message list APIs; update types and integrate into index
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
1、任务列表 - 完成
|
1、任务列表 - 完成
|
||||||
2、走本地模型配置,重构模型对话功能 - 完成
|
2、走本地模型配置,重构模型对话功能 - 完成
|
||||||
3、一键打开渠道可以新增渠道 - 完成
|
3、一键打开渠道可以新增渠道 - 完成
|
||||||
4、把龙虾包装到对话
|
4、把龙虾包装到对话 - 完成
|
||||||
5、迁移频道功能 - 完成
|
5、迁移频道功能 - 完成
|
||||||
6、迁移agent功能 - 完成
|
6、迁移agent功能 - 完成
|
||||||
7、知识库调整成上传文件,查看文件列表 - 完成
|
7、知识库调整成上传文件,查看文件列表 - 完成
|
||||||
17
src/api/chatConfig.ts
Normal file
17
src/api/chatConfig.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// @ts-ignore
|
||||||
|
import request from './request';
|
||||||
|
|
||||||
|
import * as API from './types';
|
||||||
|
|
||||||
|
/** 获取聊天配置 获取聊天配置 POST /chat/chatConfig */
|
||||||
|
export function chatChatConfigUsingPost({
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
options?: { [key: string]: unknown };
|
||||||
|
}) {
|
||||||
|
return request<API.RChatConfigDTO>('/chat/chatConfig', {
|
||||||
|
method: 'POST',
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
26
src/api/conversationMessageList.ts
Normal file
26
src/api/conversationMessageList.ts
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// @ts-ignore
|
||||||
|
import request from './request';
|
||||||
|
|
||||||
|
import * as API from './types';
|
||||||
|
|
||||||
|
/** 对话的消息列表 对话的消息列表 POST /chat/conversationMessageList */
|
||||||
|
export function chatConversationMessageListUsingPost({
|
||||||
|
body,
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
body: API.ConversationMessageListSearchForm;
|
||||||
|
options?: { [key: string]: unknown };
|
||||||
|
}) {
|
||||||
|
return request<API.RPageConversationMessageDTO>(
|
||||||
|
'/chat/conversationMessageList',
|
||||||
|
{
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
data: body,
|
||||||
|
...(options || {}),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -12,3 +12,8 @@ export * from './commodityOrderList';
|
|||||||
export * from './userOrderDetail';
|
export * from './userOrderDetail';
|
||||||
export * from './createEvent';
|
export * from './createEvent';
|
||||||
export * from './eventList';
|
export * from './eventList';
|
||||||
|
export * from './recentConversation';
|
||||||
|
export * from './conversationMessageList';
|
||||||
|
export * from './recommendedQuestionList';
|
||||||
|
export * from './chatConfig';
|
||||||
|
export * from './modelConfig';
|
||||||
|
|||||||
17
src/api/modelConfig.ts
Normal file
17
src/api/modelConfig.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// @ts-ignore
|
||||||
|
import request from './request';
|
||||||
|
|
||||||
|
import * as API from './types';
|
||||||
|
|
||||||
|
/** 获取模型配置 获取模型配置 GET /chat/modelConfig */
|
||||||
|
export function chatModelConfigUsingGet({
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
options?: { [key: string]: unknown };
|
||||||
|
}) {
|
||||||
|
return request<API.RModelConfigDTO>('/chat/modelConfig', {
|
||||||
|
method: 'GET',
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
17
src/api/recentConversation.ts
Normal file
17
src/api/recentConversation.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// @ts-ignore
|
||||||
|
import request from './request';
|
||||||
|
|
||||||
|
import * as API from './types';
|
||||||
|
|
||||||
|
/** 获取最近的一次对话 获取最近的一次对话 GET /chat/recentConversation */
|
||||||
|
export function chatRecentConversationUsingGet({
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
options?: { [key: string]: unknown };
|
||||||
|
}) {
|
||||||
|
return request<API.RConversationDTO>('/chat/recentConversation', {
|
||||||
|
method: 'GET',
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
17
src/api/recommendedQuestionList.ts
Normal file
17
src/api/recommendedQuestionList.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// @ts-ignore
|
||||||
|
import request from './request';
|
||||||
|
|
||||||
|
import * as API from './types';
|
||||||
|
|
||||||
|
/** 推荐问题列表(换一批) 推荐问题列表(换一批) GET /chat/recommendedQuestionList */
|
||||||
|
export function chatRecommendedQuestionListUsingGet({
|
||||||
|
options,
|
||||||
|
}: {
|
||||||
|
options?: { [key: string]: unknown };
|
||||||
|
}) {
|
||||||
|
return request<API.RListString>('/chat/recommendedQuestionList', {
|
||||||
|
method: 'GET',
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
116
src/api/types.ts
116
src/api/types.ts
@@ -24,6 +24,35 @@ export type AuthOauth2TokenUsingPostResponses = {
|
|||||||
200: AuthOauth2TokenUsingPostResponse;
|
200: AuthOauth2TokenUsingPostResponse;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ChatChatConfigUsingPostResponses = {
|
||||||
|
200: RChatConfigDTO;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChatConfigDTO = {
|
||||||
|
/** 智能体id */
|
||||||
|
agentId?: string;
|
||||||
|
/** 引导词列表 */
|
||||||
|
guideWords?: string[];
|
||||||
|
/** 欢迎语 */
|
||||||
|
welcomeContent?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChatConversationMessageListUsingPostResponses = {
|
||||||
|
200: RPageConversationMessageDTO;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChatModelConfigUsingGetResponses = {
|
||||||
|
200: RModelConfigDTO;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChatRecentConversationUsingGetResponses = {
|
||||||
|
200: RConversationDTO;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ChatRecommendedQuestionListUsingGetResponses = {
|
||||||
|
200: RListString;
|
||||||
|
};
|
||||||
|
|
||||||
export type CommodityEquipmentDTO = {
|
export type CommodityEquipmentDTO = {
|
||||||
/** 设施图标 */
|
/** 设施图标 */
|
||||||
icon?: string;
|
icon?: string;
|
||||||
@@ -177,6 +206,39 @@ export type ConsumerInfoEntity = {
|
|||||||
contactPhone?: string;
|
contactPhone?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ConversationDTO = {
|
||||||
|
/** 会话id */
|
||||||
|
conversationId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ConversationMessageDTO = {
|
||||||
|
/** 消息id */
|
||||||
|
messageId?: string;
|
||||||
|
/** 消息所属的会话id */
|
||||||
|
conversationId?: string;
|
||||||
|
/** 消息类型 0-文本 1-图片 2-音频 3-视频 4-文件 5-命令 */
|
||||||
|
messageType?: string;
|
||||||
|
/** 消息内容 */
|
||||||
|
messageContent?: string;
|
||||||
|
/** 消息渲染 */
|
||||||
|
messageDisplay?: string;
|
||||||
|
/** 消息发送者id */
|
||||||
|
messageSenderId?: string;
|
||||||
|
/** 消息发送者角色 */
|
||||||
|
messageSenderRole?: string;
|
||||||
|
/** 消息时间 */
|
||||||
|
messageTime?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ConversationMessageListSearchForm = {
|
||||||
|
/** 页码 */
|
||||||
|
pageNum: number;
|
||||||
|
/** 页面数量 */
|
||||||
|
pageSize: number;
|
||||||
|
/** 对话id */
|
||||||
|
conversationId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type CreateEventForm = {
|
export type CreateEventForm = {
|
||||||
/** 实体名称 */
|
/** 实体名称 */
|
||||||
entityName?: string;
|
entityName?: string;
|
||||||
@@ -264,6 +326,17 @@ export type HotelStaffTypeMappingUpdateUsingPostResponses = {
|
|||||||
200: RBoolean;
|
200: RBoolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ModelConfigDTO = {
|
||||||
|
/** 供应商名称 */
|
||||||
|
providerName?: string;
|
||||||
|
/** 模型apiKey */
|
||||||
|
apiKey?: string;
|
||||||
|
/** 模型请求地址 */
|
||||||
|
baseUrl?: string;
|
||||||
|
/** 模型名称 */
|
||||||
|
model?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type OpenDateRangeDTO = {
|
export type OpenDateRangeDTO = {
|
||||||
/** 起始时间 */
|
/** 起始时间 */
|
||||||
begin?: string;
|
begin?: string;
|
||||||
@@ -301,6 +374,19 @@ export type PageCommodityOrderDTO = {
|
|||||||
countId?: string;
|
countId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type PageConversationMessageDTO = {
|
||||||
|
records?: ConversationMessageDTO[];
|
||||||
|
total?: number;
|
||||||
|
size?: number;
|
||||||
|
current?: number;
|
||||||
|
orders?: OrderItem[];
|
||||||
|
optimizeCountSql?: boolean;
|
||||||
|
searchCount?: boolean;
|
||||||
|
optimizeJoinOfCountSql?: boolean;
|
||||||
|
maxLimit?: number;
|
||||||
|
countId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type PageEventDataDTO = {
|
export type PageEventDataDTO = {
|
||||||
records?: EventDataDTO[];
|
records?: EventDataDTO[];
|
||||||
total?: number;
|
total?: number;
|
||||||
@@ -403,6 +489,18 @@ export type RBoolean = {
|
|||||||
data?: boolean;
|
data?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type RChatConfigDTO = {
|
||||||
|
code?: number;
|
||||||
|
msg?: string;
|
||||||
|
data?: ChatConfigDTO;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RConversationDTO = {
|
||||||
|
code?: number;
|
||||||
|
msg?: string;
|
||||||
|
data?: ConversationDTO;
|
||||||
|
};
|
||||||
|
|
||||||
export type RListPcConfigChannel = {
|
export type RListPcConfigChannel = {
|
||||||
code?: number;
|
code?: number;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
@@ -415,6 +513,18 @@ export type RListRoomTypeMapping = {
|
|||||||
data?: RoomTypeMapping[];
|
data?: RoomTypeMapping[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type RListString = {
|
||||||
|
code?: number;
|
||||||
|
msg?: string;
|
||||||
|
data?: string[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type RModelConfigDTO = {
|
||||||
|
code?: number;
|
||||||
|
msg?: string;
|
||||||
|
data?: ModelConfigDTO;
|
||||||
|
};
|
||||||
|
|
||||||
export type RoomTypeMapping = {
|
export type RoomTypeMapping = {
|
||||||
/**
|
/**
|
||||||
* 创建者
|
* 创建者
|
||||||
@@ -460,6 +570,12 @@ export type RPageCommodityOrderDTO = {
|
|||||||
data?: PageCommodityOrderDTO;
|
data?: PageCommodityOrderDTO;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type RPageConversationMessageDTO = {
|
||||||
|
code?: number;
|
||||||
|
msg?: string;
|
||||||
|
data?: PageConversationMessageDTO;
|
||||||
|
};
|
||||||
|
|
||||||
export type RPageEventDataDTO = {
|
export type RPageEventDataDTO = {
|
||||||
code?: number;
|
code?: number;
|
||||||
msg?: string;
|
msg?: string;
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ function ChatHistoryPanel({
|
|||||||
const [menuState, setMenuState] = useState<MenuState>(null);
|
const [menuState, setMenuState] = useState<MenuState>(null);
|
||||||
const [isCompact, setIsCompact] = useState(false);
|
const [isCompact, setIsCompact] = useState(false);
|
||||||
|
|
||||||
const hasSessions = buckets.some((bucket) => bucket.sessions.length > 0);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCollapsedBuckets((current) => {
|
setCollapsedBuckets((current) => {
|
||||||
const next: Record<string, boolean> = {};
|
const next: Record<string, boolean> = {};
|
||||||
@@ -164,12 +162,6 @@ function ChatHistoryPanel({
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{!loading && !hasSessions ? (
|
|
||||||
<div className="rounded-[18px] border border-dashed border-[#dbe7f4] bg-white px-4 py-8 text-sm text-[#94a3b8] shadow-[0_4px_14px_rgba(15,23,42,0.04)] dark:border-[#2a2a2d] dark:bg-[#202024] dark:text-gray-400">
|
|
||||||
还没有对话,点击“新对话”开始。
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{!isCompact
|
{!isCompact
|
||||||
? buckets.map((bucket) => {
|
? buckets.map((bucket) => {
|
||||||
const isCollapsed = collapsedBuckets[bucket.key] ?? false;
|
const isCollapsed = collapsedBuckets[bucket.key] ?? false;
|
||||||
|
|||||||
Reference in New Issue
Block a user