-
Notifications
You must be signed in to change notification settings - Fork 888
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support flow.flex.yaml for csharp
- Loading branch information
Showing
5 changed files
with
253 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/promptflow-devkit/promptflow/_sdk/_utils/chat_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from pathlib import Path | ||
from urllib.parse import urlencode, urlunparse | ||
|
||
from promptflow._utils.flow_utils import resolve_flow_path | ||
|
||
|
||
def construct_flow_absolute_path(flow: str) -> str: | ||
flow_dir, flow_file = resolve_flow_path(flow) | ||
return (flow_dir / flow_file).absolute().resolve().as_posix() | ||
|
||
|
||
def construct_chat_page_url( | ||
flow_path: str, flow_dir: Path, pfs_port, url_params: dict, enable_internal_features: bool | ||
) -> str: | ||
from promptflow._sdk._service.utils.utils import encrypt_flow_path | ||
|
||
# Todo: use base64 encode for now, will consider whether need use encryption or use db to store flow path info | ||
query_dict = {"flow": encrypt_flow_path(flow_path), **url_params} | ||
if enable_internal_features: | ||
query_dict["enable_internal_features"] = "true" | ||
query_params = urlencode(query_dict) | ||
|
||
return urlunparse(("http", f"127.0.0.1:{pfs_port}", "/v1.0/ui/chat", "", query_params, "")) |
Oops, something went wrong.