Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 5cb84b8

Browse files
Link dashboard in message returned to the chat
1 parent 54a8abe commit 5cb84b8

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/codegate/pipeline/codegate_context_retriever/codegate.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ async def get_objects_from_search(
3434
) -> list[object]:
3535
storage_engine = StorageEngine()
3636
objects = await storage_engine.search(
37-
search, distance=0.8, ecosystem=ecosystem, packages=packages)
37+
search, distance=0.8, ecosystem=ecosystem, packages=packages
38+
)
3839
return objects
3940

4041
def generate_context_str(self, objects: list[object], context: PipelineContext) -> str:
@@ -109,7 +110,8 @@ async def process(
109110

110111
# Look for matches in vector DB using list of packages as filter
111112
searched_objects = await self.get_objects_from_search(
112-
last_user_message_str, ecosystem, packages)
113+
last_user_message_str, ecosystem, packages
114+
)
113115

114116
logger.info(
115117
f"Found {len(searched_objects)} matches in the database",

src/codegate/pipeline/secrets/secrets.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,9 @@ async def process_chunk(
349349
# Create notification chunk
350350
notification_chunk = self._create_chunk(
351351
chunk,
352-
f"\n🛡️ Codegate prevented {redacted_count} {secret_text} from being leaked by redacting them.\n\n", # noqa
352+
f"\n🛡️ [Codegate prevented {redacted_count} {secret_text}]"
353+
f"(http://localhost:8990/?search=codegate-secrets) from being leaked "
354+
f"by redacting them.\n\n",
353355
)
354356

355357
# Reset the counter

src/codegate/storage/storage_engine.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ async def search_by_property(self, name: str, properties: List[str]) -> list[obj
144144
logger.error(f"An error occurred: {str(e)}")
145145
return []
146146

147-
async def search(self, query: str, limit=5, distance=0.3,
148-
ecosystem=None, packages=None) -> list[object]:
147+
async def search(
148+
self, query: str, limit=5, distance=0.3, ecosystem=None, packages=None
149+
) -> list[object]:
149150
"""
150151
Search the 'Package' collection based on a query string.
151152

src/codegate/utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def generate_vector_string(package) -> str:
1818
"malicious": "However, this package is found to be malicious and must not be used.",
1919
}
2020
vector_str += f" is a {type_map.get(package['type'], 'package of unknown type')}. "
21-
package_name = quote(package["name"], safe='')
21+
package_name = quote(package["name"], safe="")
2222
package_url = f"https://www.insight.stacklok.com/report/{package['type']}/{package_name}"
2323

2424
# Add extra status

0 commit comments

Comments
 (0)