37 lines
985 B
TypeScript
37 lines
985 B
TypeScript
import { Annotation } from '@langchain/langgraph'
|
|
import { Occupation } from '@shared/types/IReadingReflectionTask'
|
|
|
|
export const ReadingReflectionState = Annotation.Root({
|
|
// 输入任务
|
|
bookName: Annotation<string>(),
|
|
author: Annotation<string | undefined>(),
|
|
description: Annotation<string>(),
|
|
occupation: Annotation<Occupation>(),
|
|
tone: Annotation<string | undefined>(),
|
|
wordCount: Annotation<number>(),
|
|
|
|
// 标题:使用简单的覆盖逻辑
|
|
title: Annotation<string>({
|
|
reducer: (_oldValue, newValue) => newValue,
|
|
default: () => ''
|
|
}),
|
|
|
|
// 内容
|
|
content: Annotation<string>({
|
|
reducer: (_oldValue, newValue) => newValue,
|
|
default: () => ''
|
|
}),
|
|
|
|
// 摘要
|
|
summary: Annotation<string>({
|
|
reducer: (_oldValue, newValue) => newValue,
|
|
default: () => ''
|
|
}),
|
|
|
|
// 关键词:数组通常使用追加或替换逻辑
|
|
keywords: Annotation<string[]>({
|
|
reducer: (_oldValue, newValue) => newValue,
|
|
default: () => []
|
|
})
|
|
})
|