mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-10 03:59:47 +00:00
feat: add page URL to Confluence page creation and update responses instead of showing page id
This commit is contained in:
parent
a9683bb1dc
commit
2c17c355d5
4 changed files with 44 additions and 9 deletions
|
|
@ -187,6 +187,10 @@ def create_create_confluence_page_tool(
|
|||
raise
|
||||
|
||||
page_id = str(api_result.get("id", ""))
|
||||
page_links = api_result.get("_links", {}) if isinstance(api_result, dict) else {}
|
||||
page_url = ""
|
||||
if page_links.get("base") and page_links.get("webui"):
|
||||
page_url = f"{page_links['base']}{page_links['webui']}"
|
||||
|
||||
kb_message_suffix = ""
|
||||
try:
|
||||
|
|
@ -213,6 +217,7 @@ def create_create_confluence_page_tool(
|
|||
return {
|
||||
"status": "success",
|
||||
"page_id": page_id,
|
||||
"page_url": page_url,
|
||||
"message": f"Confluence page '{final_title}' created successfully.{kb_message_suffix}",
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ def create_update_confluence_page_tool(
|
|||
client = ConfluenceHistoryConnector(
|
||||
session=db_session, connector_id=final_connector_id
|
||||
)
|
||||
await client.update_page(
|
||||
api_result = await client.update_page(
|
||||
page_id=final_page_id,
|
||||
title=final_title,
|
||||
body=final_content,
|
||||
|
|
@ -190,6 +190,11 @@ def create_update_confluence_page_tool(
|
|||
}
|
||||
raise
|
||||
|
||||
page_links = api_result.get("_links", {}) if isinstance(api_result, dict) else {}
|
||||
page_url = ""
|
||||
if page_links.get("base") and page_links.get("webui"):
|
||||
page_url = f"{page_links['base']}{page_links['webui']}"
|
||||
|
||||
kb_message_suffix = ""
|
||||
if final_document_id:
|
||||
try:
|
||||
|
|
@ -219,6 +224,7 @@ def create_update_confluence_page_tool(
|
|||
return {
|
||||
"status": "success",
|
||||
"page_id": final_page_id,
|
||||
"page_url": page_url,
|
||||
"message": f"Confluence page '{final_title}' updated successfully.{kb_message_suffix}",
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ interface InterruptResult {
|
|||
interface SuccessResult {
|
||||
status: "success";
|
||||
page_id: string;
|
||||
page_url?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
|
|
@ -436,10 +437,21 @@ function SuccessCard({ result }: { result: SuccessResult }) {
|
|||
</div>
|
||||
<div className="mx-5 h-px bg-border/50" />
|
||||
<div className="px-5 py-4 space-y-2 text-xs">
|
||||
<div>
|
||||
<span className="font-medium text-muted-foreground">Page ID: </span>
|
||||
<span>{result.page_id}</span>
|
||||
</div>
|
||||
{result.page_url ? (
|
||||
<a
|
||||
href={result.page_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 font-medium text-primary hover:underline"
|
||||
>
|
||||
Open in Confluence
|
||||
</a>
|
||||
) : (
|
||||
<div>
|
||||
<span className="font-medium text-muted-foreground">Page ID: </span>
|
||||
<span>{result.page_id}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ interface InterruptResult {
|
|||
interface SuccessResult {
|
||||
status: "success";
|
||||
page_id: string;
|
||||
page_url?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
|
|
@ -472,10 +473,21 @@ function SuccessCard({ result }: { result: SuccessResult }) {
|
|||
</div>
|
||||
<div className="mx-5 h-px bg-border/50" />
|
||||
<div className="px-5 py-4 space-y-2 text-xs">
|
||||
<div>
|
||||
<span className="font-medium text-muted-foreground">Page ID: </span>
|
||||
<span>{result.page_id}</span>
|
||||
</div>
|
||||
{result.page_url ? (
|
||||
<a
|
||||
href={result.page_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 font-medium text-primary hover:underline"
|
||||
>
|
||||
Open in Confluence
|
||||
</a>
|
||||
) : (
|
||||
<div>
|
||||
<span className="font-medium text-muted-foreground">Page ID: </span>
|
||||
<span>{result.page_id}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue