feat(weknoracloud): implement credential management and status checks

- Introduced a new WeKnoraCloudSettings component for managing APPID and APPSECRET.
- Added functionality to save WeKnoraCloud credentials without automatically creating models.
- Implemented credential status checks across various components to provide user feedback on configuration status.
- Updated API endpoints to handle credential saving and status retrieval.
- Enhanced UI elements to guide users in configuring WeKnoraCloud settings.

This update improves the integration of WeKnoraCloud by allowing users to manage their credentials more effectively and receive real-time feedback on their configuration status.
This commit is contained in:
wizardchen
2026-04-14 17:13:16 +08:00
committed by lyingbug
parent 0ce9dc056a
commit 0eff63b308
26 changed files with 808 additions and 541 deletions
@@ -3,21 +3,19 @@ package docparser
import (
"context"
"fmt"
"log"
"os"
"strconv"
"sync"
"time"
"github.com/Tencent/WeKnora/docreader/proto"
"github.com/Tencent/WeKnora/internal/logger"
"github.com/Tencent/WeKnora/internal/types"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/resolver"
)
var logger = log.New(os.Stdout, "[DocParser] ", log.LstdFlags|log.Lmicroseconds)
func getMaxMessageSize() int {
if sizeStr := os.Getenv("MAX_FILE_SIZE_MB"); sizeStr != "" {
if size, err := strconv.Atoi(sizeStr); err == nil && size > 0 {
@@ -46,7 +44,6 @@ func NewGRPCDocumentReader(addr string) (*GRPCDocumentReader, error) {
}
func (p *GRPCDocumentReader) connect(addr string) error {
logger.Printf("INFO: Connecting to docreader at %s", addr)
maxMsgSize := getMaxMessageSize()
opts := []grpc.DialOption{
@@ -64,7 +61,7 @@ func (p *GRPCDocumentReader) connect(addr string) error {
if err != nil {
return fmt.Errorf("failed to connect to docreader: %w", err)
}
logger.Printf("INFO: Connected to docreader in %v", time.Since(start))
logger.Infof(context.Background(), "Connected to docreader in %v", time.Since(start))
p.conn = conn
p.client = proto.NewDocReaderClient(conn)