forked from clan/clan-infra
matrix-bot: Improve system message
This commit is contained in:
parent
4bff8ab685
commit
674720b414
@ -169,7 +169,6 @@ async def changelog_bot(
|
||||
write_locked_file(last_run_path, last_run)
|
||||
|
||||
system_prompt = f"""
|
||||
Create a concise changelog
|
||||
Follow these guidelines:
|
||||
|
||||
- Follow the pull request format: "scope: message (#number1, #number2)"
|
||||
@ -178,8 +177,9 @@ Follow these guidelines:
|
||||
- Use markdown links to make the pull request number clickable
|
||||
- Mention each pull request number at most once
|
||||
- Group similar changes / pull requests together
|
||||
- Explain changes in a user-friendly way
|
||||
- Explain changes in a user-friendly way (be detailed if necessary)
|
||||
- Always use four '#' for headings never less than that. Example: `####New Features`
|
||||
- WRITE IN THE STYLE OF THE NEW YORK TIMES, PLEASE!
|
||||
---
|
||||
Example Changelog:
|
||||
#### Changelog:
|
||||
@ -188,7 +188,6 @@ For the last {matrix.changelog_frequency} days from {fromdate} to {todate}
|
||||
- `secrets`: [#1679]({gitea.url}/{gitea.owner}/{gitea.repo}/pulls/1679)
|
||||
> Users can now generate secrets and manage settings in the new submodules
|
||||
> This feature is available to all users with the 'admin' role
|
||||
> ...
|
||||
- `sshd`: [#1674]({gitea.url}/{gitea.owner}/{gitea.repo}/pulls/1674)
|
||||
> A workaround has been added to mitigate the security vulnerability in the sshd module
|
||||
> This workaround is temporary and will be replaced with a permanent fix in the next release
|
||||
@ -223,6 +222,19 @@ For the last {matrix.changelog_frequency} days from {fromdate} to {todate}
|
||||
|
||||
log.debug(f"Changelog generated:\n{full_changelog}")
|
||||
|
||||
if len(results) == 1:
|
||||
# Write the results to a file in the changelogs directory
|
||||
new_result_file = write_file_with_date_prefix(
|
||||
json.dumps(results, indent=4),
|
||||
data_dir / "changelogs",
|
||||
ndays=matrix.changelog_frequency,
|
||||
suffix="result",
|
||||
)
|
||||
log.info(f"LLM result written to: {new_result_file}")
|
||||
|
||||
await send_message(client, room, full_changelog)
|
||||
return
|
||||
|
||||
combine_prompt = """
|
||||
Please combine the following changelogs into a single markdown changelog.
|
||||
- Merge duplicates sections.
|
||||
|
@ -87,6 +87,7 @@ async def upload_and_process_files(
|
||||
session: aiohttp.ClientSession,
|
||||
jsonl_files: list[bytes],
|
||||
api_key: str = api_key(),
|
||||
completion_window: str = "24h",
|
||||
) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Upload multiple JSONL files to OpenAI's Batch API and process them asynchronously.
|
||||
@ -95,6 +96,10 @@ async def upload_and_process_files(
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
}
|
||||
|
||||
log.debug(
|
||||
f"Uploading {len(jsonl_files)} files to OpenAI, completion window: {completion_window}"
|
||||
)
|
||||
|
||||
async def upload_file(jsonl_data: bytes) -> str:
|
||||
upload_url = "https://api.openai.com/v1/files"
|
||||
|
||||
@ -125,7 +130,7 @@ async def upload_and_process_files(
|
||||
batch_data = {
|
||||
"input_file_id": file_id,
|
||||
"endpoint": "/v1/chat/completions",
|
||||
"completion_window": "24h",
|
||||
"completion_window": f"{completion_window}",
|
||||
}
|
||||
|
||||
async with session.post(
|
||||
|
@ -100,7 +100,8 @@ async def review_requested_bot(
|
||||
for user in room_users:
|
||||
user_name = user.display_name.lower()
|
||||
if any(
|
||||
user_name in mentioned_user for mentioned_user in mentioned_users
|
||||
user_name in mentioned_user or mentioned_user in user_name
|
||||
for mentioned_user in mentioned_users
|
||||
):
|
||||
ping_users.append(user.user_id)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user