-
Notifications
You must be signed in to change notification settings - Fork 468
🚚 transfer release/v1.7.2.2 into main. #1004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cf9848a
c152338
266ae3d
cd49a8d
b20f44a
3553661
bdd9a8d
6795d6b
81868d6
2fd55e1
226b71f
bd1c9ea
b9303bb
510e16b
5be7311
c4feb11
263b866
4dce85d
0e91ce0
1341263
1913f85
959bb5d
18b9c71
cfc8d88
ada3cff
3f245bb
78cb7b8
7d136bc
dedd30a
4cedbfe
619a4f8
fe9985c
34d4563
3498743
40db874
94815d3
5e14437
b734b39
d812744
650254b
3eaad01
bc5e1f4
40816d2
6479e39
ef93c8e
320a1e0
48c57c5
9c8a92d
d8836cc
7508378
fe9c577
3dbdf17
a4a25bc
0fc21fa
45a070a
9197ad3
c7eb303
3cff130
0830577
3ab9225
8334ce7
77ca577
450f107
7f6e8d4
e062cf9
ec868ad
293f805
44fe5f2
20c436d
5534686
cf42bb4
f338cfb
062f5a7
665fef8
a4c8e62
1eb4928
bae8504
da32c0c
8fdceeb
958df0e
24bdec2
d1acb06
71bee2b
50200b6
811fc6a
f76d5e6
e77c6e2
a61a821
e92cc2f
ca99406
15c6ecb
fd405d6
cf73736
83038aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -147,7 +147,47 @@ | ||||||||||||||||||||||||||||
| - name: Push web image (arm64) to Tencent Cloud | |||||||||||||||||||||||||||||
| run: docker push ccr.ccs.tencentyun.com/nexent-hub/nexent-web:arm64 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| build-and-push-terminal-amd64: | |||||||||||||||||||||||||||||
| runs-on: ${{ fromJson(inputs.runner_label_json) }} | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Set up Docker Buildx | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then | |||||||||||||||||||||||||||||
| docker buildx create --name nexent_builder --use | |||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||
| docker buildx use nexent_builder | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Build terminal image (amd64) and load locally | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| docker buildx build --platform linux/amd64 --load -t ccr.ccs.tencentyun.com/nexent-hub/nexent-ubuntu-terminal:amd64 -f make/terminal/Dockerfile . | |||||||||||||||||||||||||||||
| - name: Login to Tencent Cloud | |||||||||||||||||||||||||||||
| run: echo ${{ secrets.TCR_PASSWORD }} | docker login ccr.ccs.tencentyun.com --username=${{ secrets.TCR_USERNAME }} --password-stdin | |||||||||||||||||||||||||||||
| - name: Push terminal image (amd64) to Tencent Cloud | |||||||||||||||||||||||||||||
| run: docker push ccr.ccs.tencentyun.com/nexent-hub/nexent-ubuntu-terminal:amd64 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| build-and-push-terminal-arm64: | |||||||||||||||||||||||||||||
|
Comment on lines
+151
to
+170
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 5 months ago To fix this problem, explicitly set a Specifically:
No other areas of the YAML file or code need modification.
Suggested changeset
1
.github/workflows/docker-build-push-mainland.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| runs-on: ${{ fromJson(inputs.runner_label_json) }} | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Set up Docker Buildx | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then | |||||||||||||||||||||||||||||
| docker buildx create --name nexent_builder --use | |||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||
| docker buildx use nexent_builder | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Build terminal image (arm64) and load locally | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| docker buildx build --platform linux/arm64 --load -t ccr.ccs.tencentyun.com/nexent-hub/nexent-ubuntu-terminal:arm64 -f make/terminal/Dockerfile . | |||||||||||||||||||||||||||||
| - name: Login to Tencent Cloud | |||||||||||||||||||||||||||||
| run: echo ${{ secrets.TCR_PASSWORD }} | docker login ccr.ccs.tencentyun.com --username=${{ secrets.TCR_USERNAME }} --password-stdin | |||||||||||||||||||||||||||||
| - name: Push terminal image (arm64) to Tencent Cloud | |||||||||||||||||||||||||||||
| run: docker push ccr.ccs.tencentyun.com/nexent-hub/nexent-ubuntu-terminal:arm64 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| manifest-push-main: | |||||||||||||||||||||||||||||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
|||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| needs: | |||||||||||||||||||||||||||||
| - build-and-push-main-amd64 | |||||||||||||||||||||||||||||
|
|
@@ -190,4 +230,19 @@ | ||||||||||||||||||||||||||||
| docker manifest create ccr.ccs.tencentyun.com/nexent-hub/nexent-web:latest \ | |||||||||||||||||||||||||||||
| ccr.ccs.tencentyun.com/nexent-hub/nexent-web:amd64 \ | |||||||||||||||||||||||||||||
| ccr.ccs.tencentyun.com/nexent-hub/nexent-web:arm64 | |||||||||||||||||||||||||||||
| docker manifest push ccr.ccs.tencentyun.com/nexent-hub/nexent-web:latest | |||||||||||||||||||||||||||||
| docker manifest push ccr.ccs.tencentyun.com/nexent-hub/nexent-web:latest | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| manifest-push-terminal: | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| needs: | |||||||||||||||||||||||||||||
| - build-and-push-terminal-amd64 | |||||||||||||||||||||||||||||
| - build-and-push-terminal-arm64 | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Login to Tencent Cloud | |||||||||||||||||||||||||||||
| run: echo ${{ secrets.TCR_PASSWORD }} | docker login ccr.ccs.tencentyun.com --username=${{ secrets.TCR_USERNAME }} --password-stdin | |||||||||||||||||||||||||||||
| - name: Create and push manifest for terminal (Tencent Cloud) | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| docker manifest create ccr.ccs.tencentyun.com/nexent-hub/nexent-ubuntu-terminal:latest \ | |||||||||||||||||||||||||||||
| ccr.ccs.tencentyun.com/nexent-hub/nexent-ubuntu-terminal:amd64 \ | |||||||||||||||||||||||||||||
| ccr.ccs.tencentyun.com/nexent-hub/nexent-ubuntu-terminal:arm64 | |||||||||||||||||||||||||||||
| docker manifest push ccr.ccs.tencentyun.com/nexent-hub/nexent-ubuntu-terminal:latest | |||||||||||||||||||||||||||||
|
Comment on lines
+236
to
+248
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Copilot AutofixAI 5 months ago The best way to fix this problem is to explicitly add a
directly below the workflow
Suggested changeset
1
.github/workflows/docker-build-push-mainland.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -147,7 +147,47 @@ | ||||||||||||||||||||||||||||
| - name: Push web image (arm64) to DockerHub | |||||||||||||||||||||||||||||
| run: docker push nexent/nexent-web:arm64 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| build-and-push-terminal-amd64: | |||||||||||||||||||||||||||||
| runs-on: ${{ fromJson(inputs.runner_label_json) }} | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Set up Docker Buildx | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then | |||||||||||||||||||||||||||||
| docker buildx create --name nexent_builder --use | |||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||
| docker buildx use nexent_builder | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Build terminal image (amd64) and load locally | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| docker buildx build --platform linux/amd64 -t nexent/nexent-ubuntu-terminal:amd64 --load -f make/terminal/Dockerfile . | |||||||||||||||||||||||||||||
| - name: Login to DockerHub | |||||||||||||||||||||||||||||
| run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u nexent --password-stdin | |||||||||||||||||||||||||||||
| - name: Push terminal image (amd64) to DockerHub | |||||||||||||||||||||||||||||
| run: docker push nexent/nexent-ubuntu-terminal:amd64 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| build-and-push-terminal-arm64: | |||||||||||||||||||||||||||||
|
Comment on lines
+151
to
+170
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 5 months ago To fix the problem and adhere to least privilege best practices, add a Implementation Steps:
Suggested changeset
1
.github/workflows/docker-build-push-overseas.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| runs-on: ${{ fromJson(inputs.runner_label_json) }} | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Set up Docker Buildx | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| if ! docker buildx inspect nexent_builder > /dev/null 2>&1; then | |||||||||||||||||||||||||||||
| docker buildx create --name nexent_builder --use | |||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||
| docker buildx use nexent_builder | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| - name: Checkout code | |||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Build terminal image (arm64) and load locally | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| docker buildx build --platform linux/arm64 -t nexent/nexent-ubuntu-terminal:arm64 --load -f make/terminal/Dockerfile . | |||||||||||||||||||||||||||||
| - name: Login to DockerHub | |||||||||||||||||||||||||||||
| run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u nexent --password-stdin | |||||||||||||||||||||||||||||
| - name: Push terminal image (arm64) to DockerHub | |||||||||||||||||||||||||||||
| run: docker push nexent/nexent-ubuntu-terminal:arm64 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| manifest-push-main: | |||||||||||||||||||||||||||||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
|||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| needs: | |||||||||||||||||||||||||||||
| - build-and-push-main-amd64 | |||||||||||||||||||||||||||||
|
|
@@ -190,4 +230,19 @@ | ||||||||||||||||||||||||||||
| docker manifest create nexent/nexent-web:latest \ | |||||||||||||||||||||||||||||
| nexent/nexent-web:amd64 \ | |||||||||||||||||||||||||||||
| nexent/nexent-web:arm64 | |||||||||||||||||||||||||||||
| docker manifest push nexent/nexent-web:latest | |||||||||||||||||||||||||||||
| docker manifest push nexent/nexent-web:latest | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| manifest-push-terminal: | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| needs: | |||||||||||||||||||||||||||||
| - build-and-push-terminal-amd64 | |||||||||||||||||||||||||||||
| - build-and-push-terminal-arm64 | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Login to DockerHub | |||||||||||||||||||||||||||||
| run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u nexent --password-stdin | |||||||||||||||||||||||||||||
| - name: Create and push manifest for terminal (DockerHub) | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| docker manifest create nexent/nexent-ubuntu-terminal:latest \ | |||||||||||||||||||||||||||||
| nexent/nexent-ubuntu-terminal:amd64 \ | |||||||||||||||||||||||||||||
| nexent/nexent-ubuntu-terminal:arm64 | |||||||||||||||||||||||||||||
| docker manifest push nexent/nexent-ubuntu-terminal:latest | |||||||||||||||||||||||||||||
|
Comment on lines
+236
to
+248
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Copilot AutofixAI 5 months ago To address this problem, you should add an explicit permissions:
contents: readunless some step or future edit truly requires additional scopes. You should place this block immediately after the
Suggested changeset
1
.github/workflows/docker-build-push-overseas.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,4 +41,13 @@ | |||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Build web frontend image | ||||||||||||||||||||
| run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --progress=plain -t nexent/nexent-web -f make/web/Dockerfile . | ||||||||||||||||||||
| run: docker build --build-arg MIRROR=https://pypi.tuna.tsinghua.edu.cn/simple --progress=plain -t nexent/nexent-web -f make/web/Dockerfile . | ||||||||||||||||||||
|
|
||||||||||||||||||||
| build-terminal: | ||||||||||||||||||||
| runs-on: ${{ fromJson(inputs.runner_label_json) }} | ||||||||||||||||||||
| steps: | ||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - name: Build terminal image | ||||||||||||||||||||
| run: docker build --progress=plain -t nexent/nexent-ubuntu-terminal -f make/terminal/Dockerfile . | ||||||||||||||||||||
|
Comment on lines
+47
to
+53
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 5 months ago To fix this problem, add a
Suggested changeset
1
.github/workflows/docker-build.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,13 @@ server { | |
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
|
|
||
| # 流式响应支持 | ||
| proxy_buffering off; | ||
| proxy_cache off; | ||
| proxy_set_header Connection ''; | ||
| proxy_http_version 1.1; | ||
| chunked_transfer_encoding off; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -37,6 +44,13 @@ server { | |
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
|
|
||
| # 流式响应支持 | ||
| proxy_buffering off; | ||
| proxy_cache off; | ||
| proxy_set_header Connection ''; | ||
| proxy_http_version 1.1; | ||
| chunked_transfer_encoding off; | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| from smolagents.utils import BASE_BUILTIN_MODULES | ||
| from services.memory_config_service import build_memory_context | ||
| from jinja2 import Template, StrictUndefined | ||
| from datetime import datetime | ||
|
|
||
| from nexent.memory.memory_service import search_memory_in_levels | ||
|
|
||
|
|
@@ -128,7 +129,8 @@ async def create_agent_config(agent_id, tenant_id, user_id, language: str = 'zh' | |
| "APP_NAME": app_name, | ||
| "APP_DESCRIPTION": app_description, | ||
| "memory_list": memory_list, | ||
| "knowledge_base_summary": knowledge_base_summary | ||
| "knowledge_base_summary": knowledge_base_summary, | ||
| "time" : datetime.now().strftime("%Y-%m-%d %H:%M:%S") | ||
| }) | ||
| else: | ||
| system_prompt = agent_info.get("prompt", "") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,22 +2,13 @@ | |
| from typing import Optional | ||
|
|
||
| from fastapi import HTTPException, APIRouter, Header, Request, Body | ||
| from fastapi.responses import StreamingResponse, JSONResponse | ||
| from nexent.core.agents.run_agent import agent_run | ||
|
|
||
| from database.agent_db import delete_related_agent | ||
| from utils.auth_utils import get_current_user_info, get_current_user_id | ||
| from agents.create_agent_info import create_agent_run_info | ||
| from fastapi.responses import JSONResponse | ||
| from consts.model import AgentRequest, AgentInfoRequest, AgentIDRequest, ConversationResponse, AgentImportRequest | ||
| from services.agent_service import get_agent_info_impl, \ | ||
| get_creating_sub_agent_info_impl, update_agent_info_impl, delete_agent_impl, export_agent_impl, import_agent_impl, \ | ||
| list_all_agent_info_impl, insert_related_agent_impl | ||
| from services.conversation_management_service import save_conversation_user, save_conversation_assistant | ||
| from services.memory_config_service import build_memory_context | ||
| from utils.config_utils import config_manager | ||
| from utils.thread_utils import submit | ||
| from agents.agent_run_manager import agent_run_manager | ||
| from agents.preprocess_manager import preprocess_manager | ||
| list_all_agent_info_impl, insert_related_agent_impl, run_agent_stream, stop_agent_tasks | ||
| from database.agent_db import delete_related_agent | ||
| from utils.auth_utils import get_current_user_info, get_current_user_id | ||
|
|
||
|
|
||
| router = APIRouter(prefix="/agent") | ||
|
|
@@ -30,43 +21,10 @@ async def agent_run_api(agent_request: AgentRequest, http_request: Request, auth | |
| """ | ||
| Agent execution API endpoint | ||
| """ | ||
| user_id, tenant_id, language = get_current_user_info(authorization, http_request) | ||
| memory_context = build_memory_context(user_id, tenant_id, agent_request.agent_id) | ||
|
|
||
| agent_run_info = await create_agent_run_info(agent_id=agent_request.agent_id, | ||
| minio_files=agent_request.minio_files, | ||
| query=agent_request.query, | ||
| history=agent_request.history, | ||
| authorization=authorization, | ||
| language=language) | ||
|
|
||
| agent_run_manager.register_agent_run(agent_request.conversation_id, agent_run_info) | ||
| # Save user message only if not in debug mode | ||
| if not agent_request.is_debug: | ||
| submit(save_conversation_user, agent_request, authorization) | ||
|
|
||
| async def generate(): | ||
| messages = [] | ||
| try: | ||
| async for chunk in agent_run(agent_run_info, memory_context): | ||
| messages.append(chunk) | ||
| yield f"data: {chunk}\n\n" | ||
| except Exception as e: | ||
| raise HTTPException(status_code=500, detail=f"Agent run error: {str(e)}") | ||
| finally: | ||
| # Save assistant message only if not in debug mode | ||
| if not agent_request.is_debug: | ||
| submit(save_conversation_assistant, agent_request, messages, authorization) | ||
| # Unregister agent run instance for both debug and non-debug modes | ||
| agent_run_manager.unregister_agent_run(agent_request.conversation_id) | ||
|
|
||
| return StreamingResponse( | ||
| generate(), | ||
| media_type="text/event-stream", | ||
| headers={ | ||
| "Cache-Control": "no-cache", | ||
| "Connection": "keep-alive" | ||
| } | ||
| return await run_agent_stream( | ||
| agent_request=agent_request, | ||
| http_request=http_request, | ||
| authorization=authorization | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -75,21 +33,8 @@ async def agent_stop_api(conversation_id: int): | |
| """ | ||
| stop agent run and preprocess tasks for specified conversation_id | ||
| """ | ||
| # Stop agent run | ||
| agent_stopped = agent_run_manager.stop_agent_run(conversation_id) | ||
|
|
||
| # Stop preprocess tasks | ||
| preprocess_stopped = preprocess_manager.stop_preprocess_tasks(conversation_id) | ||
|
|
||
| if agent_stopped or preprocess_stopped: | ||
| message_parts = [] | ||
| if agent_stopped: | ||
| message_parts.append("agent run") | ||
| if preprocess_stopped: | ||
| message_parts.append("preprocess tasks") | ||
|
|
||
| message = f"successfully stopped {' and '.join(message_parts)} for conversation_id {conversation_id}" | ||
| return {"status": "success", "message": message} | ||
| if stop_agent_tasks(conversation_id).get("status") == "success": | ||
| return {"status": "success", "message": "agent run and preprocess tasks stopped successfully"} | ||
| else: | ||
| raise HTTPException(status_code=404, detail=f"no running agent or preprocess tasks found for conversation_id {conversation_id}") | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,6 @@ | |
| from typing import Dict, Any, Optional | ||
|
|
||
| from fastapi import HTTPException, APIRouter, Header, Request | ||
| from fastapi.encoders import jsonable_encoder | ||
| from pydantic import BaseModel | ||
|
|
||
| from consts.model import ConversationResponse, ConversationRequest, RenameRequest, GenerateTitleRequest, OpinionRequest, MessageIdRequest | ||
| from services.conversation_management_service import ( | ||
|
|
||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 5 months ago
To fix the issue, you should explicitly set the
permissionskey either at the top/root of the workflow or for each job (if jobs require differing permissions). In this case, the safest and simplest fix is to set the root-levelpermissions:block, since all jobs simply check out code (requiring onlycontents: read) and do not interact with issues or pull requests. This change should be made at the top of the workflow file, after thename:and before the first key (concurrency:). No additional imports, methods, or code changes are necessary, just a YAML block specifying minimal permissions.