update docs for release 0.8.0 (#1419)

### What problem does this PR solve?

update docs for release 0.8.0

### Type of change

- [x] Documentation Update

---------

Co-authored-by: writinwaters <93570324+writinwaters@users.noreply.github.com>
This commit is contained in:
KevinHuSh
2024-07-08 17:06:33 +08:00
committed by GitHub
parent fce3f6df8e
commit 593c20889d
9 changed files with 36 additions and 29 deletions

View File

@ -204,7 +204,8 @@ class Canvas(ABC):
cpn = self.get_component(cpn_id)
if not cpn["downstream"]: break
if self._find_loop(): raise OverflowError("Too much loops!")
loop = self._find_loop()
if loop: raise OverflowError(f"Too much loops: {loop}")
if cpn["obj"].component_name.lower() in ["switch", "categorize", "relevant"]:
switch_out = cpn["obj"].output()[1].iloc[0, 0]
@ -277,15 +278,18 @@ class Canvas(ABC):
if len(path) < 2: return False
for l in range(1, len(path) // 2):
for l in range(2, len(path) // 2):
pat = ",".join(path[0:l])
path_str = ",".join(path)
if len(pat) >= len(path_str): return False
path_str = path_str[len(pat):]
loop = max_loops
while path_str.find(pat) >= 0 and loop >= 0:
while path_str.find(pat) == 0 and loop >= 0:
loop -= 1
path_str = path_str[len(pat):]
if loop < 0: return True
if len(pat)+1 >= len(path_str):
return False
path_str = path_str[len(pat)+1:]
if loop < 0:
pat = " => ".join([p.split(":")[0] for p in path[0:l]])
return pat + " => " + pat
return False

View File

@ -38,7 +38,7 @@ class CategorizeParam(GenerateParam):
self.check_empty(self.category_description, "[Categorize] Category examples")
for k, v in self.category_description.items():
if not k: raise ValueError(f"[Categorize] Category name can not be empty!")
if not v["to"]: raise ValueError(f"[Categorize] 'To' of category {k} can not be empty!")
if not v.get("to"): raise ValueError(f"[Categorize] 'To' of category {k} can not be empty!")
def get_prompt(self):
cate_lines = []

View File

@ -72,7 +72,10 @@ class Generate(ComponentBase):
for para in self._param.parameters:
cpn = self._canvas.get_component(para["component_id"])["obj"]
_, out = cpn.output(allow_partial=False)
kwargs[para["key"]] = "\n - ".join(out["content"])
if "content" not in out.columns:
kwargs[para["key"]] = "Nothing"
else:
kwargs[para["key"]] = "\n - ".join(out["content"])
kwargs["input"] = input
for n, v in kwargs.items():