File size: 1,313 Bytes
04f192c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | <!--
SPDX-FileCopyrightText: Copyright contributors to the CopilotJ project.
SPDX-License-Identifier: Apache-2.0
-->
<script setup lang="ts">
import { IconSettings } from "@tabler/icons-vue";
import { ref } from "vue";
import type { ThreadConfig, ThreadConfigModel } from "../apis";
import { useThread } from "../store";
import FloatIconButton from "./FloatIconButton.vue";
import SettingsModel from "./SettingsModel.vue";
const props = defineProps<{
thread: ReturnType<typeof useThread>;
}>();
const showConfig = ref(false);
const config = ref<ThreadConfig | null>(null);
async function onClick() {
if (showConfig.value) {
showConfig.value = false;
return;
}
if (props.thread.config) {
config.value = props.thread.config;
showConfig.value = true;
}
}
async function submitModel(newModel: ThreadConfigModel) {
await props.thread.updateConfig({ model: newModel });
showConfig.value = false;
}
</script>
<template>
<FloatIconButton :icon="IconSettings" :disabled="thread.loading" @click="onClick" />
<Dialog v-model:visible="showConfig" modal header="Thread Configuration">
<SettingsModel
v-if="config"
:model="config?.model"
:server-model-name="null"
:show-submit-button="true"
@update:model="submitModel"
/>
</Dialog>
</template>
|