diff --git a/gptme.toml b/gptme.toml index 2edb4cfe..658fe8c1 100644 --- a/gptme.toml +++ b/gptme.toml @@ -1,3 +1,4 @@ +prompt = "This is gptme" files = ["README.md", "Makefile"] #files = ["README.md", "Makefile", "gptme/cli.py", "docs/*.rst", "docs/*.md"] diff --git a/gptme/config.py b/gptme/config.py index b22ca4c2..31ffe17f 100644 --- a/gptme/config.py +++ b/gptme/config.py @@ -41,6 +41,7 @@ def dict(self) -> dict: class ProjectConfig: """Project-level configuration, such as which files to include in the context by default.""" + prompt: str | None = None files: list[str] = field(default_factory=list) rag: dict = field(default_factory=dict) diff --git a/gptme/prompts.py b/gptme/prompts.py index 7e10bff0..dd80eab6 100644 --- a/gptme/prompts.py +++ b/gptme/prompts.py @@ -148,21 +148,18 @@ def prompt_user() -> Generator[Message, None, None]: about_user = config_prompt.get( "about_user", "You are interacting with a human programmer." ) - response_preferences = config_prompt.get("response_preferences", {}).get( - "preferences", [] - ) - response_prefs = ( - "\n".join(f"- {pref}" for pref in response_preferences) - if response_preferences - else "No specific preferences set." - ) + config_prompt.get("response_preference") + or config_prompt.get("preferences") + or "No specific preferences set." + ).strip() prompt_content = f"""# About User {about_user} ## User's Response Preferences + {response_prefs} """ yield Message("system", prompt_content) @@ -176,11 +173,13 @@ def prompt_project() -> Generator[Message, None, None]: if not projectdir: return + project_config = get_project_config(projectdir) config_prompt = get_config().prompt project = projectdir.name - project_info = config_prompt.get("project", {}).get( - project, "No specific project context provided." - ) + project_info = project_config and project_config.prompt + if not project_info: + # TODO: remove project preferences in global config? use only project config + project_info = config_prompt.get("project", {}).get(project) yield Message( "system",