feat(channel): add channel support across various components and locales
- Introduced a new `channel` field in multiple request and message structures to track the source channel (e.g., "web", "api", "im"). - Updated frontend API calls and chat components to include the `channel` parameter, ensuring consistent channel tracking in user messages. - Enhanced localization files to support channel labels in English, Korean, Russian, and Chinese. - Added database migration scripts to incorporate the `channel` column in the messages table, facilitating the storage of channel information. - Refactored related functions and components to accommodate the new channel feature, improving overall message context and tracking.
This commit is contained in:
@@ -15,7 +15,7 @@ export async function generateSessionsTitle(session_id: string, data: any) {
|
||||
}
|
||||
|
||||
export async function knowledgeChat(data: { session_id: string; query: string; }) {
|
||||
return postChat(`/api/v1/knowledge-chat/${data.session_id}`, { query: data.query });
|
||||
return postChat(`/api/v1/knowledge-chat/${data.session_id}`, { query: data.query, channel: "web" });
|
||||
}
|
||||
|
||||
// Agent chat with streaming support
|
||||
@@ -28,7 +28,8 @@ export async function agentChat(data: {
|
||||
return postChat(`/api/v1/agent-chat/${data.session_id}`, {
|
||||
query: data.query,
|
||||
knowledge_base_ids: data.knowledge_base_ids,
|
||||
agent_enabled: data.agent_enabled
|
||||
agent_enabled: data.agent_enabled,
|
||||
channel: "web"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ export function useStream() {
|
||||
if (params.images !== undefined && params.images.length > 0) {
|
||||
postBody.images = params.images;
|
||||
}
|
||||
postBody.channel = "web";
|
||||
|
||||
await fetchEventSource(url, {
|
||||
method: params.method,
|
||||
|
||||
Reference in New Issue
Block a user