mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-17 19:44:45 +08:00
feat: add tiptap table extension
This commit is contained in:
@@ -11,20 +11,20 @@ from src.prose.graph.state import ProseState
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
prompt = """
|
||||
You are an AI writing assistant that continues existing text based on context from prior text.
|
||||
- Give more weight/priority to the later characters than the beginning ones.
|
||||
- Limit your response to no more than 200 characters, but make sure to construct complete sentences.
|
||||
- Use Markdown formatting when appropriate
|
||||
"""
|
||||
|
||||
|
||||
def prose_continue_node(state: ProseState):
|
||||
logger.info("Generating prose continue content...")
|
||||
model = get_llm_by_type(AGENT_LLM_MAP["prose_writer"])
|
||||
prose_content = model.invoke(
|
||||
[
|
||||
SystemMessage(
|
||||
content="""
|
||||
You are an AI writing assistant that continues existing text based on context from prior text.
|
||||
- Give more weight/priority to the later characters than the beginning ones.
|
||||
- Limit your response to no more than 200 characters, but make sure to construct complete sentences.
|
||||
- Use Markdown formatting when appropriate
|
||||
"""
|
||||
),
|
||||
SystemMessage(content=prompt),
|
||||
HumanMessage(content=state["content"]),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -11,20 +11,20 @@ from src.prose.graph.state import ProseState
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
prompt = """
|
||||
You are an AI writing assistant that fixes grammar and spelling errors in existing text.
|
||||
- Limit your response to no more than 200 characters, but make sure to construct complete sentences.
|
||||
- Use Markdown formatting when appropriate.
|
||||
- If the text is already correct, just return the original text.
|
||||
"""
|
||||
|
||||
|
||||
def prose_fix_node(state: ProseState):
|
||||
logger.info("Generating prose fix content...")
|
||||
model = get_llm_by_type(AGENT_LLM_MAP["prose_writer"])
|
||||
prose_content = model.invoke(
|
||||
[
|
||||
SystemMessage(
|
||||
content="""
|
||||
You are an AI writing assistant that fixes grammar and spelling errors in existing text.
|
||||
- Limit your response to no more than 200 characters, but make sure to construct complete sentences.
|
||||
- Use Markdown formatting when appropriate.
|
||||
- If the text is already correct, just return the original text.
|
||||
"""
|
||||
),
|
||||
SystemMessage(content=prompt),
|
||||
HumanMessage(content=f"The existing text is: {state['content']}"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -11,19 +11,19 @@ from src.prose.graph.state import ProseState
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
prompt = """
|
||||
You are an AI writing assistant that improves existing text.
|
||||
- Limit your response to no more than 200 characters, but make sure to construct complete sentences.
|
||||
- Use Markdown formatting when appropriate.
|
||||
"""
|
||||
|
||||
|
||||
def prose_improve_node(state: ProseState):
|
||||
logger.info("Generating prose improve content...")
|
||||
model = get_llm_by_type(AGENT_LLM_MAP["prose_writer"])
|
||||
prose_content = model.invoke(
|
||||
[
|
||||
SystemMessage(
|
||||
content="""
|
||||
You are an AI writing assistant that improves existing text.
|
||||
- Limit your response to no more than 200 characters, but make sure to construct complete sentences.
|
||||
- Use Markdown formatting when appropriate.
|
||||
"""
|
||||
),
|
||||
SystemMessage(content=prompt),
|
||||
HumanMessage(content=f"The existing text is: {state['content']}"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -11,18 +11,18 @@ from src.prose.graph.state import ProseState
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
prompt = """
|
||||
You are an AI writing assistant that lengthens existing text.
|
||||
- Use Markdown formatting when appropriate.
|
||||
"""
|
||||
|
||||
|
||||
def prose_longer_node(state: ProseState):
|
||||
logger.info("Generating prose longer content...")
|
||||
model = get_llm_by_type(AGENT_LLM_MAP["prose_writer"])
|
||||
prose_content = model.invoke(
|
||||
[
|
||||
SystemMessage(
|
||||
content="""
|
||||
You are an AI writing assistant that lengthens existing text.
|
||||
- Use Markdown formatting when appropriate.
|
||||
"""
|
||||
),
|
||||
SystemMessage(content=prompt),
|
||||
HumanMessage(content=f"The existing text is: {state['content']}"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -10,6 +10,10 @@ from src.llms.llm import get_llm_by_type
|
||||
from src.prose.graph.state import ProseState
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
prompt = """
|
||||
You are an AI writing assistant that shortens existing text.
|
||||
- Use Markdown formatting when appropriate.
|
||||
"""
|
||||
|
||||
|
||||
def prose_shorter_node(state: ProseState):
|
||||
@@ -17,12 +21,7 @@ def prose_shorter_node(state: ProseState):
|
||||
model = get_llm_by_type(AGENT_LLM_MAP["prose_writer"])
|
||||
prose_content = model.invoke(
|
||||
[
|
||||
SystemMessage(
|
||||
content="""
|
||||
You are an AI writing assistant that shortens existing text.
|
||||
- Use Markdown formatting when appropriate.
|
||||
"""
|
||||
),
|
||||
SystemMessage(content=prompt),
|
||||
HumanMessage(content=f"The existing text is: {state['content']}"),
|
||||
],
|
||||
)
|
||||
|
||||
@@ -10,6 +10,11 @@ from src.llms.llm import get_llm_by_type
|
||||
from src.prose.graph.state import ProseState
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
prompt = """
|
||||
You area an AI writing assistant that generates text based on a prompt.
|
||||
- You take an input from the user and a command for manipulating the text."
|
||||
- Use Markdown formatting when appropriate.
|
||||
"""
|
||||
|
||||
|
||||
def prose_zap_node(state: ProseState):
|
||||
@@ -17,13 +22,7 @@ def prose_zap_node(state: ProseState):
|
||||
model = get_llm_by_type(AGENT_LLM_MAP["prose_writer"])
|
||||
prose_content = model.invoke(
|
||||
[
|
||||
SystemMessage(
|
||||
content="""
|
||||
You area an AI writing assistant that generates text based on a prompt.
|
||||
- You take an input from the user and a command for manipulating the text."
|
||||
- Use Markdown formatting when appropriate.
|
||||
"""
|
||||
),
|
||||
SystemMessage(content=prompt),
|
||||
HumanMessage(
|
||||
content=f"For this text: {state['content']}.\nYou have to respect the command: {state['command']}"
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user