mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-01 00:05:43 +08:00
### What problem does this PR solve?
Adds a shared safe default implementation for unsupported Go
model-driver capability methods and migrates the confirmed panic-stub
providers to use it.
The Go `ModelDriver` interface requires providers to implement many
capability methods even when the provider does not support them. XunFei
had unsupported capability methods implemented as `panic("implement
me")`, Mistral still had a panic in `ParseFile`, and HuaweiCloud carried
an unreachable `panic("implement me")` after a normal chat return.
### Type of change
- [x] Refactoring
Co-authored-by: Haruko386 <tryeverypossible@163.com>
17 lines
337 B
Go
17 lines
337 B
Go
package models
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func requireNoSuchMethod(t *testing.T, name string, err error) {
|
|
t.Helper()
|
|
if err == nil {
|
|
t.Fatalf("%s: expected no such method error, got nil", name)
|
|
}
|
|
if !strings.Contains(err.Error(), "no such method") {
|
|
t.Fatalf("%s: expected no such method error, got %v", name, err)
|
|
}
|
|
}
|