Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

1.3 KB
Raw Blame
import { cli, Strategy } from '@jackwener/opencli/registry';
import { DOUBAO_DOMAIN, getConversationDetail, parseDoubaoConversationId } from './utils.js';
export const detailCommand = cli({
    site: 'doubao',
    name: 'detail',
    access: 'read',
    description: 'Read a specific Doubao conversation by ID',
    domain: DOUBAO_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [
        { name: 'id', required: true, positional: true, help: 'Conversation ID (numeric or full URL)' },
    ],
    columns: ['Role', 'Text'],
    func: async (page, kwargs) => {
        const conversationId = parseDoubaoConversationId(kwargs.id);
        const { messages, meeting } = await getConversationDetail(page, conversationId);
        if (messages.length === 0 && !meeting) {
            return [{ Role: 'System', Text: 'No messages found. Verify the conversation ID.' }];
        }
        const result = [];
        if (meeting) {
            result.push({
                Role: 'Meeting',
                Text: `${meeting.title}${meeting.time ? ` (${meeting.time})` : ''}`,
            });
        }
        for (const m of messages) {
            result.push({ Role: m.Role, Text: m.Text });
        }
        return result;
    },
});