fix: address Hermes adapter review feedback
This commit is contained in:
parent
1583a2d65a
commit
582f4ceaf4
5 changed files with 12 additions and 8 deletions
|
|
@ -227,7 +227,7 @@ export function listServerAdapters(): ServerAdapterModule[] {
|
|||
|
||||
export async function detectAdapterModel(
|
||||
type: string,
|
||||
): Promise<{ model: string | null; provider: string | null; source: string | null } | null> {
|
||||
): Promise<{ model: string; provider: string; source: string } | null> {
|
||||
const adapter = adaptersByType.get(type);
|
||||
if (!adapter?.detectModel) return null;
|
||||
const detected = await adapter.detectModel();
|
||||
|
|
|
|||
|
|
@ -677,7 +677,7 @@ export function agentRoutes(db: Db) {
|
|||
const type = req.params.type as string;
|
||||
|
||||
const detected = await detectAdapterModel(type);
|
||||
res.json(detected ?? { model: null, provider: null, source: null });
|
||||
res.json(detected);
|
||||
});
|
||||
|
||||
router.post(
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ export interface AdapterModel {
|
|||
}
|
||||
|
||||
export interface DetectedAdapterModel {
|
||||
model: string | null;
|
||||
provider: string | null;
|
||||
source: string | null;
|
||||
model: string;
|
||||
provider: string;
|
||||
source: string;
|
||||
}
|
||||
|
||||
export interface ClaudeLoginResult {
|
||||
|
|
@ -166,7 +166,7 @@ export const agentsApi = {
|
|||
`/companies/${encodeURIComponent(companyId)}/adapters/${encodeURIComponent(type)}/models`,
|
||||
),
|
||||
detectModel: (companyId: string, type: string) =>
|
||||
api.get<DetectedAdapterModel>(
|
||||
api.get<DetectedAdapterModel | null>(
|
||||
`/companies/${encodeURIComponent(companyId)}/adapters/${encodeURIComponent(type)}/detect-model`,
|
||||
),
|
||||
testEnvironment: (
|
||||
|
|
|
|||
|
|
@ -757,6 +757,7 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
|
|||
return result.data?.model ?? null;
|
||||
}
|
||||
: undefined}
|
||||
detectModelLabel={adapterType === "hermes_local" ? "Detect from Hermes config" : undefined}
|
||||
/>
|
||||
{fetchedModelsError && (
|
||||
<p className="text-xs text-destructive">
|
||||
|
|
@ -1341,6 +1342,7 @@ function ModelDropdown({
|
|||
creatable,
|
||||
detectedModel,
|
||||
onDetectModel,
|
||||
detectModelLabel,
|
||||
}: {
|
||||
models: AdapterModel[];
|
||||
value: string;
|
||||
|
|
@ -1353,6 +1355,7 @@ function ModelDropdown({
|
|||
creatable?: boolean;
|
||||
detectedModel?: string | null;
|
||||
onDetectModel?: () => Promise<string | null>;
|
||||
detectModelLabel?: string;
|
||||
}) {
|
||||
const [modelSearch, setModelSearch] = useState("");
|
||||
const [detectingModel, setDetectingModel] = useState(false);
|
||||
|
|
@ -1440,6 +1443,7 @@ function ModelDropdown({
|
|||
placeholder={creatable ? "Search models... (type to create)" : "Search models..."}
|
||||
value={modelSearch}
|
||||
onChange={(e) => setModelSearch(e.target.value)}
|
||||
autoFocus
|
||||
/>
|
||||
{modelSearch && (
|
||||
<button
|
||||
|
|
@ -1467,7 +1471,7 @@ function ModelDropdown({
|
|||
<path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
|
||||
<path d="M3 3v5h5" />
|
||||
</svg>
|
||||
{detectingModel ? "Detecting..." : "Detect from Hermes config"}
|
||||
{detectingModel ? "Detecting..." : (detectModelLabel ?? "Detect from config")}
|
||||
</button>
|
||||
)}
|
||||
{value && !models.some((m) => m.id === value) && (
|
||||
|
|
|
|||
|
|
@ -1086,7 +1086,7 @@ function LatestRunCard({ runs, agentId }: { runs: HeartbeatRun[]; agentId: strin
|
|||
.replace(/^#{1,6}\s+/gm, "")
|
||||
.split("\n")
|
||||
.map((l) => l.trim())
|
||||
.filter((l) => l.length > 0 && !l.startsWith("---") && !l.startsWith("|") && !l.startsWith("```"));
|
||||
.filter((l) => l.length > 0 && !l.startsWith("---") && !l.startsWith("|") && !l.startsWith("```") && !/^[-*>]/.test(l) && !/^\d+\./.test(l));
|
||||
const excerpt: string[] = [];
|
||||
let chars = 0;
|
||||
for (const line of lines) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue