fix: extraction of functions_dir for symlink (#103)
This commit is contained in:
+10
-10
@@ -114,10 +114,10 @@ build-bin@tool() {
|
|||||||
tool_path="tools/$name"
|
tool_path="tools/$name"
|
||||||
if [[ -f "$tool_path" ]]; then
|
if [[ -f "$tool_path" ]]; then
|
||||||
if _is_win; then
|
if _is_win; then
|
||||||
bin_file="$BIN_DIR/$basename.cmd"
|
bin_file="$BIN_DIR/$basename.cmd"
|
||||||
_build_win_shim tool $lang > "$bin_file"
|
_build_win_shim tool $lang > "$bin_file"
|
||||||
else
|
else
|
||||||
bin_file="$BIN_DIR/$basename"
|
bin_file="$BIN_DIR/$basename"
|
||||||
ln -s -f "$PWD/scripts/run-tool.$lang" "$bin_file"
|
ln -s -f "$PWD/scripts/run-tool.$lang" "$bin_file"
|
||||||
fi
|
fi
|
||||||
echo "Build bin/$basename"
|
echo "Build bin/$basename"
|
||||||
@@ -227,10 +227,10 @@ build-bin@agent() {
|
|||||||
if [[ -f "$agent_tools_file" ]]; then
|
if [[ -f "$agent_tools_file" ]]; then
|
||||||
found=true
|
found=true
|
||||||
if _is_win; then
|
if _is_win; then
|
||||||
bin_file="$BIN_DIR/$name.cmd"
|
bin_file="$BIN_DIR/$name.cmd"
|
||||||
_build_win_shim agent $lang > "$bin_file"
|
_build_win_shim agent $lang > "$bin_file"
|
||||||
else
|
else
|
||||||
bin_file="$BIN_DIR/$name"
|
bin_file="$BIN_DIR/$name"
|
||||||
ln -s -f "$PWD/scripts/run-agent.$lang" "$bin_file"
|
ln -s -f "$PWD/scripts/run-agent.$lang" "$bin_file"
|
||||||
fi
|
fi
|
||||||
echo "Build bin/$name"
|
echo "Build bin/$name"
|
||||||
@@ -304,9 +304,9 @@ build-declarations@agent() {
|
|||||||
if [[ -n "$agent_json_data" ]] && [[ -n "$tools_json_data" ]]; then
|
if [[ -n "$agent_json_data" ]] && [[ -n "$tools_json_data" ]]; then
|
||||||
json_data="$(echo "[$agent_json_data,$tools_json_data]" | jq 'flatten')"
|
json_data="$(echo "[$agent_json_data,$tools_json_data]" | jq 'flatten')"
|
||||||
elif [[ -n "$agent_json_data" ]]; then
|
elif [[ -n "$agent_json_data" ]]; then
|
||||||
json_data="$agent_json_data"
|
json_data="$agent_json_data"
|
||||||
elif [[ -n "$tools_json_data" ]]; then
|
elif [[ -n "$tools_json_data" ]]; then
|
||||||
json_data="$tools_json_data"
|
json_data="$tools_json_data"
|
||||||
fi
|
fi
|
||||||
if [[ -n "$json_data" ]]; then
|
if [[ -n "$json_data" ]]; then
|
||||||
echo "Build $declarations_file"
|
echo "Build $declarations_file"
|
||||||
@@ -447,7 +447,7 @@ clean@tool() {
|
|||||||
# @cmd Clean agents
|
# @cmd Clean agents
|
||||||
# @alias agent:clean
|
# @alias agent:clean
|
||||||
clean@agent() {
|
clean@agent() {
|
||||||
_choice_agent | xargs -I{} rm -rf "$BIN_DIR/{}"
|
_choice_agent | xargs -I{} rm -rf "$BIN_DIR/{}"
|
||||||
_choice_agent | xargs -I{} rm -rf agents/{}/functions.json
|
_choice_agent | xargs -I{} rm -rf agents/{}/functions.json
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ link-web-search() {
|
|||||||
# @cmd Link a tool as code_interpreter tool
|
# @cmd Link a tool as code_interpreter tool
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
# argc link-code-interpreter execute_py_code.py
|
# argc link-code-interpreter execute_py_code.py
|
||||||
# @arg tool![`_choice_code_interpreter`] The tool work as code_interpreter
|
# @arg tool![`_choice_code_interpreter`] The tool work as code_interpreter
|
||||||
link-code-interpreter() {
|
link-code-interpreter() {
|
||||||
_link_tool $1 code_interpreter
|
_link_tool $1 code_interpreter
|
||||||
@@ -471,7 +471,7 @@ link-code-interpreter() {
|
|||||||
|
|
||||||
# @cmd Install this repo to aichat functions_dir
|
# @cmd Install this repo to aichat functions_dir
|
||||||
install() {
|
install() {
|
||||||
functions_dir="$(aichat --info | grep -w functions_dir | awk '{print $2}')"
|
functions_dir="$(aichat --info | grep -w functions_dir | awk '{$1=""; print substr($0,2)}')"
|
||||||
if [[ -z "$functions_dir" ]]; then
|
if [[ -z "$functions_dir" ]]; then
|
||||||
_die "error: your aichat version don't support function calling"
|
_die "error: your aichat version don't support function calling"
|
||||||
fi
|
fi
|
||||||
@@ -480,7 +480,7 @@ install() {
|
|||||||
current_dir="$(cygpath -w "$(pwd)")"
|
current_dir="$(cygpath -w "$(pwd)")"
|
||||||
cmd <<< "mklink /D \"${functions_dir%/}\" \"${current_dir%/}\"" > /dev/null
|
cmd <<< "mklink /D \"${functions_dir%/}\" \"${current_dir%/}\"" > /dev/null
|
||||||
else
|
else
|
||||||
ln -s "$(pwd)" "$functions_dir"
|
ln -s "$(pwd)" "$functions_dir"
|
||||||
fi
|
fi
|
||||||
echo "$functions_dir symlinked"
|
echo "$functions_dir symlinked"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ argc build
|
|||||||
Symlink this repo directory to AIChat's **functions_dir**:
|
Symlink this repo directory to AIChat's **functions_dir**:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
ln -s "$(pwd)" "$(aichat --info | grep -w functions_dir | awk '{print $2}')"
|
ln -s "$(pwd)" "$(aichat --info | grep -w functions_dir | awk '{$1=""; print substr($0,2)}')"
|
||||||
# OR
|
# OR
|
||||||
argc install
|
argc install
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user