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
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
import { DOUBAO_DOMAIN, getDoubaoConversationList } from './utils.js';
|
|
export const historyCommand = cli({
|
|
site: 'doubao',
|
|
name: 'history',
|
|
access: 'read',
|
|
description: 'List conversation history from Doubao sidebar',
|
|
domain: DOUBAO_DOMAIN,
|
|
strategy: Strategy.COOKIE,
|
|
browser: true,
|
|
siteSession: 'persistent',
|
|
navigateBefore: false,
|
|
args: [
|
|
{ name: 'limit', required: false, help: 'Max number of conversations to show', default: '50' },
|
|
],
|
|
columns: ['Index', 'Id', 'Title', 'Url'],
|
|
func: async (page, kwargs) => {
|
|
const limit = parseInt(kwargs.limit, 10) || 50;
|
|
const conversations = await getDoubaoConversationList(page);
|
|
if (conversations.length === 0) {
|
|
return [{ Index: 0, Id: '', Title: 'No conversation history found. Make sure you are logged in.', Url: '' }];
|
|
}
|
|
return conversations.slice(0, limit).map((conv, i) => ({
|
|
Index: i + 1,
|
|
Id: conv.Id,
|
|
Title: conv.Title,
|
|
Url: conv.Url,
|
|
}));
|
|
},
|
|
});
|