9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
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;
|
|
},
|
|
});
|