178 Commits

Author SHA1 Message Date
科幻大脑
6e7fb75618
Fix: handle waiting tasks when upstream is switch/categorize/relevant and normal path fails (#6874)
### What problem does this PR solve?

Fix the issue where waiting tasks couldn't be processed when upstream
components were "switch", "categorize", or "relevant" and the normal
processing path couldn't continue.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
2025-04-09 12:37:21 +08:00
Kevin Hu
61c0dfab70
Fix: Email error. (#6701)
### What problem does this PR solve?

#6695

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-04-01 10:37:04 +08:00
so95
1985ff7918
add type canvas (#6680)
add type canvas
### Type of change
- [x] Refactoring
2025-03-31 14:46:29 +08:00
Kevin Hu
60b9c027c8
Refa: add meta data to retrieval. (#6676)
### What problem does this PR solve?

#6619
### Type of change


- [x] Performance Improvement
2025-03-31 11:45:56 +08:00
Song Fuchang
ad4e59edb2
Don't split and strip input in retrieval component. (#6662)
### What problem does this PR solve?

Actually fix #6241 

Hello, I ran into the same problem as #6241. When I'm testing my agent
flow in the web ui using `Run` button with a file input, the retrieval
component always gave an empty output.

In the code I found that:

`web/src/pages/flow/debug-content/index.tsx`:

```tsx
const onOk = useCallback(async () => {
    const values = await form.validateFields();
    const nextValues = Object.entries(values).map(([key, value]) => {
      const item = parameters[Number(key)];
      let nextValue = value;
      if (Array.isArray(value)) {
        nextValue = ``;

        value.forEach((x) => {
          nextValue +=
            x?.originFileObj instanceof File
              ? `${x.name}\n${x.response?.data}\n----\n`    // Here, the file content always ends in '\n'
              : `${x.url}\n${x.result}\n----\n`;
        });
      }
      return { ...item, value: nextValue };
    });

    ok(nextValues);
  }, [form, ok, parameters]);
```

while in the `agent/component/retrieval.py`:

```python
def _run(self, history, **kwargs):
        query = self.get_input()
        query = str(query["content"][0]) if "content" in query else ""
        lines = query.split('\n')                     # inputs are split to ['xxx','yyy','----','']
        query = lines[-1] if lines else ""      # Here we always get '', thus no result
        kbs = KnowledgebaseService.get_by_ids(self._param.kb_ids)
        if not kbs:
            return Retrieval.be_output("")
```

so the code will never got correct result.

I'm not sure why the input needs such a split here, so I just removed
the splitting, and it works well on my side.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
2025-03-31 11:26:49 +08:00
Xc1995
974a467cf6
Fix: The rule of Categorize operator is adjusted. (#6599)
### What problem does this PR solve?

When I use the categorization operator, I find that if the keyword I
want to Categorize appears repeatedly in the input, then I cannot judge
the word that appears most frequently. Instead, I simply get the word
that matches and return all the ones that have made the following
changes to the categorize filter.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)
- [x] Refactoring
- [x] Performance Improvement
2025-03-27 17:02:21 +08:00
Graf2242
05997e8215
Remove thinking block from keyword node's result (#6474)
### What problem does this PR solve?

For now, if you use thinking model (deepseek-r1:32b with ollama server
in my case) in "Keyword" node, result contains all <think> block and so
node return not only keywords

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [ ] New Feature (non-breaking change which adds functionality)
- [ ] Documentation Update
- [ ] Refactoring
- [ ] Performance Improvement
- [ ] Other (please describe):
2025-03-25 10:22:41 +08:00
Richard
d869e4d43f
Fix: Preserve quotes while handling variable substitution withTemplate component. (#6410)
###Address Problem:
The original implementation used re.sub(r"(\\\"|\")", "", content) which
stripped all quotes from the processed content. While this worked for
simple Jinja2-rendered templates, it caused formatting issues when :
-Quotes were required in the final output (e.g., JSON, Python Code
strings)

###Solution:
    1. Selective JSON Serialization.
    2. Removed Global Quote Removal

### What problem does this PR solve?

This PR addresses an issue in template processing where all quotation
marks (" and \") were being removed from content, potentially corrupting
string formatting in rendered outputs. **In fact, extra quotes is
generated by json.dumps(v, ensure_ascii=False).**

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-21 19:44:03 +08:00
Kevin Hu
a2a4bfe3e3
Fix: change ollama default num_ctx. (#6395)
### What problem does this PR solve?

#6163

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-21 16:22:03 +08:00
Kevin Hu
b754bd523a
Fix: let quot stay. (#6377)
### What problem does this PR solve?

#6337

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-21 11:47:42 +08:00
科幻大脑
6784e0dfee
Fix: Resolved a bug where sibling components in Canvas were not restricted to fetching data from the upstream when parallel components were present. (#6315)
### What problem does this PR solve?

Fix: Resolved a bug where sibling components in Canvas were not
restricted to fetching data from the upstream when parallel components
were present.
Issue: When parallel components existed in Canvas, sibling components
incorrectly fetched data without being limited to the upstream scope,
causing data retrieval issues.
Solution: Adjusted the data fetching logic to ensure sibling components
only retrieve data from the upstream scope.
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-20 15:06:18 +08:00
Kevin Hu
42e89e4a92
Fix: swich follow interact issue. (#6279)
### What problem does this PR solve?

#6188

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-19 17:30:12 +08:00
Kevin Hu
8157285a79
Fix: Nan response for retrieval component. (#6265)
### What problem does this PR solve?

#6247

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-19 13:10:45 +08:00
Kevin Hu
7eb417b24f
Fix: Nan issue. (#6242)
### What problem does this PR solve?

#6065

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-18 17:58:54 +08:00
Kevin Hu
f982771131
Fix: empty retrieval kb ids. (#6236)
### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-18 17:39:10 +08:00
Kevin Hu
1b130546f8
Fix: NaN data error. (#6192)
### What problem does this PR solve?

#6065

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-18 10:23:29 +08:00
Kevin Hu
d0eda83697
Fix: none item while concating df. (#6176)
### What problem does this PR solve?

#6065

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-17 18:17:25 +08:00
writinwaters
5983803c8b
Miscellaneous UI updates (#6094)
### What problem does this PR solve?

#6049 

### Type of change

- [x] Documentation Update
- [x] Other (please describe): UI updates
2025-03-17 14:17:34 +08:00
Kevin Hu
bfa8d342b3
Fix: retrieval debug mode issue. (#6150)
### What problem does this PR solve?

#6139

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-17 13:07:13 +08:00
Kevin Hu
12c3023a22
Fix: remove NaN output of components. (#6079)
### What problem does this PR solve?

#6065

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-03-14 13:58:42 +08:00
Kevin Hu
42eb99554f
Feat: add token comsumption & speed to little lamp. (#6077)
### What problem does this PR solve?

#6059

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
2025-03-14 13:37:31 +08:00
Kevin Hu
d660f6b9a5
Feat: add use KG to retrieval component. (#5988)
### What problem does this PR solve?

#5973

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
2025-03-12 19:10:07 +08:00
Kevin Hu
dd8779b257
Feat: Retrieval supports internet search. (#5974)
### What problem does this PR solve?

#5973

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
2025-03-12 16:51:01 +08:00
Kevin Hu
caecaa7562
Feat: apply LLM to optimize citations. (#5935)
### What problem does this PR solve?

#5905

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
2025-03-11 19:56:21 +08:00
zhangcdian
bf0d516e49
Agent Update: Fix Role Issue and Enhance KB Search (#5842)
### What problem does this PR solve?

**generate.py 更新:**
问题:部分模型提供商对输入对话内容的格式有严格校验,要求第一条内容的 role 不能为 assistant,否则会报错。
解决:删除了系统设置的 agent 开场白,确保传递给模型的对话内容中,第一条内容的 role 不为 assistant。

**retrieval.py 更新:**
问题:当前知识库检索使用全部对话内容作为输入,可能导致检索结果不准确。
解决:改为仅使用用户最后提出的一个问题进行知识库检索,提高检索的准确性。

**Update generate.py:**
Issue: Some model providers have strict validation rules for the format
of input conversation content, requiring that the role of the first
content must not be assistant. Otherwise, an error will occur.
Solution: Removed the system-set agent opening statement to ensure that
the role of the first content in the conversation passed to the model is
not assistant.

**Update retrieval.py:**
Issue: The current knowledge base retrieval uses the entire conversation
content as input, which may lead to inaccurate retrieval results.
Solution: Changed the retrieval logic to use only the last question
asked by the user for knowledge base retrieval, improving retrieval
accuracy.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] Performance Improvement
2025-03-10 18:29:58 +08:00
Kevin Hu
b1bbb9e210
Refa: make Rewrite component effective to relative data expression. (#5752)
### What problem does this PR solve?

#5716

### Type of change

- [x] Refactoring
2025-03-07 13:48:13 +08:00
so95
11de7599e5
Feat: add data type invoke (#5126)
### What problem does this PR solve?
```
Invoke agent
To be able to interact dynamically with the API, there is a customizable Data Type JSON or FormData, the default is JSON 
```

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
2025-02-27 16:15:33 +08:00
Kevin Hu
5beb022ee1
Fix: string format error. (#5422)
### What problem does this PR solve?

#5404

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-02-27 12:01:46 +08:00
yihong
170abf9b7f
Fix: drop useless ABC method (#5408)
### What problem does this PR solve?

seems  no need use ABC here, there's no `abstractmethod` here

### Type of change

- [x] Performance Improvement

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
2025-02-27 11:03:21 +08:00
Kevin Hu
4f40f685d9
Code refactor (#5371)
### What problem does this PR solve?

#5173

### Type of change

- [x] Refactoring
2025-02-26 15:40:52 +08:00
Kevin Hu
bcc92e04c9
Remove <think> content for Generate if it's not stream output. (#5281)
### What problem does this PR solve?

### Type of change

- [x] Refactoring
2025-02-24 13:44:11 +08:00
Kevin Hu
041d72b755
Refine the error message. (#5275)
### What problem does this PR solve?

#5265

### Type of change

- [x] Refactoring
2025-02-24 12:42:52 +08:00
writinwaters
217caecfda
Added a guide on running a retrieval test, with and without knowledge graph (#5200)
### What problem does this PR solve?



### Type of change


- [x] Documentation Update
2025-02-21 19:36:20 +08:00
davidche
bf5f6ec262
Fix spelling errors (#5224)
### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-02-21 15:47:27 +08:00
flygithub
189007e44d
Fix: PUT method does not work as expected with Invoke component (#5081)
### What problem does this PR solve?
Invoke component can be used to call third party services.
Tried GET/POST/PUT from web UI, and found PUT request failed like this:
(test api: api/v1/chats/<assistant_id>)
 ```
{"code":100,"data":null,"message":"AttributeError("'NoneType' object has
no attribute 'get'")"}
```

Root cause: Invoke PUT with a 'data=args' parameter, which is a form-encoded data, however the default content type setting of request header is application/json. The test api could not deal with such case.

Fix: use the 'json' parameter of reqeusts.put(), same as Invoke POST. Do not use the 'data' parameter.
Another way is to use 'data=json.dumps(args)'.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-02-18 19:34:22 +08:00
Kevin Hu
84b4b38cbb
Remove <think> for exeSql component. (#5069)
### What problem does this PR solve?

#5061
#5067

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-02-18 13:39:37 +08:00
so95
ab17606e79
Rewrite Support specified language or language according to initial question (#4990)
Support specified language or language according to initial question

---------

Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
2025-02-17 13:33:43 +08:00
so95
986062a604
format number float (#4954)
format number float
2025-02-14 12:00:34 +08:00
Kevin Hu
50c99599f2
Fix DB assistant template error. (#4925)
### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-02-13 11:33:25 +08:00
WANGRUI-ZB
ca1648052a
fix categorize agent input content not format error (#4842)
### What problem does this PR solve?

Fix categorize agent input content not format error

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: wangrui <wangrui@haima.me>
2025-02-11 13:32:42 +08:00
balibabu
9e5427dc6e
Feat: Remove begin's width from agent templates #4764 (#4809)
### What problem does this PR solve?

Feat: Remove begin's width from agent templates #4764
### Type of change


- [x] New Feature (non-breaking change which adds functionality)
2025-02-10 09:59:59 +08:00
Kevin Hu
f64ae9dc33
Inner prompt parameter setting. (#4806)
### What problem does this PR solve?

#4764

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
2025-02-08 18:09:02 +08:00
writinwaters
e786f596e2
Updated template description (#4744)
### What problem does this PR solve?



### Type of change


- [x] Documentation Update
2025-02-06 17:14:13 +08:00
so95
a73e1750b6
Resume content flow ExecSQL (#4738)
resume content flow, instead of closed with errors.
2025-02-06 12:09:47 +08:00
so95
a3a70431f3
Avoid misunderstanding LLMs about the numbers value (#4724)
Avoid misunderstanding LLMs about the numbers value
2025-02-06 10:17:56 +08:00
Kevin Hu
307717b045
Fix exesql re-generate SQL issue. (#4717)
### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-02-05 16:23:48 +08:00
Kevin Hu
b2bb560007
Import akshare lazzily. (#4708)
### What problem does this PR solve?

#4696

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-02-05 12:04:11 +08:00
Kevin Hu
71c132f76d
Make infinity adapt (#4635)
### What problem does this PR solve?

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-01-24 17:45:04 +08:00
WANGRUI-ZB
bbc1d02c96
Template conversion adds Jinjia2 syntax support (#4545)
### What problem does this PR solve?

Template conversion adds Jinjia2 syntax support

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: wangrui <wangrui@haima.me>
Co-authored-by: Yingfeng <yingfeng.zhang@gmail.com>
Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
2025-01-23 17:11:14 +08:00
Kevin Hu
cbc3c5297e
Revert the chat history for rewrite. (#4579)
### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-01-22 16:55:11 +08:00