Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]函数库中函数函数在定义之后无法修改 #1839

Closed
B14Lettingo opened this issue Dec 16, 2024 · 3 comments
Closed

[BUG]函数库中函数函数在定义之后无法修改 #1839

B14Lettingo opened this issue Dec 16, 2024 · 3 comments

Comments

@B14Lettingo
Copy link

联系方式

[email protected]

MaxKB 版本

v1.8.1 (build at 2024-12-12T09:58, commit: 0ed9a786)

问题描述

函数在定义之后无法修改

重现步骤

1.定义函数库
2.输入日志中的函数内容
3.将 if staff_info.lower0.startswith('p'): 修改为if staff_info.lower().startswith('p'): (这里是lower0修改为lower())

期待的正确结果

No response

相关日志输出

import requests
import json
from pydantic import BaseModel
request_url="http://xx.xx.xx.xxx:9999/main-data/md/personnels/employeelnfoList"
def get_employee_list(staff_info):
    params=[]
    if staff_info.lower0.startswith('p'):
        params.append(f"staffNo={staff_info}")
    else:
        params.append(f"staffName={staff_info}")
# if len(params)==0:# return"部门编号、部门名称、员工号、员工姓名至少有一个不能为空!
    try:
        query_string="&".join(params)
        url=f"{request_url}?{query_string}"
        response= requests.get(url).json()
        emp_list= response.get("result",0).get("records",0)
# 替换掉字段名,改为中文
        for item in emp_list:
            del item["deptNo"]
            #item["部门编码"]=item,pop("deptNo”)
            item["部门名称"]=item.pop("deptName")
            item["工号"]=item.pop("staffNo")
            item["姓名"]=item.pop("staffName")
            item["手机号"]=item.pop("mobilePhone")
        return emp_list
    except Exception as e:
        return f"无端服务暂不可用,请联系管理员"

附加信息

_20241216_.mp4
@zyyfit
Copy link

zyyfit commented Dec 18, 2024

感谢反馈,后续版本修复

@zyyfit zyyfit added this to the v1.9.0 milestone Dec 18, 2024
@baixin513
Copy link
Contributor

v1.9版本已发布。

@shaohuzhang1
Copy link
Contributor

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Version v1.9 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants