mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-06-11 11:57:03 -07:00
chore: update channels
This commit is contained in:
@@ -1218,24 +1218,8 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
const channelsEnabled = config.getChannels().length > 0;
|
||||
useEffect(() => {
|
||||
if (!channelsEnabled) return;
|
||||
const escapeAttr = (s: string) =>
|
||||
s
|
||||
.replace(/&/g, '&')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>');
|
||||
const handler = (payload: ChannelMessagePayload) => {
|
||||
const meta = payload.metadata ?? {};
|
||||
const user = meta['user'] ?? payload.sender;
|
||||
const chatId = meta['chat_id'] ?? '';
|
||||
const msgId = meta['message_id'] ?? '';
|
||||
const imagePath = meta['image_path'] ?? '';
|
||||
const safeContent = payload.content.replace(
|
||||
/<\/channel>/gi,
|
||||
'</channel>',
|
||||
);
|
||||
const formatted = `<channel source="${escapeAttr(payload.channelName)}" chat_id="${escapeAttr(chatId)}" message_id="${escapeAttr(msgId)}" user="${escapeAttr(user)}"${imagePath ? ` image_path="${escapeAttr(imagePath)}"` : ''}>\n${safeContent}\n</channel>`;
|
||||
addMessage(formatted);
|
||||
addMessage(payload.content);
|
||||
};
|
||||
coreEvents.on(CoreEvent.ChannelMessage, handler);
|
||||
return () => {
|
||||
|
||||
@@ -46,7 +46,11 @@ export const ChannelsList: React.FC<ChannelsListProps> = ({ channels }) => {
|
||||
<Text color={theme.text.secondary}>
|
||||
Direction:{' '}
|
||||
<Text
|
||||
color={channel.supportsReply ? 'green' : theme.text.secondary}
|
||||
color={
|
||||
channel.supportsReply
|
||||
? theme.status.success
|
||||
: theme.text.secondary
|
||||
}
|
||||
>
|
||||
{channel.supportsReply ? 'two-way' : 'one-way'}
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user