Skip to content

Commit

Permalink
feat(ccc): support extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
kwaa committed Nov 16, 2024
1 parent e36f2cf commit 3de2c9a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/ccc/src/define/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ interface CardMeta {
}

interface CardAdditional {
/**
* Extensions.
* - extensions
*/
extensions?: Data['extensions']
/**
* First message and alternate greetings.
*
Expand Down
11 changes: 10 additions & 1 deletion packages/ccc/src/export/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ export const exportToJSON = (data: Card): CharacterCardV3 => ({
creator_notes: data.notes ?? '',
creator_notes_multilingual: data.notesMultilingual,
description: '', // TODO: add description // FIXME: important
extensions: {}, // TODO: add extensions
extensions: {
depth_prompt: {
depth: 4,
prompt: '',
role: 'system',
},
fav: false,
talkativeness: 0.5,
...data.extensions,
},
first_mes: data.greetings?.[0] ?? '',
group_only_greetings: data.greetingsGroupOnly ?? [],
mes_example: '', // TODO: add mes_example
Expand Down
26 changes: 25 additions & 1 deletion packages/ccc/src/export/types/extensions.ts
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
export interface Extensions extends Record<string, unknown> {}
export interface Extensions extends Record<string, unknown> {
/**
* @default
* ```ts
* {
* depth: 4,
* prompt: '',
* role: 'system',
* }
* ```
*/
depth_prompt?: ExtensionsDepthPrompt
/** @default `false` */
fav?: boolean
/** @default `0.5` */
talkativeness?: number
/** @default `undefined` */
world?: string
}

export interface ExtensionsDepthPrompt {
depth: number
prompt: string
role: 'system' | ({} & string)
}

0 comments on commit 3de2c9a

Please sign in to comment.