chore: 项目基线(基于 WeKnora 定制版,整理文件忽略规则)
This commit is contained in:
commit
9097ee699d
5769 files changed
+1446466
No files matched your search
+29
@@ -0,0 +1,29 @@
|
||||
// Command weknora is a CLI for Tencent WeKnora knowledge bases.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/cmd"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Wire SIGINT/SIGTERM into the root context so long-running commands
|
||||
// (chat / agent invoke / doc wait) observe ctx.Done() and can run their
|
||||
// cancellation cleanup paths (e.g., re-emit the auto-created session id
|
||||
// so users can resume with --session). On signal-triggered cancellation
|
||||
// the process exits 130 regardless of what Execute returned — matches
|
||||
// the wire contract documented in cli/README.md "Exit codes".
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer cancel()
|
||||
|
||||
rc := cmd.Execute(ctx)
|
||||
|
||||
if ctx.Err() == context.Canceled {
|
||||
os.Exit(130)
|
||||
}
|
||||
os.Exit(rc)
|
||||
}
|
||||
Reference in new issue
Block a user