feat(api): add chat configuration and conversation message list APIs; update types and integrate into index

This commit is contained in:
duanshuwen
2026-04-20 17:35:41 +08:00
parent 25102c2ae4
commit f7f4ffaee9
9 changed files with 216 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
1、任务列表 - 完成
2、走本地模型配置重构模型对话功能 - 完成
3、一键打开渠道可以新增渠道 - 完成
4、把龙虾包装到对话
4、把龙虾包装到对话 - 完成
5、迁移频道功能 - 完成
6、迁移agent功能 - 完成
7、知识库调整成上传文件查看文件列表 - 完成

17
src/api/chatConfig.ts Normal file
View 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 || {}),
});
}

View 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 || {}),
}
);
}

View File

@@ -12,3 +12,8 @@ export * from './commodityOrderList';
export * from './userOrderDetail';
export * from './createEvent';
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
View 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 || {}),
});
}

View 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 || {}),
});
}

View 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 || {}),
});
}

View File

@@ -24,6 +24,35 @@ export type AuthOauth2TokenUsingPostResponses = {
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 = {
/** 设施图标 */
icon?: string;
@@ -177,6 +206,39 @@ export type ConsumerInfoEntity = {
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 = {
/** 实体名称 */
entityName?: string;
@@ -264,6 +326,17 @@ export type HotelStaffTypeMappingUpdateUsingPostResponses = {
200: RBoolean;
};
export type ModelConfigDTO = {
/** 供应商名称 */
providerName?: string;
/** 模型apiKey */
apiKey?: string;
/** 模型请求地址 */
baseUrl?: string;
/** 模型名称 */
model?: string;
};
export type OpenDateRangeDTO = {
/** 起始时间 */
begin?: string;
@@ -301,6 +374,19 @@ export type PageCommodityOrderDTO = {
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 = {
records?: EventDataDTO[];
total?: number;
@@ -403,6 +489,18 @@ export type RBoolean = {
data?: boolean;
};
export type RChatConfigDTO = {
code?: number;
msg?: string;
data?: ChatConfigDTO;
};
export type RConversationDTO = {
code?: number;
msg?: string;
data?: ConversationDTO;
};
export type RListPcConfigChannel = {
code?: number;
msg?: string;
@@ -415,6 +513,18 @@ export type RListRoomTypeMapping = {
data?: RoomTypeMapping[];
};
export type RListString = {
code?: number;
msg?: string;
data?: string[];
};
export type RModelConfigDTO = {
code?: number;
msg?: string;
data?: ModelConfigDTO;
};
export type RoomTypeMapping = {
/**
* 创建者
@@ -460,6 +570,12 @@ export type RPageCommodityOrderDTO = {
data?: PageCommodityOrderDTO;
};
export type RPageConversationMessageDTO = {
code?: number;
msg?: string;
data?: PageConversationMessageDTO;
};
export type RPageEventDataDTO = {
code?: number;
msg?: string;

View File

@@ -45,8 +45,6 @@ function ChatHistoryPanel({
const [menuState, setMenuState] = useState<MenuState>(null);
const [isCompact, setIsCompact] = useState(false);
const hasSessions = buckets.some((bucket) => bucket.sessions.length > 0);
useEffect(() => {
setCollapsedBuckets((current) => {
const next: Record<string, boolean> = {};
@@ -164,12 +162,6 @@ function ChatHistoryPanel({
</div>
) : 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
? buckets.map((bucket) => {
const isCollapsed = collapsedBuckets[bucket.key] ?? false;